public void SetItemButton(Trainer trainer, Item item, BTLUI_ButtonItem button) { button.nameTxt.text = item.data.itemName; button.amountTxt.text = "x" + trainer.GetItemCount(item.itemID); // draw icon string drawPath = "itemSprites/" + item.data.ID; button.icon.sprite = BattleAssetLoader.instance.nullSprite; if (BattleAssetLoader.instance.loadedItemSprites.ContainsKey(drawPath)) { button.icon.sprite = BattleAssetLoader.instance.loadedItemSprites[drawPath]; } else { BattleAssetLoader.instance.LoadItem(item: item, image: button.icon); } button.itemID = item.itemID; button.UnselectSelf(); }
public void HighlightButton(Item item) { BTLUI_ButtonItem selectedBtn = null; scrollLeftBtn.UnselectSelf(); scrollRightBtn.UnselectSelf(); if (bagBtn1.itemID != null) { if (bagBtn1.itemID == item.itemID) { selectedBtn = bagBtn1; scrollLeftBtn.SelectSelf(); } else { bagBtn1.UnselectSelf(); } } if (bagBtn2.itemID != null) { if (bagBtn2.itemID == item.itemID) { selectedBtn = bagBtn2; scrollRightBtn.SelectSelf(); } else { bagBtn2.UnselectSelf(); } } if (bagBtn3.itemID != null) { if (bagBtn3.itemID == item.itemID) { selectedBtn = bagBtn3; scrollLeftBtn.SelectSelf(); } else { bagBtn3.UnselectSelf(); } } if (bagBtn4.itemID != null) { if (bagBtn4.itemID == item.itemID) { selectedBtn = bagBtn4; scrollRightBtn.SelectSelf(); } else { bagBtn4.UnselectSelf(); } } if (selectedBtn != null) { selectedBtn.SelectSelf(); backBtn.UnselectSelf(); promptText.text = "Choose an item."; } }