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
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
|
using System;
using System.Collections.Generic;
using KKSG;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient
{
internal class XCrossGVGDocument : XDocComponent
{
public override uint ID
{
get
{
return XCrossGVGDocument.uuID;
}
}
public bool InterfaceState
{
get
{
return this._interfaceIconState;
}
}
public bool HasDuelCombat
{
get
{
return this._hasDuelCombat;
}
}
public uint RegisterationCount
{
get
{
return this.m_registrationCount;
}
}
public CrossGvgTimeState TimeStep
{
get
{
return this._timeState;
}
}
public CrossGvgRoomState RoomState
{
get
{
return this._SelfRoomState;
}
}
public bool VisibleEnterBattle
{
get
{
return this._visibleEnterBattle;
}
}
public bool HasAvailableJoin
{
get
{
return this._hasAvailableJoin;
}
}
public XBetterList<XGVGGuildInfo> GVGRanks
{
get
{
return this._guildList.BufferValues;
}
}
public List<GVGDuelCombatInfo> GVGDuels
{
get
{
return this._duelRecords;
}
}
public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("CrossGVGDocument");
private CrossGvgTimeState _timeState = CrossGvgTimeState.CGVG_NotOpen;
public GuildArenaTab SelectTabIndex = GuildArenaTab.Hall;
private List<GVGDuelCombatInfo> _duelRecords = new List<GVGDuelCombatInfo>();
private List<ulong> _supportGuildIDs;
private CrossGvgRoomState _SelfRoomState = CrossGvgRoomState.CGRS_Idle;
private bool _visibleEnterBattle = false;
private bool _hasAvailableJoin = false;
private XBetterDictionary<ulong, XGVGGuildInfo> _guildList = new XBetterDictionary<ulong, XGVGGuildInfo>(0);
private Dictionary<uint, XGVGCombatGroupData> _combatGroups = new Dictionary<uint, XGVGCombatGroupData>();
private uint m_registrationCount;
private bool _hasDuelCombat = false;
private bool _interfaceIconState = false;
protected override void OnReconnected(XReconnectedEventArgs arg)
{
}
public void SetMainInterfaceBtnState(bool active)
{
this._interfaceIconState = active;
bool flag = DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.IsVisible();
if (flag)
{
DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.RefreshH5ButtonState(XSysDefine.XSys_CrossGVG, true);
}
}
public string ToSupportString()
{
return string.Format("{0}/{1}", (this._supportGuildIDs == null) ? 0 : this._supportGuildIDs.Count, XSingleton<XGlobalConfig>.singleton.GetInt("CrossGvgSupport"));
}
public bool IsSupportExist(ulong guildID)
{
return this._supportGuildIDs != null && this._supportGuildIDs.Contains(guildID);
}
public bool IsSupportFull()
{
int @int = XSingleton<XGlobalConfig>.singleton.GetInt("CrossGvgSupport");
return this._supportGuildIDs == null || this._supportGuildIDs.Count >= @int;
}
public void SynCrossGVGTimeState(CrossGvgTimeState state)
{
XSingleton<XDebug>.singleton.AddGreenLog("Cross State = " + state.ToString(), null, null, null, null, null);
this._timeState = state;
GuildArenaTab guildArenaTab = this.SelectTabIndex;
switch (this._timeState)
{
case CrossGvgTimeState.CGVG_NotOpen:
case CrossGvgTimeState.CGVG_Select:
guildArenaTab = GuildArenaTab.Hall;
break;
case CrossGvgTimeState.CGVG_PointRace:
guildArenaTab = GuildArenaTab.Duel;
break;
case CrossGvgTimeState.CGVG_Guess:
case CrossGvgTimeState.CGVG_Knockout:
case CrossGvgTimeState.CGVG_SeasonEnd:
guildArenaTab = GuildArenaTab.Combat;
break;
}
bool flag = DlgBase<CrossGVGMainView, TabDlgBehaviour>.singleton.IsVisible();
if (flag)
{
bool flag2 = guildArenaTab == this.SelectTabIndex;
if (flag2)
{
DlgBase<CrossGVGMainView, TabDlgBehaviour>.singleton.RefreshData();
}
else
{
DlgBase<CrossGVGMainView, TabDlgBehaviour>.singleton.SelectTabIndex(guildArenaTab);
}
}
}
public XGuildBasicData GetGVGGuildInfo(ulong guildID)
{
return (guildID > 0UL && this._guildList.ContainsKey(guildID)) ? this._guildList[guildID] : null;
}
public void SendCrossGVGOper(CrossGvgOperType type, ulong uid = 0UL)
{
RpcC2M_CrossGvgOper rpcC2M_CrossGvgOper = new RpcC2M_CrossGvgOper();
rpcC2M_CrossGvgOper.oArg.type = type;
if (type == CrossGvgOperType.CGOT_SupportGuild)
{
bool flag = uid > 0UL;
if (flag)
{
rpcC2M_CrossGvgOper.oArg.support_guildid.Add(uid);
}
}
XSingleton<XClientNetwork>.singleton.Send(rpcC2M_CrossGvgOper);
}
public void NotifyCrossGVGOper(CrossGvgOperArg oArg, CrossGvgOperRes oRes)
{
bool flag = oRes.result == ErrorCode.ERR_SUCCESS;
if (flag)
{
bool flag2 = oArg.type == CrossGvgOperType.CGOT_SupportGuild;
if (flag2)
{
bool flag3 = this._supportGuildIDs == null;
if (flag3)
{
this._supportGuildIDs = new List<ulong>();
}
int i = 0;
int count = oArg.support_guildid.Count;
while (i < count)
{
bool flag4 = this._supportGuildIDs.Contains(oArg.support_guildid[i]);
if (!flag4)
{
this._supportGuildIDs.Add(oArg.support_guildid[i]);
}
i++;
}
bool flag5 = DlgBase<CrossGVGMainView, TabDlgBehaviour>.singleton.IsVisible();
if (flag5)
{
DlgBase<CrossGVGMainView, TabDlgBehaviour>.singleton.RefreshData();
}
}
}
else
{
XSingleton<UiUtility>.singleton.ShowErrorCode(oRes.result);
}
}
public void SendCrossGVGData()
{
RpcC2M_GetCrossGvgData rpc = new RpcC2M_GetCrossGvgData();
XSingleton<XClientNetwork>.singleton.Send(rpc);
}
public void ReceiveCrossGVGData(GetCrossGvgDataRes res)
{
XSingleton<XDebug>.singleton.AddGreenLog("GetCrossGvgDataRes = " + res.rank.ToString() + " : " + res.record.ToString(), null, null, null, null, null);
this._supportGuildIDs = res.support_guildid;
this.m_registrationCount = res.season_num;
this.ConvertGuildList(res.rank);
this.ConvertDuelRecord(res.record);
this.ConvertCombatRecord(res.rooms);
bool flag = DlgBase<CrossGVGMainView, TabDlgBehaviour>.singleton.IsVisible();
if (flag)
{
DlgBase<CrossGVGMainView, TabDlgBehaviour>.singleton.RefreshData();
}
}
public void NotifyCrossGVGRoomState(CrossGvgRoomInfo room, CrossGvgRacePointRecord record)
{
XSingleton<XDebug>.singleton.AddGreenLog("NotifyCrossGVGRoomState :room = " + (room == null).ToString() + " record = " + (record == null).ToString(), null, null, null, null, null);
bool flag = this.ConvertDuelRecord(record) || this.ConvertCombatRecord(room);
if (flag)
{
bool flag2 = DlgBase<CrossGVGMainView, TabDlgBehaviour>.singleton.IsVisible();
if (flag2)
{
DlgBase<CrossGVGMainView, TabDlgBehaviour>.singleton.RefreshData();
}
}
}
public bool TryGetCombatRoom(uint roomID, out XGVGCombatGroupData combatData)
{
return this._combatGroups.TryGetValue(roomID, out combatData);
}
private void ConvertGuildList(List<CrossGvgGuildInfo> ranks)
{
this._guildList.Clear();
int i = 0;
int count = ranks.Count;
while (i < count)
{
XGVGGuildInfo xgvgguildInfo = new XGVGGuildInfo();
xgvgguildInfo.Setup(ranks[i]);
this._guildList.Add(xgvgguildInfo.uid, xgvgguildInfo);
i++;
}
}
private void ConvertCombatRecord(List<CrossGvgRoomInfo> rooms)
{
this._SelfRoomState = CrossGvgRoomState.CGRS_Idle;
this._visibleEnterBattle = false;
this._hasAvailableJoin = false;
int i = 0;
int count = rooms.Count;
while (i < count)
{
this.ConvertCombatRecord(rooms[i]);
i++;
}
}
private bool ConvertCombatRecord(CrossGvgRoomInfo room)
{
bool flag = room == null;
bool result;
if (flag)
{
result = false;
}
else
{
XGVGCombatGroupData xgvgcombatGroupData = null;
XGuildDocument specificDocument = XDocuments.GetSpecificDocument<XGuildDocument>(XGuildDocument.uuID);
bool flag2 = !this._combatGroups.TryGetValue(room.roomid, out xgvgcombatGroupData);
if (flag2)
{
xgvgcombatGroupData = new XGVGCombatGroupData();
this._combatGroups.Add(room.roomid, xgvgcombatGroupData);
}
xgvgcombatGroupData.Convert(room);
bool flag3 = xgvgcombatGroupData.InCombatGroup(specificDocument.UID);
if (flag3)
{
this._hasAvailableJoin = true;
this._SelfRoomState = xgvgcombatGroupData.RoomState;
this._visibleEnterBattle = (xgvgcombatGroupData.WinnerID == 0UL || (xgvgcombatGroupData.WinnerID == specificDocument.UID && xgvgcombatGroupData.RoomID != 7u));
}
result = true;
}
return result;
}
private void ConvertDuelRecord(List<CrossGvgRacePointRecord> records)
{
int count = records.Count;
this._hasDuelCombat = (count > 0);
this._duelRecords.Clear();
int i = 0;
int count2 = records.Count;
while (i < count2)
{
GVGDuelCombatInfo gvgduelCombatInfo = new GVGDuelCombatInfo();
gvgduelCombatInfo.Setup(records[i]);
this._duelRecords.Add(gvgduelCombatInfo);
i++;
}
}
private bool ConvertDuelRecord(CrossGvgRacePointRecord record)
{
bool flag = record == null;
bool result;
if (flag)
{
result = false;
}
else
{
int i = 0;
int count = this._duelRecords.Count;
while (i < count)
{
bool flag2 = this._duelRecords[i] != null && this._duelRecords[i].roomID == record.roomid;
if (flag2)
{
this._duelRecords[i].Setup(record);
return true;
}
i++;
}
result = false;
}
return result;
}
}
}
|