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 UILib;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient
{
internal class XSpectateDocument : XDocComponent
{
public override uint ID
{
get
{
return XSpectateDocument.uuID;
}
}
public List<OneLiveRecordInfo> SpectateRecord
{
get
{
return this._spectateRecord;
}
}
public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("SpectateDocument");
private List<OneLiveRecordInfo> _spectateRecord = new List<OneLiveRecordInfo>();
public List<OneLiveRecordInfo> MyRecentRecord = new List<OneLiveRecordInfo>();
public OneLiveRecordInfo WatchMostRecord;
public OneLiveRecordInfo CommendMostRecord;
public SeqList<int> PkIntervalList;
public int TotalWatch;
public int TotalCommend;
public int CurrPage = 0;
public int MaxPage = 0;
public int CurrTime = 0;
public int CurrTabs = 0;
public bool IsLoadingSpectateScene = false;
public readonly int ITEMPERPAGE = 4;
public bool MainInterfaceState = false;
public LiveIconData MainInterfaceData;
public LiveIconData ClickData;
public uint TempliveID;
public LiveType TempLiveType;
public uint LiveCount = 0u;
public bool VisibleSetting = false;
public bool TempSetting = false;
public override void OnEnterSceneFinally()
{
this.IsLoadingSpectateScene = false;
}
private void GetPVPInterval()
{
this.PkIntervalList = XSingleton<XGlobalConfig>.singleton.GetSequenceList("Spectate_PVP_interval", false);
}
public override void OnAttachToHost(XObject host)
{
base.OnAttachToHost(host);
this.GetPVPInterval();
}
public void SendQuerySpectateInfo(int ID)
{
this.CurrTabs = ID;
RpcC2G_GetWatchInfoByID rpcC2G_GetWatchInfoByID = new RpcC2G_GetWatchInfoByID();
rpcC2G_GetWatchInfoByID.oArg.type = ID;
XSingleton<XClientNetwork>.singleton.Send(rpcC2G_GetWatchInfoByID);
}
public void SetSpectateInfo(int currTime, List<OneLiveRecordInfo> list)
{
this.CurrTime = currTime;
this._spectateRecord.Clear();
for (int i = 0; i < list.Count; i++)
{
OneLiveRecordInfo item = new OneLiveRecordInfo();
item = list[i];
this._spectateRecord.Add(item);
}
this.MaxPage = (list.Count + this.ITEMPERPAGE - 1) / this.ITEMPERPAGE;
bool flag = DlgBase<SpectateView, SpectateBehaviour>.singleton.IsVisible();
if (flag)
{
DlgBase<SpectateView, SpectateBehaviour>.singleton.RefreshSpectate(0);
}
}
public bool OnLeaveTeamSure(IXUIButton btn)
{
DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(false, true);
XTeamDocument specificDocument = XDocuments.GetSpecificDocument<XTeamDocument>(XTeamDocument.uuID);
bool bInTeam = specificDocument.bInTeam;
if (bInTeam)
{
specificDocument.ReqTeamOp(TeamOperate.TEAM_LEAVE, 0UL, null, TeamMemberType.TMT_NORMAL, null);
}
this.SendEnterSpectateQuery(this.TempliveID, this.TempLiveType);
return true;
}
public void EnterSpectateBattle(uint liveID, LiveType type)
{
bool flag = !XSingleton<XGameSysMgr>.singleton.IsSystemOpened(XSysDefine.XSys_Spectate);
if (flag)
{
XSingleton<UiUtility>.singleton.ShowSystemTip(string.Format(XStringDefineProxy.GetString("Spectate_UnOpen"), XSingleton<XGameSysMgr>.singleton.GetSysOpenLevel(XSysDefine.XSys_Spectate)), "fece00");
}
else
{
XTeamDocument specificDocument = XDocuments.GetSpecificDocument<XTeamDocument>(XTeamDocument.uuID);
bool flag2 = !specificDocument.bInTeam;
if (flag2)
{
this.SendEnterSpectateQuery(liveID, type);
}
else
{
this.TempliveID = liveID;
this.TempLiveType = type;
XSingleton<UiUtility>.singleton.ShowLeaveTeamModalDialog(new ButtonClickEventHandler(this.OnLeaveTeamSure), "");
}
}
}
public void SendEnterSpectateQuery(uint liveID, LiveType type)
{
this.IsLoadingSpectateScene = true;
RpcC2G_EnterWatchBattle rpcC2G_EnterWatchBattle = new RpcC2G_EnterWatchBattle();
rpcC2G_EnterWatchBattle.oArg.liveID = liveID;
rpcC2G_EnterWatchBattle.oArg.type = type;
XSingleton<XClientNetwork>.singleton.Send(rpcC2G_EnterWatchBattle);
}
public void SendQueryMyLiveInfo()
{
RpcC2G_GetMyWatchRecord rpc = new RpcC2G_GetMyWatchRecord();
XSingleton<XClientNetwork>.singleton.Send(rpc);
}
public void SetMyLiveInfo(int watchNum, int commendNum, OneLiveRecordInfo watchMostRecord, OneLiveRecordInfo commendMostRecord, List<OneLiveRecordInfo> list, bool visSet)
{
this.TotalWatch = watchNum;
this.TotalCommend = commendNum;
this.WatchMostRecord = watchMostRecord;
this.CommendMostRecord = commendMostRecord;
this.VisibleSetting = visSet;
this.MyRecentRecord.Clear();
for (int i = 0; i < list.Count; i++)
{
OneLiveRecordInfo item = new OneLiveRecordInfo();
item = list[i];
this.MyRecentRecord.Add(item);
}
bool flag = DlgBase<SpectateView, SpectateBehaviour>.singleton.IsVisible();
if (flag)
{
DlgBase<SpectateView, SpectateBehaviour>.singleton.RefreshMyRecord();
}
}
public void EnterLiveError(bool isOver)
{
bool flag = DlgBase<SpectateView, SpectateBehaviour>.singleton.IsVisible();
if (flag)
{
DlgBase<SpectateView, SpectateBehaviour>.singleton.SetWatchBtnGrey(isOver);
}
}
public void SetLiveCount(uint count)
{
XSingleton<XDebug>.singleton.AddLog(string.Format("Get live count = {0} by server", count), null, null, null, null, null, XDebugColor.XDebug_None);
this.LiveCount = count;
bool flag = DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.IsVisible();
if (flag)
{
DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.ShowLiveCount(count);
}
}
public void SetMainInterfaceBtnState(bool state, LiveIconData data)
{
bool flag = data == null;
if (flag)
{
XSingleton<XDebug>.singleton.AddErrorLog("Get MainInterfaceBtnState data of spectate is null", null, null, null, null, null);
}
else
{
bool flag2 = !state && (this.MainInterfaceData == null || data.liveID != this.MainInterfaceData.liveID);
if (!flag2)
{
this.MainInterfaceState = state;
this.MainInterfaceData = data;
DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.RefreshH5ButtonState(XSysDefine.XSys_ExcellentLive, true);
}
}
}
public void SetMainInterfaceBtnFalse()
{
this.MainInterfaceState = false;
this.MainInterfaceData = null;
DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.RefreshH5ButtonState(XSysDefine.XSys_ExcellentLive, true);
}
public void MainInterfaceEnterQuery()
{
bool flag = this.ClickData == null;
if (flag)
{
XSingleton<XDebug>.singleton.AddErrorLog("spectate maininterface click data is null", null, null, null, null, null);
}
else
{
this.EnterSpectateBattle((uint)this.ClickData.liveID, (LiveType)this.ClickData.liveType);
}
}
public string GetTitle(OneLiveRecordInfo info)
{
string text = XStringDefineProxy.GetString("Spectate_Title_" + XFastEnumIntEqualityComparer<LiveType>.ToInt(info.liveType));
LiveType liveType = info.liveType;
switch (liveType)
{
case LiveType.LIVE_PVP:
break;
case LiveType.LIVE_NEST:
{
XExpeditionDocument specificDocument = XDocuments.GetSpecificDocument<XExpeditionDocument>(XExpeditionDocument.uuID);
return XExpeditionDocument.GetFullName(specificDocument.GetExpeditionDataByID(info.DNExpID));
}
case LiveType.LIVE_PROTECTCAPTAIN:
case LiveType.LIVE_GUILDBATTLE:
return text;
case LiveType.LIVE_DRAGON:
{
XExpeditionDocument specificDocument2 = XDocuments.GetSpecificDocument<XExpeditionDocument>(XExpeditionDocument.uuID);
return XExpeditionDocument.GetFullName(specificDocument2.GetExpeditionDataByID(info.DNExpID));
}
default:
if (liveType != LiveType.LIVE_PVP2)
{
return text;
}
break;
}
text = string.Format("{0}{1}{2}", text, this.GetPVPPostfix(info.tianTiLevel), XStringDefineProxy.GetString("PVP_Point"));
return text;
}
private string GetPVPPostfix(int pkPoint)
{
bool flag = this.PkIntervalList == null;
string result;
if (flag)
{
result = "";
}
else
{
bool flag2 = pkPoint < this.PkIntervalList[0, 0];
if (flag2)
{
result = "";
}
else
{
for (int i = 0; i < (int)this.PkIntervalList.Count; i++)
{
bool flag3 = pkPoint <= this.PkIntervalList[i, 1];
if (flag3)
{
return this.PkIntervalList[i, 0].ToString();
}
}
result = "";
}
}
return result;
}
public static LiveType GetLiveTypeBySceneType(SceneType type)
{
if (type <= SceneType.SCENE_WEEK_NEST)
{
if (type <= SceneType.SCENE_PK)
{
if (type == SceneType.SCENE_NEST)
{
return LiveType.LIVE_NEST;
}
if (type == SceneType.SCENE_PK)
{
return LiveType.LIVE_PVP;
}
}
else
{
switch (type)
{
case SceneType.SCENE_PVP:
return LiveType.LIVE_PROTECTCAPTAIN;
case SceneType.SCENE_DRAGON:
return LiveType.LIVE_DRAGON;
case SceneType.SCENE_GMF:
return LiveType.LIVE_GUILDBATTLE;
default:
if (type == SceneType.SCENE_GPR)
{
return LiveType.LIVE_GUILDBATTLE;
}
if (type == SceneType.SCENE_WEEK_NEST)
{
return LiveType.LIVE_DRAGON;
}
break;
}
}
}
else if (type <= SceneType.SCENE_LEAGUE_BATTLE)
{
if (type == SceneType.SCENE_HEROBATTLE)
{
return LiveType.LIVE_HEROBATTLE;
}
if (type == SceneType.SCENE_LEAGUE_BATTLE)
{
return LiveType.LIVE_LEAGUEBATTLE;
}
}
else
{
if (type == SceneType.SCENE_CUSTOMPK)
{
return LiveType.LIVE_CUSTOMPK;
}
if (type == SceneType.SCENE_PKTWO)
{
return LiveType.LIVE_PVP2;
}
if (type == SceneType.SCENE_GCF)
{
return LiveType.LIVE_CROSSGVG;
}
}
XSingleton<XDebug>.singleton.AddErrorLog("Can't find The live Type by SceneType", null, null, null, null, null);
return LiveType.LIVE_MAX;
}
protected override void OnReconnected(XReconnectedEventArgs arg)
{
}
}
}
|