少年修仙传客户端代码仓库
hch
3 天以前 600733c8f592cb9e65f2b7a3e110ac1d686e6bfe
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
using LitJson;
using vnxbqy.UI;
using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
using UnityEngine.UI;
 
/// <summary>
/// 每日特惠
/// </summary>
public class DailySpecialsWin : ILWindow
{
    public List<ButtonEx> btnBuyList = new List<ButtonEx>();
    public List<ButtonEx> btnHaveList = new List<ButtonEx>();
    public ButtonEx btnAllBuy;
    public ButtonEx btnClose;
    public List<TextEx> txtBuyList = new List<TextEx>();
    public List<TextEx> txtHaveList = new List<TextEx>();
    public TextEx txtAllBuy;
    public TextEx txtRemaindays;
    public List<ImageEx> imgBuyList = new List<ImageEx>();
    public List<ImageEx> imgHaveList = new List<ImageEx>();
    public ImageEx imgAllBuy;
    public List<List<ItemCell>> showLineList = new List<List<ItemCell>>();
 
    TextEx orgAllPrice;
    public List<TextEx> orgPriceList = new List<TextEx>();
 
    VipModel vipModel { get { return ModelCenter.Instance.GetModelEx<VipModel>(); } }
    protected override void BindController()
    {
        btnAllBuy = proxy.GetWidgtEx<ButtonEx>("btnAllBuy");
        btnClose = proxy.GetWidgtEx<ButtonEx>("btnBack");
        txtAllBuy = proxy.GetWidgtEx<TextEx>("txtAllBuy");
        txtRemaindays = proxy.GetWidgtEx<TextEx>("txtRemaindays");
        imgAllBuy = proxy.GetWidgtEx<ImageEx>("imgAllBuy");
 
        for (int i = 0; i < 4; i++)
        {
            btnBuyList.Add(proxy.GetWidgtEx<ButtonEx>("btnBuy" + i));
            btnHaveList.Add(proxy.GetWidgtEx<ButtonEx>("btnHave" + i));
            txtBuyList.Add(proxy.GetWidgtEx<TextEx>("txtBuy" + i));
            txtHaveList.Add(proxy.GetWidgtEx<TextEx>("txtHave" + i));
            imgBuyList.Add(proxy.GetWidgtEx<ImageEx>("imgBuy" + i));
            imgHaveList.Add(proxy.GetWidgtEx<ImageEx>("imgHave" + i));
 
            if (i == 0)
            {
                orgPriceList.Add(null);
            }
            else
            {
                var obj1 = btnBuyList[i].FindComponent("Text", "Txt_orgPrice");
                if (obj1 != null)
                    orgPriceList.Add(obj1 as TextEx);
            }
        }
 
        for (int i = 0, count = 0; i < 4; i++)
        {
            List<ItemCell> showItemImgList = new List<ItemCell>();
            for (int j = 0; j < 3; j++)
            {
                showItemImgList.Add(proxy.GetWidgtEx<ItemCell>("itemchild" + count));
                count++;
            }
            showLineList.Add(showItemImgList);
        }
 
        var obj = btnAllBuy.FindComponent("Text", "Txt_orgPrice");
        if (obj != null)
            orgAllPrice = obj as TextEx;
    }
 
    protected override void AddListeners()
    {
        btnAllBuy.SetListener(() =>
        {
            vipModel.CTG(DailySpecialsModel.Instance.packRechargeIdList[0]);
        });
 
        btnClose.SetListener(() =>
        {
            CloseWin<DailySpecialsWin>();
        });
    }
 
    protected override void OnPreOpen()
    {
 
        DailySpecialsModel.Instance.UpdateGiftStateEvent += UpdateGiftStateEvent;
        Display();
 
    }
 
    protected override void OnAfterOpen()
    {
 
    }
 
