void Inventory() { if (Building.Inventory == null) { return; } if (_showAInventory == null) { _showAInventory = new ShowAInventory(Building.Inventory, _gaveta.gameObject, _invIniPos.transform.localPosition); ShowProductionReport(); } else if (oldBuildID != Building.MyId) { oldBuildID = Building.MyId; oldItemsCount = Building.Inventory.InventItems.Count; _showAInventory.DestroyAll(); _showAInventory = new ShowAInventory(Building.Inventory, _gaveta.gameObject, _invIniPos.transform.localPosition); //so when a new building is clicked changes ShowProductionReport(); } else if (_showAInventory != null && (oldItemsCount != Building.Inventory.InventItems.Count || Building.IsToReloadInv())) { //if new items got in the inv needs to redo Stats in case is a new production if (oldItemsCount != Building.Inventory.InventItems.Count) { ReloadStatsWhenNeeded(true); oldItemsCount = Building.Inventory.InventItems.Count; } _showAInventory.UpdateToThisInv(Building.Inventory); } ReloadStatsWhenNeeded(); _showAInventory.ManualUpdate(); _inv.text = BuildStringInv(Building); }
private void LoadMenu() { if (_person == null) { return; } _title.text = _person.Name + ""; _info.text = BuildPersonInfo(); if (_showAInventory == null) { _showAInventory = new ShowAInventory(_person.Inventory, _gaveta, _invIniPos.transform.localPosition); } //diff person else if (_showAInventory != null && _person.IsToReloadInventory()) { _showAInventory.DestroyAll(); _showAInventory = new ShowAInventory(_person.Inventory, _gaveta, _invIniPos.transform.localPosition); _person.InventoryReloaded(); //if (_aPersonBuildingDetails != null) //{ // _aPersonBuildingDetails.ManualUpdate(_person, true); //} } _showAInventory.ManualUpdate(); _inv.text = BuildStringInv(_person); if (_aPersonBuildingDetails == null) { _aPersonBuildingDetails = new ShowAPersonBuildingDetails(_person, _general, _inv_Ini_Pos_Gen.transform.localPosition); } else { //manual update _aPersonBuildingDetails.ManualUpdate(_person); } }