public void UpdateInventoryCategories() { Consumables.Clear(); Weapons.Clear(); KeyItems.Clear(); Statements.Clear(); foreach (var gameItemQuantity in _inventory) { if (gameItemQuantity.GameItem is Consumable) { Consumables.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is Weapon) { Weapons.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is KeyItem) { KeyItems.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is Statement) { Statements.Add(gameItemQuantity); } } }
private void LoadConsumables() { if (!File.Exists(filePathFood)) { return; } var conten = File.ReadAllText(filePathFood, Encoding.UTF8); var list = JsonConvert.DeserializeObject <List <ConsumableViewModel> >(conten); Consumables.Clear(); Consumables.AddRange(list); }