using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class DogzItemCell : MonoBehaviour { [SerializeField] CommonItemBaisc itemBaisc; [SerializeField] Text strengthLvTxt; ItemTipsModel tipsModel { get { return ModelCenter.Instance.GetModel(); } } DogzModel dogzModel { get { return ModelCenter.Instance.GetModel(); } } public void Display(int index) { dogzModel.GetDogzItemList(); ItemModel model = null; DebugEx.Log("Display:" + index + "数据长度:" + dogzModel.dogzItemList.Count); if (index < dogzModel.dogzItemList.Count) { model = dogzModel.dogzItemList[index]; } if (model == null) { itemBaisc.gameObject.SetActive(false); strengthLvTxt.gameObject.SetActive(false); return; } DebugEx.Log("model:"+ model.itemId); int strenLv = 0; if (model.GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus) != null) { strenLv = model.GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus)[0]; } if (strenLv > 0) { strengthLvTxt.gameObject.SetActive(true); strengthLvTxt.text = StringUtility.Contact("+", strenLv); } else { strengthLvTxt.gameObject.SetActive(false); } itemBaisc.gameObject.SetActive(true); itemBaisc.Init(model,true); itemBaisc.cellBtn.RemoveAllListeners(); itemBaisc.cellBtn.AddListener(()=> { tipsModel.SetItemTipsModel(model.packType, model.itemInfo.ItemGUID, false, true); tipsModel.SetDogzItemBtn(tipsModel.curAttrData); tipsModel.ShowUICtrl(); }); } } }