private void RefreshPanel() { foreach (ItemSlot slot in slots) { slot.Hide(); } if (current_category == null) { return; } //Show all items of a category List <CraftData> items = CraftData.GetAllCraftableInGroup(current_category); for (int i = 0; i < items.Count; i++) { if (i < slots.Length) { CraftData item = items[i]; ItemSlot slot = slots[i]; slot.SetSlot(item, 1, false); slot.AnimateGain(); } } }
private void RefreshPanel() { slot.SetSlot(data, 1, true); slot.AnimateGain(); title.text = data.title; desc.text = data.desc; foreach (ItemSlot slot in craft_slots) { slot.Hide(); } CraftCostData cost = data.GetCraftCost(); int index = 0; foreach (KeyValuePair <ItemData, int> pair in cost.craft_items) { if (index < craft_slots.Length) { ItemSlot slot = craft_slots[index]; slot.SetSlot(pair.Key, pair.Value, false); slot.ShowTitle(); } index++; } if (index < craft_slots.Length) { ItemSlot slot = craft_slots[index]; if (cost.craft_near != null) { slot.SetSlotCustom(cost.craft_near.icon, cost.craft_near.title, false); slot.ShowTitle(); } } PlayerCharacter player = PlayerCharacter.Get(); craft_btn.interactable = player.CanCraft(data); }