public void UpdatePanelSlots() { int index = 0; List <Item> panelList = new List <Item>(); foreach (KeyValuePair <Item, int> keyPair in itemList) { panelList.Add(keyPair.Key); } foreach (Transform child in GameManager.gm.data.inventorySlots.transform) { InventorySlotController slot = child.GetComponent <InventorySlotController>(); if (index < itemList.Count) { slot.item = panelList[index]; } else { slot.item = null; } slot.UpdateInfo(); index++; } GameManager.gm.data.goldPieces.text = GetCoins(); GameEvents.OnInventoryUpdated(); }
void UpdatePanelSlots() { int index = 0; foreach (Transform child in inventoryPanel.transform) { InventorySlotController slot = child.GetComponent <InventorySlotController>(); if (index < list.Count) { slot.item = list[index]; } else { slot.item = null; } slot.UpdateInfo(); index++; } }
public void UpdatePanelSlots() { int index = 0; foreach (Transform child in inventoryPanel.transform) { InventorySlotController slot = child.GetComponent <InventorySlotController>(); if (index < playerSheet.bag.Count) { slot.item = playerSheet.bag[index]; //slot.amount = 1; f } else { slot.item = null; } slot.UpdateInfo(); index++; } }