少年修仙传客户端代码仓库
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
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Monday, March 05, 2018
//--------------------------------------------------------
 
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using vnxbqy.UI;
using System.Linq;
 
public class CSRechargeWin : ILWindow
{
    Text m_RankTxt;
    Text m_PriceALL;
    Text m_ServerRange;
    Image m_PriceIcon;
    Text m_TimeInfo;
    Button Btn_Recharge;
    ScrollerController m_ScrollControl;
    #region Built-in
    protected override void BindController()
    {
        m_RankTxt = proxy.GetWidgtEx<Text>("Txt_Rank");
        m_PriceALL = proxy.GetWidgtEx<Text>("PriceALLTxt");
        m_ServerRange = proxy.GetWidgtEx<Text>("Txt_ServerRange");
        m_PriceIcon = proxy.GetWidgtEx<Image>("PriceIcon");
        Btn_Recharge = proxy.GetWidgtEx<Button>("Btn_Recharge");
        m_TimeInfo = proxy.GetWidgtEx<Text>("Txt_CoolDown");
        m_ScrollControl = proxy.GetWidgtEx<ScrollerController>("RankAwardCtrl");
    }
 
    protected override void AddListeners()
    {
        Btn_Recharge.SetListener(() =>
        {
            WindowJumpMgr.Instance.WindowJumpToEx("VipRechargeWin");
        });
    }
 
    protected override void OnPreOpen()
    {
        CSRechargeModel.Instance.UpdatePlayerBillboardEvent += Display;
        CSRechargeModel.Instance.onRechargeInfoUpdate += Display;
        m_ScrollControl.OnRefreshCell += OnRefreshCell;
        m_ScrollControl.lockType = EnhanceLockType.KeepVertical;
    }
 
    
 
    protected override void OnPreClose()
    {
        CSRechargeModel.Instance.UpdatePlayerBillboardEvent -= Display;
        CSRechargeModel.Instance.onRechargeInfoUpdate -= Display;
        m_ScrollControl.OnRefreshCell -= OnRefreshCell;
    }
 
 
    protected override void OnAfterOpen()
    {
        CSRechargeModel.Instance.SendViewCrossBillboard();
        Display();
        DisplayTime();
    }
 
    protected override void OnAfterClose()
    {
    }
 
 
    #endregion
 
    void Display()
    {
        OperationBase operationBase;
        if (!OperationTimeHepler.Instance.TryGetOperationTime(CSRechargeModel.operationType, out operationBase))
        {
            return;
        }
        OperationCSRecharge operation = operationBase as OperationCSRecharge;
        m_PriceALL.text = Language.Get("CSRechargeMoney", (CSRechargeModel.Instance.playerRecharges / 100.0).ToString("0.##"));
        m_PriceIcon.SetIconWithMoneyType(1);
        m_PriceIcon.SetNativeSize();
 
        UpdateMyRank();
        UpdateServerList();
 
 
        m_ScrollControl.Refresh();
        
        for (var i = 0; i < operation.orderList.Count; i++)
        {
            m_ScrollControl.AddCell(ScrollerDataType.Header, i);
        }
        int BiliBoardCount = operation.orderList.Count;
        var recharges = operation.drlcInfoDict.Keys.ToList();
        for (var i = 0; i < recharges.Count; i++)
        {
            m_ScrollControl.AddCell(ScrollerDataType.Header, BiliBoardCount + i);
        }
        
        m_ScrollControl.Restart();
    }
 
    void UpdateMyRank()
    {
        if (CSRechargeModel.Instance.RankIndex <= 0)
        {
            m_RankTxt.text = Language.Get("CSRechargeRankNo");
        }
        else
        {
            m_RankTxt.text = Language.Get("CSRechargeRank", CSRechargeModel.Instance.RankIndex);
        }
    }
    void UpdateServerList()
    {
        if(CSRechargeModel.Instance.serverTypeList.Count <=0)
        {
            m_ServerRange.text = StringUtility.Contact(Language.Get("CSRechargeServerTip"), Language.Get("CSRechargeServerAll"));
        }
        else
        {
            string serverInfo = Language.Get("CSRechargeServerTip");
            for(int i=0;i < CSRechargeModel.Instance.serverTypeList.Count;i++ )
            {
                var data = CSRechargeModel.Instance.serverTypeList[i];
                serverInfo += Language.Get("CSRechargeServer", data.server1, data.server2);
                if ( i != CSRechargeModel.Instance.serverTypeList.Count -1)
                {
                    serverInfo += ", ";
                }
            }
            m_ServerRange.text = serverInfo;
        }
    }
 
    private void OnRefreshCell(ScrollerDataType type, CellView cell)
    {
        var Record = cell.GetILBehaviour<CSRechargeCell>();
        if (Record != null)
            Record.Display(cell.index);     
    }        
 
    private void DisplayTime()
    {
        OperationBase operationBase;
        if (OperationTimeHepler.Instance.TryGetOperationTime(CSRechargeModel.operationType, out operationBase))
        {
            OperationCSRecharge operation = operationBase as OperationCSRecharge;
            m_TimeInfo.text = StringUtility.Contact(Language.Get("ExpActivity_Text1"), operation.ToDisplayTime());
        }
    }
 
}