少年修仙传客户端代码仓库
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
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Tuesday, June 11, 2019
//--------------------------------------------------------
 
using vnxbqy.UI;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
 
 
 
public class OnlineRechargeWin : ILWindow
{
 
    Button m_Close;
    List<ItemCell> awardList = new List<ItemCell>();
    Image state;
    Button Btn_Get;
    List<ItemCell> buyList1000 = new List<ItemCell>();
    List<ItemCell> buyList30 = new List<ItemCell>();
    Button buy1000;
    Button buy30;
 
    Button CloseBtn2;
    Button NoWaitBtn;
    Text NoWaitText1;
    Text NoWaitText2;
    Transform SecondBG;
    Transform AwardList;
    Text Price648;
    Text Price30;
 
    VipModel vipModel { get { return ModelCenter.Instance.GetModelEx<VipModel>(); } }
 
    #region Built-in
    protected override void BindController()
    {
        m_Close = proxy.GetWidgtEx<Button>("CloseButton");
        awardList.Add(proxy.GetWidgtEx<ItemCell>("award0"));
        awardList.Add(proxy.GetWidgtEx<ItemCell>("award1"));
        awardList.Add(proxy.GetWidgtEx<ItemCell>("award2"));
        awardList.Add(proxy.GetWidgtEx<ItemCell>("award3"));
        awardList.Add(proxy.GetWidgtEx<ItemCell>("award4"));
        state = proxy.GetWidgtEx<Image>("Img_State");
        Btn_Get = proxy.GetWidgtEx<Button>("Btn_Get");
        buyList1000.Add(proxy.GetWidgtEx<ItemCell>("item1_1000"));
        buyList1000.Add(proxy.GetWidgtEx<ItemCell>("item2_1000"));
        buyList30.Add(proxy.GetWidgtEx<ItemCell>("item1_30"));
        buyList30.Add(proxy.GetWidgtEx<ItemCell>("item2_30"));
        buy1000 = proxy.GetWidgtEx<Button>("buy1000");
        buy30 = proxy.GetWidgtEx<Button>("buy30");
 
        CloseBtn2 = proxy.GetWidgtEx<Button>("CloseButton2");
        NoWaitBtn = proxy.GetWidgtEx<Button>("nowait");
        NoWaitText1 = proxy.GetWidgtEx<Text>("nowaitText1");
        NoWaitText2 = proxy.GetWidgtEx<Text>("nowaitText2");
        SecondBG = proxy.GetWidgtEx<Transform>("SecondBG");
        AwardList = proxy.GetWidgtEx<Transform>("awardList");
        Price648 = proxy.GetWidgtEx<Text>("TextEx648");
        Price30 = proxy.GetWidgtEx<Text>("TextEx30");
 
    }
 
    protected override void AddListeners()
    {
        m_Close.SetListener(()=> {
            CloseWin<OnlineRechargeWin>();
        });
        Btn_Get.SetListener(()=> {
            OnlineRechargeModel.Instance.GetAward();
        });
 
        buy1000.SetListener(()=> {
            vipModel.CTG(OnlineRechargeModel.Instance.ctgArray[0]);
        });
 
        buy30.SetListener(() => {
            vipModel.CTG(OnlineRechargeModel.Instance.ctgArray[1]);
        });
 
        NoWaitBtn.SetListener(()=> {
            SecondBG.SetActiveIL(true);
            AwardList.SetActiveIL(false);
        });
 
        CloseBtn2.SetListener(() => {
            SecondBG.SetActiveIL(false);
            AwardList.SetActiveIL(true);
        });
    }
 
    protected override void OnPreOpen()
    {
        OnlineRechargeModel.Instance.updateEvent += Display;
        Display();
        OnlineRechargeModel.Instance.openyet = true;
        OnlineRechargeModel.Instance.UpdateRedpoint();
        if (IL_DTCA109_tagMCOnLineTimeTotal.onlineSeconds >= OnlineRechargeModel.Instance.changeSeconds)
        {
            LocalSave.SetBool(StringUtility.Contact(PlayerDatas.Instance.PlayerId, "zxth15"), true);
        }
        SecondBG.SetActiveIL(false);
        AwardList.SetActiveIL(true);
    }
 
    protected override void OnAfterOpen()
    {
        //OnPreOpen处理 第一次打开是亮的 此处重复调用一次
        DisplayButton();
    }
    protected override void OnPreClose()
    {
        OnlineRechargeModel.Instance.updateEvent -= Display;
    }
    #endregion
 
