public virtual void CreateSlot() { for (int t = 0; t < rowCount * colCount; t++) { if (t >= slotList.Count) { UIGridSlot s = Instantiate(slotPrefab, viewTransform).GetComponent <UIGridSlot>(); slotList.Add(s); } } UpdateSlot(); }
public override void CreateSlot() { int slotCount = Inventory.GetInventorySize(); for (int t = 0; t < slotCount; t++) { if (t >= slotList.Count) { UIGridSlot s = Instantiate(slotPrefab, viewTransform).GetComponent <UIGridSlot>(); slotList.Add(s); } } UpdateSlot(); }
public override void UpdateSlot() { itemList = Inventory.GetItemList(); itemCountList = Inventory.GetItemCountList(); for (int i = 0; i < slotList.Count; i++) { UIGridSlot s = slotList[i]; if (i >= itemList.Count) { s.SetSlot(-1, null, 0); s.clickEvent = null; } else { ItemData item = ItemDB.Instance.FindItem(itemList[i]); s.SetSlot(i, item.Icon, itemCountList[i]); s.clickEvent = OpenDetail; } } GetComponent <RectTransform>().ForceUpdateRectTransforms(); }