public Inventory() : base("playerInventory", EventId.InventoryResourceUpdated, null) { this.Troop = base.CreateSubstorage("troop", EventId.InventoryTroopUpdated, typeof(TroopTypeVO)); this.SpecialAttack = base.CreateSubstorage("specialAttack", EventId.InventorySpecialAttackUpdated, typeof(SpecialAttackTypeVO)); this.Hero = base.CreateSubstorage("hero", EventId.InventoryHeroUpdated, typeof(TroopTypeVO)); this.Champion = base.CreateSubstorage("champion", EventId.InventoryChampionUpdated, typeof(TroopTypeVO)); }
public InventoryStorage CreateSubstorage(string key, EventId updateEvent, Type inventoryType) { InventoryStorage inventoryStorage = new InventoryStorage(key, updateEvent, inventoryType); this.subStorage.Add(key, inventoryStorage); return(inventoryStorage); }
public bool IsInventorySubstorageFull() { if (this.totalStorageCapacity == -1) { return(false); } int num = 0; foreach (string current in this.subStorage.Keys) { InventoryStorage inventoryStorage = this.subStorage[current]; num += inventoryStorage.GetTotalStorageAmount(); } return(num >= this.totalStorageCapacity); }