少年修仙传客户端代码仓库
hch
4 天以前 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
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Monday, January 28, 2019
//--------------------------------------------------------
 
using System;
using UnityEngine;
using UnityEngine.UI;
using vnxbqy.UI;
using System.Collections.Generic;
 
public class CrossServerQualifyingWin : ILWindow
{
    Button close;
    Button war64Button;
    Button war8Button;
    Button hallOfFame;
    Button officialPosition;
    Button storeBtn;
    List<Image> selectImgs = new List<Image>();
    TextEx timeInfo;
 
    List<string> windowNames = new List<string>() { "CrossServerQualifying64Win", "CrossServerQualifying8Win",
                                                    "CrossServerQualifyingHallOfFameWin", "CrossServerQualifyingOfficialWin"};
    #region Built-in
    protected override void BindController()
    {
        close = proxy.GetWidgtEx<Button>("Button_Close");
        war64Button = proxy.GetWidgtEx<Button>("war64Button");
        war8Button = proxy.GetWidgtEx<Button>("war8Button");
        hallOfFame = proxy.GetWidgtEx<Button>("hallOfFame");
        officialPosition = proxy.GetWidgtEx<Button>("officialPosition");
 
        for (int i = 0; i < 4; i++)
        { 
            selectImgs.Add(proxy.GetWidgtEx<Image>("select" + i));
        }
        storeBtn = proxy.GetWidgtEx<Button>("ShoppingBtn");
        timeInfo = proxy.GetWidgtEx<TextEx>("timeinfo");
    }
 
    protected override void AddListeners()
    {
        close.SetListener(()=> {
            WindowCenter.Instance.CloseIL<CrossServerQualifyingWin>();
        });
 
        war64Button.SetListener(OpenWar64);
        war8Button.SetListener(OpenWar8);
        officialPosition.SetListener(OpenOfficial);
        hallOfFame.SetListener(OpenHallOfFame);
        storeBtn.SetListener(()=> {
            ModelCenter.Instance.GetModel<StoreModel>().OpenStoreWin(false, 5);
        });
    }
 
    protected override void OnPreOpen()
    {
        GlobalTimeEvent.Instance.secondEvent += OnSecondEvent;
        //根据赛程显示,红点不影响
        var groupMark = CrossServerQualifyingModel.Instance.nowGroupMark;
        if (groupMark == 0)
        {
            //膜拜
            CrossServerQualifyingModel.Instance.selectIndex = 1;
        }
        else if (groupMark <= 64 && groupMark >= 16)
        {
            //64强,需引导投注
            CrossServerQualifyingModel.Instance.selectIndex = 0;
        }
        else if (groupMark <= 8)
        {
            CrossServerQualifyingModel.Instance.selectIndex = 1;
        }
        OnSelectEvent();
        CrossServerQualifyingModel.Instance.QueryAllKaiKingInfo();
        CrossServerQualifyingModel.Instance.loginRedpoint.state = RedPointState.None;
    }
 
    protected override void OnPreClose()
    {
        GlobalTimeEvent.Instance.secondEvent -= OnSecondEvent;
        for (int i = 0; i < windowNames.Count; i++)
        { 
            WindowCenter.Instance.Close(windowNames[i]);
        }
    }
 
    #endregion
 
 
    void OpenWar64()
    {
        CrossServerQualifyingModel.Instance.selectIndex = 0;
        OnSelectEvent();
    }
 
    void OpenWar8()
    {
        CrossServerQualifyingModel.Instance.selectIndex = 1;
        OnSelectEvent();
    }
    void OpenHallOfFame()
    {
        CrossServerQualifyingModel.Instance.selectIndex = 2;
        OnSelectEvent();
    }
 
    void OpenOfficial()
    {
        CrossServerQualifyingModel.Instance.selectIndex = 3;
        OnSelectEvent();
    }
 
 
    void OnSelectEvent()
    {
        
        for (int i = 0; i < selectImgs.Count; i++)
        {
            if (i == CrossServerQualifyingModel.Instance.selectIndex)
            {
                selectImgs[i].SetActiveIL(true);
                WindowCenter.Instance.Open(windowNames[i]);
            }
            else
            {
                selectImgs[i].SetActiveIL(false);
                WindowCenter.Instance.Close(windowNames[i]);
            }
            
        }
    }
 
    void OnSecondEvent()
    {
        timeInfo.text = StringUtility.Contact(ILTimeUtility.ServerCrossNow.ToString("yyyy-MM-dd HH:mm:ss"), " ", CrossServerQualifyingModel.Instance.GetBattleID());
    }
 
}