add numbers to inventory
This commit is contained in:
+6863
-1975
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,4 @@
|
|||||||
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
using UnityEngine.UI;
|
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.
|
// "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.
|
// ItemSlot simply has an item ID and a quantity. ItemSlotUI is the visual represenation of this.
|
||||||
private ItemSlot slotData;
|
private ItemSlot slotData;
|
||||||
private int quantity;
|
|
||||||
private Image image;
|
private Image image;
|
||||||
|
private TextMeshProUGUI quantityText;
|
||||||
|
|
||||||
private Item itemObj;
|
private Item itemObj;
|
||||||
|
|
||||||
@@ -20,6 +21,7 @@ public class ItemSlotUI : MonoBehaviour, IPointerEnterHandler, IPointerExitHandl
|
|||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
image = GetComponentsInChildren<Image>()[1]; //ignore parent
|
image = GetComponentsInChildren<Image>()[1]; //ignore parent
|
||||||
|
quantityText = GetComponentInChildren<TextMeshProUGUI>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadImage(ItemNameUI itemNameUI, ItemDescriptionUI itemDescriptionUI)
|
public void LoadImage(ItemNameUI itemNameUI, ItemDescriptionUI itemDescriptionUI)
|
||||||
@@ -34,6 +36,7 @@ public void LoadImage(ItemNameUI itemNameUI, ItemDescriptionUI itemDescriptionUI
|
|||||||
public void SetItem(ItemSlot itemSlot)
|
public void SetItem(ItemSlot itemSlot)
|
||||||
{
|
{
|
||||||
this.slotData = itemSlot;
|
this.slotData = itemSlot;
|
||||||
|
this.quantityText.text = slotData.quantity.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnPointerEnter(PointerEventData pointerEventData)
|
public void OnPointerEnter(PointerEventData pointerEventData)
|
||||||
|
|||||||
Reference in New Issue
Block a user