少年修仙传客户端代码仓库
client_Zxw
2018-09-19 ab3e936c7be0fdcc6c814cc0cb0e4c88a0f346eb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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;
            }
            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();
            });
        }
    }
}