JinChanChan/Assets/Scripts/BeiBao/View/BeiBaoItem.cs

28 lines
645 B
C#
Raw Normal View History

using UnityEngine;
using UnityEngine.UI;
namespace BeiBao.View
{
public class BeiBaoItem : MonoBehaviour
{
public Text NameText;
public Text CountText;
InventorySlot inventorySlot;
public void Refresh(InventorySlot slot)
{
inventorySlot = slot;
if (!inventorySlot.IsEmpty)
{
NameText.text = inventorySlot.Item.ItemName;
CountText.text = inventorySlot.Item.Quantity.ToString();
}
else
{
NameText.text = "";
CountText.text = "";
}
}
}
}