Пример #1
0
 public void GetResult(string itemName)
 {
     InventoryList.Clear();
     Task.Factory.StartNew(() =>
     {
         return(InventoryService.FindItemByName(itemName));
     }).ContinueWith(task =>
     {
         foreach (Inventory result in task.Result)
         {
             var quantityOnEbay     = InventoryService.FindEBayListingQuantity(result.ItemId);
             bool potentialOversold = false;
             if ((result.ExternalQuantity == 0 && result.AmazonQuantity > 0) || (result.ExternalQuantity == 0 && quantityOnEbay > 0))
             {
                 potentialOversold = true;
             }
             var resultDTO = new InventoryDTO
             {
                 ItemID            = result.ItemId,
                 SKU               = result.Sku,
                 Title             = result.Title,
                 Quantity          = result.ExternalQuantity,
                 Price             = result.FixedPrice,
                 QuantityOnEbay    = quantityOnEbay,
                 QuantityOnAmazon  = result.AmazonQuantity,
                 PotentialOversold = potentialOversold
             };
             InventoryList.Add(resultDTO);
         }
     },
                     System.Threading.CancellationToken.None,
                     TaskContinuationOptions.None,
                     TaskScheduler.FromCurrentSynchronizationContext());
 }
Пример #2
0
 public void Initialize()
 {
     // called once per save
     firstLoadHappened = false;
     currentHP         = maxHP;
     currentEnergy     = maxEnergy;
     sceneName         = "";
     persistentObjects.Clear();
     playerItems.Clear();
     gameFlags.Clear();
     gameStates.Clear();
     unlocks.Clear();
     persistentObjectKeys.Clear();
     persistentObjectValues.Clear();
 }
Пример #3
0
 public void RefreshSellingItems(Level level)
 {
     _sellingItems.Clear();
     foreach (var shopItem in ShopItems)
     {
         if (level.Normal < shopItem.MinLevel)
         {
             continue;
         }
         for (int i = 0; i < SellingItemsRounds; i++)
         {
             if (Dice.TryGetChance(shopItem.SellChance))
             {
                 _sellingItems.Add(shopItem.ItemFactory.Build(level.Normal));
             }
         }
     }
 }