    void Display()
    {
        for (int i = 0; i < awardList.Count; i++)
        {
            if (i < OnlineRechargeModel.Instance.awards.Length)
            {
                awardList[i].SetActiveIL(true);
                var itemId = OnlineRechargeModel.Instance.awards[i][0];
                var model = new ItemCellModel(itemId, false, (ulong)OnlineRechargeModel.Instance.awards[i][1]);
                awardList[i].Init(model);
                awardList[i].auctionIcon.SetActiveIL(OnlineRechargeModel.Instance.awards[i][2] != 0);
                awardList[i].button.SetListener(() =>
                {
                    ItemTipUtility.Show(itemId);
                });
            }
            else
            {
                awardList[i].SetActiveIL(false);
            }
        }
 
        state.SetActiveIL(OnlineRechargeModel.Instance.state == 1);
        //Btn_Get.SetActiveIL(OnlineRechargeModel.Instance.state == 0);
        //Btn_Get.SetColorful(null, false);
 
        List<Item> awards;
        vipModel.TryGetRechargeItem(OnlineRechargeModel.Instance.ctgArray[0], out awards);
        for (int i = 0; i < buyList1000.Count; i++)
        {
            if (i < awards.Count)
            {
                buyList1000[i].SetActiveIL(true);
                var itemId = awards[i].id;
                var model = new ItemCellModel(itemId, false, (ulong)awards[i].count);
                buyList1000[i].Init(model);
                buyList1000[i].auctionIcon.SetActiveIL(awards[i].bind != 0);
                buyList1000[i].button.SetListener(() =>
                {
                    ItemTipUtility.Show(itemId);
                });
            }
            else
            {
                buyList1000[i].SetActiveIL(false);
            }
        }
 
        vipModel.TryGetRechargeItem(OnlineRechargeModel.Instance.ctgArray[1], out awards);
        for (int i = 0; i < buyList30.Count; i++)
        {
            if (i < awards.Count)
            {
                buyList30[i].SetActiveIL(true);
                var itemId = awards[i].id;
                var model = new ItemCellModel(itemId, false, (ulong)awards[i].count);
                buyList30[i].Init(model);
                buyList30[i].auctionIcon.SetActiveIL(awards[i].bind != 0);
                buyList30[i].button.SetListener(() =>
                {
                    ItemTipUtility.Show(itemId);
                });
            }
            else
            {
                buyList30[i].SetActiveIL(false);
            }
        }
 
        if (IL_DTCA109_tagMCOnLineTimeTotal.onlineSeconds < OnlineRechargeModel.Instance.changeSeconds)
        {
            buy1000.SetColorful(null, true);
            buy1000.interactable = true;
            buy30.SetColorful(null, false);
            buy30.interactable = false;
            NoWaitText1.SetActiveIL(true);
            NoWaitText2.SetActiveIL(false);
        }
        else
        {
            buy1000.SetColorful(null, false);
            buy1000.interactable = false;
            buy30.SetColorful(null, true);
            buy30.interactable = true;
            NoWaitText1.SetActiveIL(false);
            NoWaitText2.SetActiveIL(true);
 
        }
        OrderInfoConfig config;
        vipModel.TryGetOrderInfo(OnlineRechargeModel.Instance.ctgArray[1], out config);
        NoWaitText2.text = Language.Get("PriceBuy", UIHelper.GetMoneyFormat((int)config.PayRMBNum));
        Price30.text = Language.Get("PriceBuy", UIHelper.GetMoneyFormat((int)config.PayRMBNum));
 
        vipModel.TryGetOrderInfo(OnlineRechargeModel.Instance.ctgArray[0], out config);
        Price648.text = Language.Get("PriceBuy", UIHelper.GetMoneyFormat((int)config.PayRMBNum));
        DisplayButton();
    }
 
    void DisplayButton()
    {
        int buycnt = 0;
        VipModel.RechargeCount rechargeCount;
        if (vipModel.TryGetRechargeCount(OnlineRechargeModel.Instance.ctgArray[0], out rechargeCount))
        {
            buy1000.SetActiveIL(rechargeCount.totalCount == 0);
            if (rechargeCount.totalCount > 0)
            {
                buycnt++;
            }
        }
        if (vipModel.TryGetRechargeCount(OnlineRechargeModel.Instance.ctgArray[1], out rechargeCount))
        {
            buy30.SetActiveIL(rechargeCount.totalCount == 0);
            if (rechargeCount.totalCount > 0)
            {
                buycnt++;
            }
        }
        //Btn_Get.SetColorful(null, buycnt > 0);
        Btn_Get.SetActiveIL(OnlineRechargeModel.Instance.state == 0 && buycnt > 0);
        NoWaitBtn.SetActiveIL(buycnt == 0);
        
    }
}