public void UpdateChangeEquip() { Button[] buttons = changeEquipPanel.GetComponentsInChildren <Button>(); foreach (Button b in buttons) { Destroy(b.gameObject); } GameObject unbtn = Instantiate(unequipButton); UnequipItemButtonController unbtnCont = unbtn.GetComponent <UnequipItemButtonController>(); unbtnCont.invPanel = changeEquipItems; unbtn.GetComponent <Button>().interactable = true; if (party.InventoryNotEmpty()) { for (int i = 0; i < party.playerInventoryCount.Length; i++) { if (party.playerInventoryCount[i] > 0 && Databases.items[i].itemType == ItemType.Equipable && ((EquipableItem)Databases.items[i]).equipLoc == eq.GetEquipLoc() && eq.CanEquip(((EquipableItem)Databases.items[i]).equippableBy)) { GameObject btn = Instantiate(equipItemButton); EquipItemButtonController btnCont = btn.GetComponent <EquipItemButtonController>(); btnCont.invPanel = changeEquipItems; btnCont.invItemNum = i; btn.GetComponent <Button>().interactable = true; } } } }
public void ShowInventoryPanel() { DisableMainButtons(); inventoryPanel.SetActive(true); Button[] buttons = itemPanel.GetComponentsInChildren <Button>(); foreach (Button b in buttons) { Destroy(b.gameObject); } if (party.InventoryNotEmpty()) { for (int i = 0; i < party.playerInventoryCount.Length; i++) { if (party.playerInventoryCount[i] > 0) { GameObject btn = Instantiate(itemPrefab); Button theBtn = btn.GetComponent <Button>(); BattleInventoryButtonController btnCont = btn.GetComponent <BattleInventoryButtonController>(); btnCont.invPanel = itemPanel; btnCont.invItemNum = i; if (Databases.items[i].itemType == ItemType.Consumable && ((ConsumableItem)Databases.items[i]).useableOutOfCombat == true) { theBtn.interactable = true; } } } } }
public void UpdateInventory() { Button[] buttons = itemPanel.GetComponentsInChildren <Button>(); foreach (Button b in buttons) { Destroy(b.gameObject); } if (party.InventoryNotEmpty()) { for (int i = 0; i < party.playerInventoryCount.Length; i++) { if (party.playerInventoryCount[i] > 0) { GameObject btn = Instantiate(inventoryButton); InventoryButtonController btnCont = btn.GetComponent <InventoryButtonController>(); btnCont.invPanel = itemPanel; btnCont.invItemNum = i; } } } }