少年修仙传客户端代码仓库
client_Wu Xijin
2018-10-22 ec36f7122391b3e5d46838e67f64a2d54714626e
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 System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace Snxxz.UI
{
    [XLua.LuaCallCSharp]
    public class OpenServerActivityNotifyModel : Model,IBeforePlayerDataInitialize,IPlayerLoginOk
    {
      
        public override void Init()
        {
          
        }
 
        public void OnBeforePlayerDataInitialize()
        {
            FlashRushToBuyActivityClose();
            GlobalTimeEvent.Instance.minuteEvent -= UpdateMinute;
            OperationTimeHepler.Instance.operationStartEvent -= OperationStartEvent;
            OperationTimeHepler.Instance.operationEndEvent -= OperationEndEvent;
            OperationTimeHepler.Instance.operationTimeUpdateEvent -= OperationTimeEvent;
            OperationTimeHepler.Instance.operationServerCloseEvent -= OperationServerCloseEvent;
            NewBieCenter.Instance.guideCompletedEvent -= GuideCompletedEvent;
        }
 
        public void OnPlayerLoginOk()
        {
            OperationTimeHepler.Instance.operationStartEvent += OperationStartEvent;
            OperationTimeHepler.Instance.operationEndEvent += OperationEndEvent;
            OperationTimeHepler.Instance.operationTimeUpdateEvent += OperationTimeEvent;
            OperationTimeHepler.Instance.operationServerCloseEvent += OperationServerCloseEvent;
            NewBieCenter.Instance.guideCompletedEvent += GuideCompletedEvent;
            GlobalTimeEvent.Instance.minuteEvent += UpdateMinute;
            SetFlashRushToBuyNotify();
            if (!WindowCenter.Instance.IsOpen<OpenServerActivityNotifyWin>())
            {
                WindowCenter.Instance.Open<OpenServerActivityNotifyWin>();
            }
        }
 
        public override void UnInit()
        {
          
        }
 
        private void UpdateMinute()
        {
            SetFlashRushToBuyNotify();
        }
 
        private void OperationTimeEvent(Operation type)
        {
            switch (type)
            {
                case Operation.MultipleExp:
                    break;
                case Operation.ConsumeRebate:
                    break;
                case Operation.FlashSale:
                    break;
                case Operation.BossReborn:
                    break;
                case Operation.GiftPackage:
                    break;
                case Operation.FairyCeremony:
                    break;
                case Operation.MultipRealmPoint:
                    break;
                case Operation.FlashRushToBuy:
                    SetFlashRushToBuyNotify();
                    break;
                case Operation.max:
                    break;
            }
        }
 
        private void OperationStartEvent(Operation type, int state)
        {
            switch (type)
            {
                case Operation.MultipleExp:
                    break;
                case Operation.ConsumeRebate:
                    break;
                case Operation.FlashSale:
                    break;
                case Operation.BossReborn:
                    break;
                case Operation.GiftPackage:
                    break;
                case Operation.FairyCeremony:
                    break;
                case Operation.MultipRealmPoint:
                    break;
                case Operation.FlashRushToBuy:
                    SetFlashRushToBuyNotify();
                    break;
                case Operation.max:
                    break;
            }
        }
 
 
        private void OperationServerCloseEvent(Operation type)
        {
            switch (type)
            {
                case Operation.MultipleExp:
                    break;
                case Operation.ConsumeRebate:
                    break;
                case Operation.FlashSale:
                    break;
                case Operation.BossReborn:
                    break;
                case Operation.GiftPackage:
                    break;
                case Operation.FairyCeremony:
                    break;
                case Operation.MultipRealmPoint:
                    break;
                case Operation.FlashRushToBuy:
                    FlashRushToBuyActivityClose();
                    break;
                case Operation.max:
                    break;
            }
        }
 
        private void OperationEndEvent(Operation type, int state)
        {
            switch (type)
            {
                case Operation.MultipleExp:
                    break;
                case Operation.ConsumeRebate:
                    break;
                case Operation.FlashSale:
                    break;
                case Operation.BossReborn:
                    break;
                case Operation.GiftPackage:
                    break;
                case Operation.FairyCeremony:
                    break;
                case Operation.MultipRealmPoint:
                    break;
                case Operation.FlashRushToBuy:
                    FlashRushToBuyActivityClose();
                    break;
                case Operation.max:
                    break;
            }
        }
 
        private void GuideCompletedEvent(int id)
        {
            SetFlashRushToBuyNotify();
        }
 
        #region 限时抢购
        public event Action UpdateFlashRushToBuyEvent;
        FlashRushToBuyModel rushToBuyModel { get { return ModelCenter.Instance.GetModel<FlashRushToBuyModel>(); } }
        public List<OperationFlashRushToBuy.FlashSaleShop> flashSaleShops = new List<OperationFlashRushToBuy.FlashSaleShop>();
        public void SetFlashRushToBuyNotify()
        {
            if (NewBieCenter.Instance.inGuiding) return;
 
            OperationFlashRushToBuy.FlashSaleShop saleShop = null;
            bool isPush = rushToBuyModel.CheckIsPush(out saleShop);
            if(isPush && !flashSaleShops.Contains(saleShop))
            {
                flashSaleShops.Add(saleShop);
                if(UpdateFlashRushToBuyEvent != null)
                {
                    UpdateFlashRushToBuyEvent();
                }
            }
        }
 
        public void FlashRushToBuyActivityClose()
        {
            flashSaleShops.Clear();
            closeflashSaleShops.Clear();
            if (UpdateFlashRushToBuyEvent != null)
            {
                UpdateFlashRushToBuyEvent();
            }
        }
 
        public List<OperationFlashRushToBuy.FlashSaleShop> closeflashSaleShops = new List<OperationFlashRushToBuy.FlashSaleShop>();
        public void SetCloseFlashRushToBuyList()
        {
            if(flashSaleShops.Count > 0)
            {
                closeflashSaleShops.Add(flashSaleShops[flashSaleShops.Count - 1]);
            }
        }
 
        #endregion
 
    }
}