add numbers to inventory

This commit is contained in:
2026-02-19 21:23:30 -06:00
parent 08095945bc
commit 6509a5e78f
2 changed files with 6867 additions and 1976 deletions
+4 -1
View File
@@ -1,3 +1,4 @@
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
@@ -8,8 +9,8 @@ public class ItemSlotUI : MonoBehaviour, IPointerEnterHandler, IPointerExitHandl
// "slot". It is used for serialization and keeping track of the inventory in data.
// ItemSlot simply has an item ID and a quantity. ItemSlotUI is the visual represenation of this.
private ItemSlot slotData;
private int quantity;
private Image image;
private TextMeshProUGUI quantityText;
private Item itemObj;
@@ -20,6 +21,7 @@ public class ItemSlotUI : MonoBehaviour, IPointerEnterHandler, IPointerExitHandl
private void Start()
{
image = GetComponentsInChildren<Image>()[1]; //ignore parent
quantityText = GetComponentInChildren<TextMeshProUGUI>();
}
public void LoadImage(ItemNameUI itemNameUI, ItemDescriptionUI itemDescriptionUI)
@@ -34,6 +36,7 @@ public void LoadImage(ItemNameUI itemNameUI, ItemDescriptionUI itemDescriptionUI
public void SetItem(ItemSlot itemSlot)
{
this.slotData = itemSlot;
this.quantityText.text = slotData.quantity.ToString();
}
public void OnPointerEnter(PointerEventData pointerEventData)