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


C# Inventory.GetItems方法代码示例

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


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

示例1: UseLuckyEgg

        public static async Task UseLuckyEgg(Client client, Inventory inventory, StateMachine machine)
        {
            var inventoryContent = await inventory.GetItems();

            var luckyEggs = inventoryContent.Where(p => p.ItemId == ItemId.ItemLuckyEgg);
            var luckyEgg = luckyEggs.FirstOrDefault();

            if (luckyEgg == null || luckyEgg.Count <= 0 || _lastLuckyEggTime.AddMinutes(30).Ticks > DateTime.Now.Ticks)
                return;

            _lastLuckyEggTime = DateTime.Now;
            await client.Inventory.UseItemXpBoost();
            var refreshCachedInventory = await inventory.RefreshCachedInventory();
            machine.Fire(new UseLuckyEggEvent {Count = luckyEgg.Count});
            await Task.Delay(2000);
        }
开发者ID:Rausu,项目名称:NecroBot,代码行数:16,代码来源:EvolvePokemonTask.cs

示例2: UseLuckyEgg

        public static void UseLuckyEgg(Client client, Inventory inventory, StateMachine machine)
        {
            var inventoryContent = inventory.GetItems().Result;

            var luckyEggs = inventoryContent.Where(p => p.ItemId == ItemId.ItemLuckyEgg);
            var luckyEgg = luckyEggs.FirstOrDefault();

            if (luckyEgg == null || luckyEgg.Count <= 0)
                return;

            client.Inventory.UseItemXpBoost().Wait();

            luckyEgg.Count -= 1;
            machine.Fire(new UseLuckyEggEvent {Count = luckyEgg.Count});

            Thread.Sleep(2000);
        }
开发者ID:Citrusbomb,项目名称:NecroBot,代码行数:17,代码来源:EvolvePokemonTask.cs

示例3: RetrieveItemDescriptions

 /*
  * Retrieve all the owned items and get the description of each
  * including the correct price if user is buying or selling.
  */
 private string[] RetrieveItemDescriptions (Inventory inventory)
 {
     string[] itemTexts = new string[inventory.GetItems ().Count];
     int index = 0;
     Item item;
     foreach (int itemID in inventory.GetItems().Keys) {
         item = itemDB.GetItem (itemID);
         itemTexts [index] = item.itemName + "\n";
         if (state == ShopState.BUYING) {
             itemTexts [index] += String.Format ("Price: {0}\n\n", item.price);
         } else if (state == ShopState.SELLING) {
             itemTexts [index] += String.Format ("Price: {0}\n\n", item.sellPrice);
         }
         itemTexts [index] += item.description;
         index++;
     }
     return itemTexts;
 }
开发者ID:lannes,项目名称:farm-with-friends,代码行数:22,代码来源:Shop.cs

示例4: RetrieveItemNames

 /*
  * Retrieve all the owned items and get the item names to display in
  * the shopping gui.
  */
 private string[] RetrieveItemNames (Inventory inventory)
 {
     string[] itemNames = new string[inventory.GetItems ().Count];
     int index = 0;
     Item item;
     foreach (int itemID in inventory.GetItems().Keys) {
         item = itemDB.GetItem (itemID);
         itemNames [index] = item.itemName;
         index++;
     }
     return itemNames;
 }
开发者ID:lannes,项目名称:farm-with-friends,代码行数:16,代码来源:Shop.cs


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