using System.Collections; using System.Collections.Generic; using Sirenix.OdinInspector; using TMPro; using UnityEngine; using UnityEngine.UI; public class UI_ToolOrMaterialsOrDeviceItem : BaseItem { public List itemInfo; public Button itemCloseBtn; public void Init(List _itemInfo) { if (GameManager.RunModelMgr.ModeType == E_ModeType.Study) { itemCloseBtn.gameObject.SetActive(false); } GetControl("CountText").text = _itemInfo.Count.ToString(); itemInfo = _itemInfo; } protected override void OnClick(string btnName) { base.OnClick(btnName); switch (btnName) { case "ItemCloseBtn": int counts = 0; ; if (itemInfo.Count > 1) { counts = itemInfo.Count - 1; } GameObject obj = Instantiate(itemInfo[counts].objPrefab); obj.transform.position = itemInfo[counts].selfPosInToolRoom; obj.name = itemInfo[counts].toolName; obj.GetComponent().itemInfo = itemInfo[counts]; GameManager.PacksackBagMgr.RemoveOneToolOrMater(itemInfo[counts]); itemInfo.Remove(itemInfo[counts]); GetControl("CountText").text = itemInfo.Count.ToString(); if (itemInfo.Count == 0) Destroy(gameObject); break; case "UI_ToolOrMaterialsOrDeviceItem": Debug.Log("ICon"); break; } } }