public virtual void CreateSlot() { for (int t = 0; t < listCount; t++) { if (t >= slotList.Count) { UIListSlot s = Instantiate(slotPrefab, viewTransform).GetComponent <UIListSlot>(); slotList.Add(s); } } UpdateSlot(); }
public override void UpdateSlot() { itemList = Inventory.GetRecipeList(); for (int i = 0; i < slotList.Count; i++) { UIListSlot s = slotList[i]; if (i >= itemList.Count) { s.SetSlot(-1, null, "", ""); ((UIRecipeSlot)s).combinationClickEvent = null; } else { RecipeData item = RecipeDB.Instance.FindItem(itemList[i]); ((UIRecipeSlot)s).combinationClickEvent = OpenDetail; ((UIRecipeSlot)s).SetSlot(i, item.Icon, item.Name, item.Context, item.Combination, item.Price); } } GetComponent <RectTransform>().ForceUpdateRectTransforms(); }