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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
|
using System;
using KKSG;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient.UI.CustomBattle
{
internal class CustomBattleCustomModeListHandler : DlgHandlerBase
{
private int wrapCount
{
get
{
bool flag = this._doc == null;
int result;
if (flag)
{
result = 0;
}
else
{
result = ((this._doc.SelfCustomData == null) ? this._doc.CustomList.Count : (this._doc.CustomList.Count + 1));
}
return result;
}
}
protected override string FileName
{
get
{
return "GameSystem/CustomBattle/CustomModeListFrame";
}
}
private XCustomBattleDocument _doc = null;
private IXUIInput _input;
private IXUISprite _search;
private IXUIButton _create_game;
private IXUIButton _my_game;
private Transform _red_point;
private IXUIButton _refresh;
private IXUISprite _show_other;
private Transform _show_flag;
private Transform _empty_game;
private IXUIScrollView _scroll_view;
private IXUIWrapContent _wrap_content;
protected override void Init()
{
base.Init();
this._doc = XDocuments.GetSpecificDocument<XCustomBattleDocument>(XCustomBattleDocument.uuID);
this._input = (base.transform.Find("Bg/Input").GetComponent("XUIInput") as IXUIInput);
this._search = (base.transform.Find("Bg/Input/Search").GetComponent("XUISprite") as IXUISprite);
this._create_game = (base.transform.Find("Bg/BtnCreateGame").GetComponent("XUIButton") as IXUIButton);
this._my_game = (base.transform.Find("Bg/BtnMyGame").GetComponent("XUIButton") as IXUIButton);
this._red_point = base.transform.Find("Bg/BtnMyGame/RedPoint");
this._refresh = (base.transform.Find("Bg/BtnRefresh").GetComponent("XUIButton") as IXUIButton);
this._show_other = (base.transform.Find("Bg/BtnOther").GetComponent("XUISprite") as IXUISprite);
this._show_flag = base.transform.Find("Bg/BtnOther/Flag");
this._empty_game = base.transform.Find("Bg/EmptyGame");
this._scroll_view = (base.transform.Find("Bg/Panel").GetComponent("XUIScrollView") as IXUIScrollView);
this._wrap_content = (base.transform.Find("Bg/Panel/List").GetComponent("XUIWrapContent") as IXUIWrapContent);
this._wrap_content.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.WrapContentUpdated));
}
public override void RegisterEvent()
{
base.RegisterEvent();
this._search.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnSearchClicked));
this._create_game.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCreateGameButtonClicked));
this._my_game.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnMyGameButtonClicked));
this._refresh.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnRefreshButtonClicked));
this._show_other.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnShowOtherClicked));
}
protected override void OnShow()
{
base.OnShow();
this._input.SetText("");
this._show_flag.gameObject.SetActive(this._doc.QueryCross);
this._doc.SendCustomBattleQueryCustomModeList(this._doc.QueryCross);
this._doc.SendCustomBattleQueryCustomModeSelfInfo();
this.RefreshData();
}
public override void RefreshData()
{
base.RefreshData();
bool flag = this._doc.SelfCustomData != null;
if (flag)
{
this._create_game.SetVisible(false);
this._my_game.SetVisible(true);
this._red_point.gameObject.SetActive(this._doc.SelfCustomData.selfStatus == CustomBattleRoleState.CustomBattle_RoleState_Reward && this._doc.SelfCustomData.boxLeftTime == 0u);
}
else
{
this._create_game.SetVisible(true);
this._my_game.SetVisible(false);
}
this._wrap_content.SetContentCount(this.wrapCount, false);
this._empty_game.gameObject.SetActive(this.wrapCount == 0);
this._scroll_view.ResetPosition();
}
private void WrapContentUpdated(Transform t, int index)
{
bool flag = index < 0 || index >= this.wrapCount;
if (flag)
{
t.gameObject.SetActive(false);
}
else
{
this.SetupCustom(t, index);
}
}
private void SetupCustom(Transform t, int index)
{
Transform transform = t.Find("FairMode");
IXUILabelSymbol ixuilabelSymbol = t.Find("Name").GetComponent("XUILabelSymbol") as IXUILabelSymbol;
IXUILabel ixuilabel = t.Find("Type").GetComponent("XUILabel") as IXUILabel;
IXUILabel ixuilabel2 = t.Find("Creator").GetComponent("XUILabel") as IXUILabel;
IXUILabel ixuilabel3 = t.Find("JoinCount").GetComponent("XUILabel") as IXUILabel;
IXUIButton ixuibutton = t.Find("JoinBtn").GetComponent("XUIButton") as IXUIButton;
IXUIButton ixuibutton2 = t.Find("DetailBtn").GetComponent("XUIButton") as IXUIButton;
bool flag = this._doc.SelfCustomData == null;
XCustomBattleDocument.CustomModeData customModeData;
if (flag)
{
customModeData = this._doc.CustomList[index];
}
else
{
bool flag2 = index == 0;
if (flag2)
{
customModeData = this._doc.SelfCustomData;
}
else
{
customModeData = this._doc.CustomList[index - 1];
}
}
transform.gameObject.SetActive(customModeData.fairMode);
string text = " ";
uint num = 1u << XFastEnumIntEqualityComparer<CustomBattleTag>.ToInt(CustomBattleTag.CustomBattle_Tag_Friend);
bool flag3 = (customModeData.tagMask & num) == num;
num = 1u << XFastEnumIntEqualityComparer<CustomBattleTag>.ToInt(CustomBattleTag.CustomBattle_Tag_Guild);
bool flag4 = (customModeData.tagMask & num) == num;
num = 1u << XFastEnumIntEqualityComparer<CustomBattleTag>.ToInt(CustomBattleTag.CustomBattle_Tag_Cross);
bool flag5 = (customModeData.tagMask & num) == num;
num = 1u << XFastEnumIntEqualityComparer<CustomBattleTag>.ToInt(CustomBattleTag.CustomBattle_Tag_GM);
bool flag6 = (customModeData.tagMask & num) == num;
bool flag7 = flag3;
if (flag7)
{
text += XLabelSymbolHelper.FormatImage("common/Universal", "chat_tag_8");
}
bool flag8 = flag4;
if (flag8)
{
text += XLabelSymbolHelper.FormatImage("common/Universal", "chat_tag_2");
}
bool flag9 = flag5;
if (flag9)
{
text += XLabelSymbolHelper.FormatImage("common/Universal", "chat_tag_11");
}
bool flag10 = flag6;
if (flag10)
{
text += XLabelSymbolHelper.FormatImage("common/Universal", "chat_tag_12");
}
ixuilabelSymbol.InputText = customModeData.gameName + text;
CustomBattleTypeTable.RowData customBattleTypeData = this._doc.GetCustomBattleTypeData((int)customModeData.gameType);
ixuilabel.SetText((customBattleTypeData != null) ? customBattleTypeData.name : "");
ixuilabel2.SetText(customModeData.gameCreator);
ixuilabel3.SetText(customModeData.joinText);
ixuibutton.ID = (ulong)((long)index);
ixuibutton2.ID = (ulong)((long)index);
ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnJoinButtonClicked));
ixuibutton2.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnDetailButtonClicked));
bool flag11 = this._doc.SelfCustomData != null && this._doc.SelfCustomData.gameID == customModeData.gameID;
if (flag11)
{
ixuibutton.SetEnable(false, false);
}
else
{
ixuibutton.SetEnable(true, false);
}
}
private void OnSearchClicked(IXUISprite sp)
{
this._doc.SendCustomBattleSearch(this._input.GetText());
this._input.SetText("");
}
private bool OnCreateGameButtonClicked(IXUIButton button)
{
DlgBase<CustomBattleView, TabDlgBehaviour>.singleton.ShowCustomModeCreateHandler();
return true;
}
private bool OnMyGameButtonClicked(IXUIButton button)
{
bool flag = this._doc.SelfCustomData == null;
bool result;
if (flag)
{
result = false;
}
else
{
this._doc.CurrentCustomData = this._doc.SelfCustomData;
DlgBase<CustomBattleView, TabDlgBehaviour>.singleton.ShowCustomModeDetailHandler();
result = true;
}
return result;
}
private bool OnRefreshButtonClicked(IXUIButton button)
{
this._doc.SendCustomBattleQueryCustomModeList(this._doc.QueryCross);
this._doc.SendCustomBattleQueryCustomModeSelfInfo();
this._input.SetText("");
return true;
}
private void OnShowOtherClicked(IXUISprite sp)
{
this._doc.QueryCross = !this._doc.QueryCross;
this._show_flag.gameObject.SetActive(this._doc.QueryCross);
this.OnRefreshButtonClicked(null);
}
private bool OnJoinButtonClicked(IXUIButton button)
{
bool flag = (int)button.ID >= this.wrapCount;
bool result;
if (flag)
{
result = false;
}
else
{
bool flag2 = this._doc.SelfCustomData != null;
if (flag2)
{
bool flag3 = button.ID == 0UL;
if (flag3)
{
this._doc.CurrentCustomData = this._doc.SelfCustomData;
this._doc.SendCustomBattleJoin(this._doc.SelfCustomData.gameID, this._doc.SelfCustomData.hasPassword, "");
}
else
{
this._doc.CurrentCustomData = this._doc.CustomList[(int)button.ID - 1];
this._doc.SendCustomBattleJoin(this._doc.CustomList[(int)button.ID - 1].gameID, this._doc.CustomList[(int)button.ID - 1].hasPassword, "");
}
}
else
{
this._doc.CurrentCustomData = this._doc.CustomList[(int)button.ID];
this._doc.SendCustomBattleJoin(this._doc.CustomList[(int)button.ID].gameID, this._doc.CustomList[(int)button.ID].hasPassword, "");
}
result = true;
}
return result;
}
private bool OnDetailButtonClicked(IXUIButton button)
{
this.ShowDetailByIndex((int)button.ID);
return true;
}
public bool ShowDetailByIndex(int index)
{
bool flag = index >= this.wrapCount;
bool result;
if (flag)
{
result = false;
}
else
{
bool flag2 = this._doc.SelfCustomData != null;
if (flag2)
{
bool flag3 = index == 0;
if (flag3)
{
this._doc.CurrentCustomData = this._doc.SelfCustomData;
}
else
{
this._doc.CurrentCustomData = this._doc.CustomList[index - 1];
}
}
else
{
this._doc.CurrentCustomData = this._doc.CustomList[index];
}
DlgBase<CustomBattleView, TabDlgBehaviour>.singleton.ShowCustomModeDetailHandler();
result = true;
}
return result;
}
public void ShowSelfDetail()
{
this._doc.CurrentCustomData = this._doc.SelfCustomData;
DlgBase<CustomBattleView, TabDlgBehaviour>.singleton.ShowCustomModeDetailHandler();
}
}
}
|