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<ItemTipsModel>(); } }
|
DogzModel dogzModel { get { return ModelCenter.Instance.GetModel<DogzModel>(); } }
|
|
public void Display(int index)
|
{
|
dogzModel.GetDogzItemList();
|
ItemModel model = null;
|
if(index < dogzModel.dogzItemList.Count)
|
{
|
model = dogzModel.dogzItemList[index];
|
}
|
if(model == null)
|
{
|
itemBaisc.gameObject.SetActive(false);
|
strengthLvTxt.gameObject.SetActive(false);
|
return;
|
}
|
|
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(()=>
|
{
|
ItemAttrData attrData = new ItemAttrData(model.itemId, false, (ulong)model.itemInfo.ItemCount, model.itemInfo.ItemPlace,
|
model.itemInfo.IsBind, false, PackType.rptDogzItem, model.itemInfo.ItemGUID);
|
tipsModel.SetItemTipsModel(attrData);
|
});
|
}
|
}
|
}
|