少年修仙传客户端代码仓库
lcy
2024-12-16 a39c35fc6449430cd02bccb681c4a0a880e46cd9
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
57
58
59
60
61
using LitJson;
using vnxbqy.UI;
using System.Collections.Generic;
using UnityEngine.UI;
 
public class FuncPrivilegeAwardCell : ILBehaviour
{
    List<ItemCell> itemList = new List<ItemCell>();
    Button GetButton;
    Image state;
    Text content;
 
    FuncSysPrivilegeModel model = FuncSysPrivilegeModel.Instance;
 
    protected override void Awake() 
    {
        content = proxy.GetWidgtEx<Text>("getinfo");
        state = proxy.GetWidgtEx<Image>("Image");
        GetButton = proxy.GetWidgtEx<Button>("getaward");
        itemList.Add(proxy.GetWidgtEx<ItemCell>("item1"));
        itemList.Add(proxy.GetWidgtEx<ItemCell>("item2"));
        itemList.Add(proxy.GetWidgtEx<ItemCell>("item3"));
    }
 
    public void Display(int index)
    {
        content.text = Language.Get("FuncPrivilegeDay" + (index + 1));
        var getState = model.GetStateByPrivilegeID(model.selectType, index + 1);
        state.SetActiveIL(getState == 2);
        GetButton.SetActiveIL(getState == 1 || getState == 3);
        GetButton.SetColorful(null, getState == 1 ? true : false);
        GetButton.SetListener(()=> {
            IL_CB212_tagCMGetFuncSysPrivilegeAward pack = new IL_CB212_tagCMGetFuncSysPrivilegeAward();
            pack.FuncSysID = (byte)model.selectType;
            pack.DayNum = (byte)(index + 1);
            GameNetSystem.Instance.SendInfo(pack);
        });
        var awards = JsonMapper.ToObject<int[][]>(model.PrivilegeIDItems[model.selectType][index]);
        for (int i = 0; i < itemList.Count; i++)
        {
            if (i < awards.Length)
            {
                itemList[i].SetActiveIL(true);
                var itemId = awards[i][0];
                var model = new ItemCellModel(itemId, false, (ulong)awards[i][1]);
                itemList[i].Init(model);
                itemList[i].auctionIcon.SetActiveIL(awards[i][2] != 0);
                itemList[i].button.SetListener(() =>
                {
                    ItemTipUtility.Show(itemId);
                });
            }
            else
            {
                itemList[i].SetActiveIL(false);
            }
        }
    }
 
 
}