当前位置: 首页>>代码示例>>C#>>正文


C# Item.Where方法代码示例

本文整理汇总了C#中Item.Where方法的典型用法代码示例。如果您正苦于以下问题:C# Item.Where方法的具体用法?C# Item.Where怎么用?C# Item.Where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Item的用法示例。


在下文中一共展示了Item.Where方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateAvailableSpells

    public void UpdateAvailableSpells(Item[] items)
    {
        string[] newSpells = gameController.GetSpellsFromItems (items.Where (i => i != null).ToArray ());

        spells = new Spell[newSpells.Length];

        for (int i = 0; i < newSpells.Length; i++) {
            try {
                GameObject temp = Resources.Load ("Spells/" + newSpells [i]) as GameObject;
                spells [i] = temp.GetComponent<Spell> ();
            } catch {
                Debug.Log("Error: Could not load spell " + newSpells [i]);
            }
        }

        spells = spells.Where (i => i != null).ToArray ();

        for (int i = 0; i < spells.Length; i++) {
            spellCooldowns [i].GetComponent<Image> ().sprite = spells [i].icon;

            if (!nextCasts.ContainsKey (spells [i].name))
                nextCasts.Add (spells [i].name, 0f);
        }

        UpdateSpellCooldowns ();
    }
开发者ID:tvance989,项目名称:wizard-game,代码行数:26,代码来源:SpellController.cs

示例2: GetSpellsFromItems

    public string[] GetSpellsFromItems(Item[] items)
    {
        items = items.Where (s => s != null).ToArray ();

        string[] classes = new string [items.Length];
        for (int i = 0; i < items.Length; i++) {
            if (items [i] == null)
                continue;
            classes [i] = items [i].wizardClass;
        }

        classes = classes.Where (s => s != null).ToArray ();
        Array.Sort (classes);

        List<string> availableSpells = new List<string>();
        string key = "";

        // 1x
        for (int i = 0; i < classes.Length; i++) {
            key = classes [i];
            try {
                availableSpells.Add (spells [key]);
            } catch {
        //				Debug.Log ("There is no spell defined for " + key);
            }
        }
        // 2x
        for (int i = 0; i < classes.Length; i++) {
            for (int j = 0; j < i; j++) {
                key = classes [j] + classes [i];
                try {
                    availableSpells.Add (spells [key]);
                } catch {
        //					Debug.Log ("There is no spell defined for " + key);
                }
            }
        }
        // 3x
        if (classes.Length == 3) {
            key = string.Join ("", classes);
            try {
                availableSpells.Add (spells [key]);
            } catch {
        //				Debug.Log ("There is no spell defined for " + key);
            }
        }

        //		Debug.Log ("Available spells: " + string.Join(", ", availableSpells.ToArray()));

        return availableSpells.Distinct ().ToArray ();
    }
开发者ID:tvance989,项目名称:wizard-game,代码行数:51,代码来源:GameController.cs

示例3: GetSubTaxSumm

        static List<TaxSumm> GetSubTaxSumm(Item[] itemcodes, List<InvoiceDtls> invs)
        {
            List<TaxSumm> summ = new List<TaxSumm>();
            var grp = from p in invs
                group p by p.taxgrp into g
                select new { taxgrp = g.Key, ttltax = g.Sum(x => x.tax), ttlAmt = g.Sum(v => v.netamount) };
            foreach (var g in grp)
            {
                TaxSumm tsumm = new TaxSumm();
                var list3 = itemcodes.Where(x => x.taxgrp == g.taxgrp).ToList();
                if (list3.Count > 0)
                {

                    tsumm.TaxDesc = g.taxgrp.Trim() + " @ " + list3[0].tax.ToString() + "%";
                }
                else tsumm.TaxDesc= g.taxgrp.Trim();
                tsumm.TaxAmt = g.ttltax;
                tsumm.Amount = g.ttlAmt;
                tsumm.TaxGrp = g.taxgrp;
                summ.Add(tsumm);
            }

            return summ;
        }
开发者ID:mokth,项目名称:merpV3,代码行数:24,代码来源:InvoiceSummary.cs

示例4: GenerateHonestyItems

		private static void GenerateHonestyItems()
		{
			try
			{
				var count = MaxGeneration - _Items.Count;

				var spawned = new Item[count];

				for (var i = 0; i < spawned.Length; i++)
				{
					var item = spawned[i] = Loot.RandomArmorOrShieldOrWeapon();

					if (item == null || item.Deleted)
					{
						--i;

						continue;
					}

					item.HonestyItem = true;

					lock (_ItemsLock)
					{
						if (!_Items.Contains(item))
						{
							_Items.Add(item);
						}
					}
				}

				var locs = new Dictionary<Map, Point3D?[]>();

				if (TrammelGeneration)
				{
					locs[Map.Trammel] = new Point3D?[spawned.Length];
				}

				locs[Map.Felucca] = new Point3D?[spawned.Length];

				Parallel.For(
					0,
					spawned.Length,
					i =>
					{
						var map = TrammelGeneration && Utility.RandomBool() ? Map.Trammel : Map.Felucca;

						locs[map][i] = GetValidLocation(map);
					});

				foreach (var kv in locs)
				{
					var map = kv.Key;
					var points = kv.Value;

					for (var i = 0; i < spawned.Length;)
					{
						var loc = points[i];

						if (loc == null || loc == Point3D.Zero)
						{
							continue;
						}

						var item = spawned[i];

						if (item == null || item.Deleted)
						{
							continue;
						}

						item.HonestyRegion = _Regions[Utility.Random(_Regions.Length)];

						if (!String.IsNullOrWhiteSpace(item.HonestyRegion))
						{
							var attempts = BaseVendor.AllVendors.Count / 10;

							BaseVendor m;

							do
							{
								m = BaseVendor.AllVendors[Utility.Random(BaseVendor.AllVendors.Count)];
							}
							while ((m == null || m.Map != map || !m.Region.IsPartOf(item.HonestyRegion)) && --attempts >= 0);

							item.HonestyOwner = m;
						}

						ItemFlags.SetTaken(item, false);

						item.MoveToWorld(loc.Value, map);

						spawned[i] = null;
					}
				}

				foreach (var item in spawned.Where(item => item != null && !item.Deleted))
				{
					item.Delete();
				}
			}
//.........这里部分代码省略.........
开发者ID:mcarriere,项目名称:ServUO,代码行数:101,代码来源:Honesty.cs


注:本文中的Item.Where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。