This commit is contained in:
d-hain 2022-06-03 00:07:30 +02:00
parent 98b571c2aa
commit f7b593045f
9 changed files with 49 additions and 132 deletions

View file

@ -6,12 +6,12 @@ public class ShopUI : MonoBehaviour {
public GameObject shopUI;
private Shop _shop;
private ShopSlot[] _slots;
private void Start() {
// Get Shop instance and add UpdateUI method to OnItemChanged delegate
_shop = Shop.instance;
_shop.onItemChangedCallback += UpdateUI;
// Add all ShopSlot GameObjects to _slots and turn off the Shop UI
_slots = itemsParent.GetComponentsInChildren<ShopSlot>();
ToggleShop();
@ -45,7 +45,7 @@ public class ShopUI : MonoBehaviour {
if(i < _shop.items.Count) {
_slots[i].AddItem(_shop.items.ElementAt(i).Key);
_slots[i].nameText.text = _slots[i].Item.displayName;
_slots[i].costText.text = _slots[i].Item.cost + " ";
_slots[i].costText.text = _slots[i].Item.cost + " µ";
_slots[i].amountText.text = _shop.items[_shop.items.ElementAt(i).Key] + " #";
} else {
_slots[i].ClearSlot();