Unity_Learn/Assets/Scripts/UI/SubItem/UI_Inven_Item.cs

36 lines
810 B
C#

using TMPro;
using UnityEngine;
public class UI_Inven_Item : UI_Base
{
enum GameObjects
{
Item_Icon,
Item_Name_Text,
}
string _itemName = "Test Item";
void Start()
{
Init();
}
public override void Init()
{
Bind<GameObject>(typeof(GameObjects));
Get<GameObject>((int)GameObjects.Item_Name_Text).GetComponent<TextMeshProUGUI>().text = _itemName;
Get<GameObject>((int)GameObjects.Item_Icon).BindUIEvent((PointerEventData) => { Debug.Log($"Item {_itemName} Click"); });
}
public void SetInfo(string itemName)
{
_itemName = itemName;
// Get<GameObject>((int)GameObjects.Item_Name_Text).GetComponent<TextMeshProUGUI>().text = itemName;
}
void Update()
{
}
}