private void AddUniqueItemsFrom <T>(List <T> items) where T : CatalogItemModel { var uniqueItems = items.Where(i => !AllItems.Any(a => a.Sku.Equals(i.Sku))).ToList(); if (uniqueItems.Any()) { AllItems.AddRange(uniqueItems); } }
private void HandleInventoryUpdate(Action callback) { AllItems.Clear(); AllItems.AddRange(VirtualItems); AllItems.AddRange(Subscriptions); UpdateVirtualCurrencyBalanceEvent?.Invoke(Balance); UpdateItemsEvent?.Invoke(VirtualItems); UpdateSubscriptionsEvent?.Invoke(Subscriptions); RefreshEvent?.Invoke(); callback?.Invoke(); }
private void LoadItems(string[] fileNames) { foreach (var file in fileNames) { var toAdd = LoadJsonFile(file); if (toAdd != null) { AllItems.AddRange(toAdd); } } }
private IEnumerator UpdateVirtualCurrenciesCoroutine(Action <Error> onError = null) { var busy = true; _demoImplementation.GetCatalogVirtualCurrencies(items => { Currencies = items; AllItems.AddRange(items); UpdateVirtualCurrenciesEvent?.Invoke(items); busy = false; }, onError); yield return(new WaitWhile(() => busy)); }
public void SampleTree() { AItem Root = new AItem() { Name = "Happy life" }; Root.AddChild(new AItem() { Name = "child1", Position = new PointF(200, 0), Progress = 45, IsProgress = true }); AllItems.Add(Root); AllItems.AddRange(Root.Childs); }
public Inventory(List <byte> gameStateByteArray, DataOvlReference dataOvlRef) { this.gameStateByteArray = gameStateByteArray; DataChunk.CreateDataChunk(DataChunk.DataFormatType.Byte, "Grapple", gameStateByteArray, 0x209, sizeof(byte)); DataChunk.CreateDataChunk(DataChunk.DataFormatType.Byte, "Magic Carpet", gameStateByteArray, 0x20A, sizeof(byte)); ProtectiveArmour = new Armours(dataOvlRef, gameStateByteArray); AllItems.AddRange(ProtectiveArmour.GenericItemList); ReadyItems.AddRange(ProtectiveArmour.GenericItemList); TheWeapons = new Weapons(dataOvlRef, gameStateByteArray); ReadyItems.AddRange(TheWeapons.GenericItemList); MagicScrolls = new Scrolls(dataOvlRef, gameStateByteArray); UseItems.AddRange(MagicScrolls.GenericItemList); MagicPotions = new Potions(dataOvlRef, gameStateByteArray); UseItems.AddRange(MagicPotions.GenericItemList); SpecializedItems = new SpecialItems(dataOvlRef, gameStateByteArray); AllItems.AddRange(SpecializedItems.GenericItemList); UseItems.AddRange(SpecializedItems.GenericItemList); Artifacts = new LordBritishArtifacts(dataOvlRef, gameStateByteArray); AllItems.AddRange(Artifacts.GenericItemList); UseItems.AddRange(Artifacts.GenericItemList); Shards = new ShadowlordShards(dataOvlRef, gameStateByteArray); AllItems.AddRange(Shards.GenericItemList); UseItems.AddRange(Shards.GenericItemList); SpellReagents = new Reagents(dataOvlRef, gameStateByteArray); AllItems.AddRange(SpellReagents.GenericItemList); MagicSpells = new Spells(dataOvlRef, gameStateByteArray); AllItems.AddRange(MagicSpells.GenericItemList); }