using cfg.ActorCfg; using Framework; using Gameplay; using System; using TMPro; using UnityEngine; using UnityEngine.UI; using static ItemObj; public class ItemNode : UINode { GameObject _parentGo; Action _action;//用来做点击事件 int _Id; DataItem Cfg; Button clickBtn; UIType _type; int count = 0; public void Refresh(int itemId, UIType uIType, int itemCount = 0)//美术出图前暂用 { InitData(itemId, itemCount); _type = uIType; RefreshDetail(); } private void InitData(int itemId, int itemCount) { _Id = itemId; count = itemCount; Cfg = TableManager.GetSingleton().Tables.Item.GetOrDefault(itemId); if (Cfg == null) { DebugUtil.LogError("物品表没有配置id为{0}的物品,请检查配置", itemId); } } private void RefreshDetail() { CommonUtils.GetGameObject(this.gameObject, "test2").SetActive(_type==UIType.mail); CommonUtils.GetGameObject(this.gameObject, "test1").SetActive(_type == UIType.cultivate); CommonUtils.GetGameObject(this.gameObject, "test3").SetActive(_type == UIType.shop); CommonUtils.GetComponent(this.gameObject, "test2/icon/Text_StuffNum").text = count.ToString(); ; CommonUtils.GetComponent(this.gameObject, "test2/icon/Text_StuffNum").text = count.ToString(); ; CommonUtils.GetComponent(this.gameObject, "test3/Image_Bar/Text_ItemNum").text = count.ToString(); CommonUtils.GetGameObject(this.gameObject, "DebugID").SetActive(DisplayIDForCeHua.IsDisplayID); CommonUtils.GetComponent(this.gameObject, "DebugID").text = _Id.ToString(); } }