    protected override void OnPreClose()
    {
        DailySpecialsModel.Instance.UpdateGiftStateEvent -= UpdateGiftStateEvent;
    }
 
 
    void UpdateGiftStateEvent()
    {
        Display();
    }
 
 
    void Display()
    {
        //显示物品图标
        for (int i = 0; i < showLineList.Count; i++)
        {
            for (int j = 0; j < showLineList[i].Count; j++)
            {
                if (j < DailySpecialsModel.Instance.itemAllList[i].Count)
                {
                    showLineList[i][j].SetActiveIL(true);
                    var itemId = DailySpecialsModel.Instance.itemAllList[i][j].id;
                    var model = new ItemCellModel(itemId, false, (ulong)DailySpecialsModel.Instance.itemAllList[i][j].count);
                    showLineList[i][j].Init(model);
                    showLineList[i][j].button.SetListener(() =>
                    {
                        ItemTipUtility.Show(itemId);
                    });
                }
                else
                {
                    showLineList[i][j].SetActiveIL(false);
                }
 
            }
        }
        //打包相关
        bool isBuyAllPack = DailySpecialsModel.Instance.IsBuyAllPack();
        btnAllBuy.SetActiveIL(isBuyAllPack ? false : true);
        txtAllBuy.SetActiveIL(isBuyAllPack ? false : true);
        txtRemaindays.SetActiveIL(isBuyAllPack);
 
        OrderInfoConfig orderCfg;
        vipModel.TryGetOrderInfo(DailySpecialsModel.Instance.packRechargeIdList[0], out orderCfg);
        txtAllBuy.text = Language.Get("winfix15", orderCfg.PayRMBNum, DailySpecialsModel.Instance.maxDay);
        txtRemaindays.text = Language.Get("TheRemainingNumberDays_Z", DailySpecialsModel.Instance.maxDay - (TimeUtility.ServerNow.Date - TimeUtility.GetTime(DailySpecialsModel.Instance.PackBuyTime).Date).Days);
        if (orgAllPrice != null)
        {
            orgAllPrice.SetActiveIL(PlayerDatas.Instance.baseData.IsActive90Off);
            orgAllPrice.text = Language.Get("PayMoneyNum", UIHelper.GetMoneyFormat(orderCfg.m_PayRMBNum));
        }
 
 
        //分支礼包相关
        for (int i = 0; i < 4; i++)
        {
            int index = i;
            var state = DailySpecialsModel.Instance.GetGiftState(i);
            int ctgID = -1;
 
            btnBuyList[i].SetActiveIL(state == 0);
            txtBuyList[i].SetActiveIL(state == 0);
            imgBuyList[i].SetActiveIL(state == 1);
            btnHaveList[i].SetActiveIL(state == 2);
            txtHaveList[i].SetActiveIL(state == 2);
            imgHaveList[i].SetActiveIL(state == 3);
 
            if (i == 0)
            {
                txtBuyList[i].text = Language.Get("AloneFree");
                txtHaveList[i].text = Language.Get("AloneFree");
            }
            else
            {
                ctgID = DailySpecialsModel.Instance.ctgIdDict[i][0];
                vipModel.TryGetOrderInfo(ctgID, out orderCfg);
                txtBuyList[i].text = Language.Get("NeedMoney", orderCfg.PayRMBNum);
                txtHaveList[i].text = Language.Get("RealmPractice109");
                if (orgPriceList[i] != null)
                {
                    orgPriceList[i].SetActiveIL(PlayerDatas.Instance.baseData.IsActive90Off);
                    orgPriceList[i].text = Language.Get("PayMoneyNum", UIHelper.GetMoneyFormat(orderCfg.m_PayRMBNum));
                }
            }
 
            btnBuyList[i].SetListener(() =>
            {
                if (ctgID == -1) return;
                vipModel.CTG(ctgID);
            });
 
            btnHaveList[i].SetListener(() =>
            {
                var pak = new IL_CA504_tagCMPlayerGetReward();
                pak.RewardType = 64;
                pak.DataEx = (uint)index;
                GameNetSystem.Instance.SendInfo(pak);
 
            });
        }
 
    }
}