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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
|
using System;
using System.Collections.Generic;
using UILib;
using UnityEngine;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient
{
internal class GameMallShopHandler : DlgHandlerBase
{
private XGameMallDocument _doc = null;
public XUIPool m_ShopTypePool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
private List<GameObject> _ShopGo = new List<GameObject>();
protected override void Init()
{
base.Init();
GameObject gameObject = base.transform.Find("Bg/RechargeFrame/ScrollView/Grid/TplMall").gameObject;
this.m_ShopTypePool.SetupPool(gameObject.transform.parent.gameObject, gameObject, 7u, false);
}
public override void RegisterEvent()
{
base.RegisterEvent();
}
protected override void OnShow()
{
base.OnShow();
bool flag = this._doc == null;
if (flag)
{
this._doc = XDocuments.GetSpecificDocument<XGameMallDocument>(XGameMallDocument.uuID);
}
this.OnInitShops();
this.RefreshRedPoint();
}
public void Refresh()
{
}
private void OnInitShops()
{
List<string> list = new List<string>();
List<XSysDefine> shopSystems = this._doc.ShopSystems;
int index = 2;
for (int i = 0; i < shopSystems.Count; i++)
{
bool flag = shopSystems[i] >= XSysDefine.XSys_LevelElite_Shop1 && shopSystems[i] <= XSysDefine.XSys_LevelElite_Shop4;
if (flag)
{
index = i;
break;
}
}
for (int j = 335; j <= 338; j++)
{
ShopTypeTable.RowData shopTypeData = this._doc.GetShopTypeData((XSysDefine)j);
bool flag2 = shopTypeData != null && XSingleton<XEntityMgr>.singleton.Player.PlayerAttributes.Level >= shopTypeData.ShopLevel;
if (flag2)
{
shopSystems[index] = (XSysDefine)j;
}
}
index = 3;
for (int k = 0; k < shopSystems.Count; k++)
{
bool flag3 = shopSystems[k] >= XSysDefine.XSys_Mall_32A && shopSystems[k] <= XSysDefine.XSys_Mall_60A;
if (flag3)
{
index = k;
break;
}
}
for (int l = 330; l <= 333; l++)
{
ShopTypeTable.RowData shopTypeData2 = this._doc.GetShopTypeData((XSysDefine)l);
bool flag4 = shopTypeData2 != null && XSingleton<XEntityMgr>.singleton.Player.PlayerAttributes.Level >= shopTypeData2.ShopLevel;
if (flag4)
{
shopSystems[index] = (XSysDefine)l;
}
}
for (int m = 0; m < shopSystems.Count; m++)
{
ShopTypeTable.RowData shopTypeData3 = this._doc.GetShopTypeData(shopSystems[m]);
bool flag5 = shopTypeData3 != null;
if (flag5)
{
list.Add(shopTypeData3.ShopName);
}
}
List<int> list2 = new List<int>();
for (int n = 0; n < list.Count; n++)
{
ShopTypeTable.RowData shopTypeData4 = this._doc.GetShopTypeData(shopSystems[n]);
bool flag6 = shopTypeData4 != null;
if (flag6)
{
bool flag7 = XSingleton<XGameSysMgr>.singleton.IsSystemOpened(shopSystems[n]) && XSingleton<XEntityMgr>.singleton.Player.PlayerAttributes.Level >= shopTypeData4.ShopLevel;
if (flag7)
{
list2.Add(n);
}
}
}
for (int num = 0; num < list.Count; num++)
{
ShopTypeTable.RowData shopTypeData5 = this._doc.GetShopTypeData(shopSystems[num]);
bool flag8 = !XSingleton<XGameSysMgr>.singleton.IsSystemOpened(shopSystems[num]) || (shopTypeData5 != null && XSingleton<XEntityMgr>.singleton.Player.PlayerAttributes.Level < shopTypeData5.ShopLevel);
if (flag8)
{
list2.Add(num);
}
}
this.m_ShopTypePool.ReturnAll(false);
this._ShopGo.Clear();
int num2 = 0;
while (num2 < list.Count)
{
int index2 = list2[num2];
GameObject gameObject = this.m_ShopTypePool.FetchGameObject(false);
gameObject.transform.localPosition = new Vector3(this.m_ShopTypePool.TplPos.x + (float)(num2 % 3 * this.m_ShopTypePool.TplWidth), this.m_ShopTypePool.TplPos.y - (float)(num2 / 3 * this.m_ShopTypePool.TplHeight), this.m_ShopTypePool.TplPos.z);
IXUILabel ixuilabel = gameObject.transform.Find("shopname").GetComponent("XUILabel") as IXUILabel;
IXUITexture ixuitexture = gameObject.transform.Find("Icon").GetComponent("XUITexture") as IXUITexture;
IXUISprite ixuisprite = gameObject.transform.GetComponent("XUISprite") as IXUISprite;
IXUITexture ixuitexture2 = gameObject.transform.Find("Lock").GetComponent("XUITexture") as IXUITexture;
this._ShopGo.Add(gameObject);
ShopTypeTable.RowData shopTypeData6 = this._doc.GetShopTypeData(shopSystems[index2]);
ixuilabel.SetText(list[index2]);
bool flag9 = shopTypeData6 != null && !string.IsNullOrEmpty(shopTypeData6.ShopIcon);
if (flag9)
{
ixuitexture.SetTexturePath("atlas/UI/GameSystem/Activity/" + shopTypeData6.ShopIcon);
}
ixuisprite.ID = (ulong)((long)shopSystems[index2]);
bool flag10 = false;
int hour = DateTime.Now.Hour;
int minute = DateTime.Now.Minute;
bool flag11 = shopTypeData6 != null;
if (flag11)
{
flag10 = this.IsShopOpen(shopSystems[index2]);
}
bool flag12 = !XSingleton<XGameSysMgr>.singleton.IsSystemOpened(shopSystems[index2]) || XSingleton<XEntityMgr>.singleton.Player.PlayerAttributes.Level < shopTypeData6.ShopLevel;
if (flag12)
{
ixuitexture.SetEnabled(false);
ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.CannotOpenShop));
ixuitexture2.SetVisible(true);
}
else
{
bool flag13 = shopSystems[index2] == XSysDefine.XSys_Mall_Guild;
if (flag13)
{
XGuildDocument specificDocument = XDocuments.GetSpecificDocument<XGuildDocument>(XGuildDocument.uuID);
bool flag14 = !specificDocument.bInGuild;
if (flag14)
{
ixuitexture2.SetVisible(true);
ixuitexture.SetEnabled(false);
ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnOpenGuild));
goto IL_5C8;
}
}
bool flag15 = !flag10;
if (flag15)
{
ixuitexture2.SetVisible(true);
ixuitexture.SetEnabled(false);
}
else
{
ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnOpenShop));
ixuitexture2.SetVisible(false);
ixuisprite.SetEnabled(true);
ixuitexture.SetEnabled(true);
}
}
IL_5C8:
num2++;
continue;
goto IL_5C8;
}
}
protected override void OnHide()
{
base.OnHide();
XSingleton<UiUtility>.singleton.DestroyTextureInActivePool(this.m_ShopTypePool, "Icon");
}
public override void RefreshData()
{
base.RefreshData();
}
public bool IsShopOpen(XSysDefine sys)
{
int hour = DateTime.Now.Hour;
int minute = DateTime.Now.Minute;
bool result = false;
bool flag = this._doc == null;
if (flag)
{
this._doc = XDocuments.GetSpecificDocument<XGameMallDocument>(XGameMallDocument.uuID);
}
ShopTypeTable.RowData shopTypeData = this._doc.GetShopTypeData(sys);
bool flag2 = shopTypeData != null;
if (flag2)
{
bool flag3 = shopTypeData.ShopOpen.Count == 0;
if (flag3)
{
result = true;
}
for (int i = 0; i < shopTypeData.ShopOpen.Count; i++)
{
int num = hour * 100 + minute;
bool flag4 = (long)num >= (long)((ulong)shopTypeData.ShopOpen[i, 0]) && (long)num <= (long)((ulong)shopTypeData.ShopOpen[i, 1]);
if (flag4)
{
result = true;
}
}
}
return result;
}
public void OnOpenShop(IXUISprite sp)
{
bool flag = this._doc.shopRedPoint.Contains((XSysDefine)sp.ID);
if (flag)
{
this._doc.RefreshShopRedPoint((XSysDefine)sp.ID, false);
}
XSysDefine sys = (XSysDefine)sp.ID;
DlgBase<MallSystemDlg, MallSystemBehaviour>.singleton.m_OpenFromGeneral = true;
DlgBase<MallSystemDlg, MallSystemBehaviour>.singleton.ShowShopSystem(sys, 0UL);
}
public void CannotOpenShop(IXUISprite sp)
{
XSysDefine xsysDefine = (XSysDefine)sp.ID;
int sysOpenLevel = XSingleton<XGameSysMgr>.singleton.GetSysOpenLevel((int)sp.ID);
XSingleton<UiUtility>.singleton.ShowSystemTip(string.Format(XStringDefineProxy.GetString("SHOP_OPEN_LEVEL"), sysOpenLevel), "fece00");
}
public void OnOpenGuild(IXUISprite sp)
{
XSingleton<XGameSysMgr>.singleton.OpenSystem(XSysDefine.XSys_Guild, 0UL);
}
public void RefreshRedPoint()
{
bool flag = false;
for (int i = 0; i < this._ShopGo.Count; i++)
{
IXUISprite ixuisprite = this._ShopGo[i].transform.GetComponent("XUISprite") as IXUISprite;
IXUISprite ixuisprite2 = this._ShopGo[i].transform.Find("RedPoint").GetComponent("XUISprite") as IXUISprite;
bool flag2 = this._doc.shopRedPoint.Contains((XSysDefine)ixuisprite.ID);
if (flag2)
{
flag = true;
ixuisprite2.SetVisible(true);
}
else
{
ixuisprite2.SetVisible(false);
}
}
bool flag3 = !flag;
if (flag3)
{
this._doc.shopRedPoint.Clear();
}
XSingleton<XGameSysMgr>.singleton.SetSysRedPointState(XSysDefine.XSys_Mall, flag);
XSingleton<XGameSysMgr>.singleton.RecalculateRedPointState(XSysDefine.XSys_Mall, true);
}
}
}
|