本文整理汇总了C#中Inventory.Where方法的典型用法代码示例。如果您正苦于以下问题:C# Inventory.Where方法的具体用法?C# Inventory.Where怎么用?C# Inventory.Where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Inventory
的用法示例。
在下文中一共展示了Inventory.Where方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawInventory
public static void DrawInventory(Inventory inventory)
{
ZIOX.OutputType = ZIOX.OutputTypeEnum.Buffer;
ZIOX.BufferName = UIConfig.Buffer_Inventory;
ZBuffer.ClearBuffer(ZIOX.BufferName);
ZIOX.Draw_Stat(UIConfig.InventoryStatsArea, 0, "Inventory", ZIOX.Draw_Mass, inventory.TotalWeight / 10);
var backpack = inventory.Where(w => w != inventory.ActiveItem).ToArray();
for (var i = 0; i < backpack.Length; i++)
{
ZIOX.Draw_Item(UIConfig.InventoryStatsArea, 1+i, backpack[i].Type.Name, false);
}
ZBuffer.WriteBuffer(UIConfig.Buffer_Inventory, UIConfig.InventoryRect.Left, UIConfig.InventoryRect.Top);
ZIOX.OutputType = ZIOX.OutputTypeEnum.Direct;
}
示例2: Sufficient
public bool Sufficient(Inventory inventory)
{
int newItemCount = 0;
foreach(object product in products)
{
Item item = product as Item;
if (item is Item && !inventory.Any(x=>x.id == item.id))
newItemCount++;
}
if (newItemCount + inventory.Count > inventory.maxCount)
return false;
foreach (var item in this.materials)
{
if (!inventory.Any(x=>x.id == item.id) || inventory.Where(x=>x.id == item.id).Sum(x=>x.itemCount) < item.itemCount)
{
return false;
}
}
return true;
}