using System.Collections; using System.Collections.Generic; using Sirenix.OdinInspector; using TMPro; using UnityEngine; public class UI_ToolOrMaterialsOrDeviceItem : BaseItem { public ItemInfo itemInfo; public void Init(ItemInfo _itemInfo, int count) { GetControl("CountText").text = count.ToString(); itemInfo = _itemInfo; } protected override void OnClick(string btnName) { base.OnClick(btnName); switch (btnName) { case "ItemCloseBtn": if (GameManager.RunModelMgr.ModeType == E_ModeType.Study) { int count = 0; if (!GameManager.PacksackBagMgr.RemoveOneToolOrMater(itemInfo, ref count)) { itemInfo.selfObj.SetActive(true); Destroy(gameObject); } else { GetControl("CountText").text = count.ToString(); } } break; case "UI_ToolOrMaterialsOrDeviceItem": Debug.Log("ICon"); break; } } [Button] public void TestRemoveOne() { if (GameManager.RunModelMgr.ModeType != E_ModeType.Study) { int count = 0; if (!GameManager.PacksackBagMgr.RemoveOneToolOrMater(itemInfo, ref count)) { itemInfo.selfObj.SetActive(true); Destroy(gameObject); } else { GetControl("CountText").text = count.ToString(); } } } }