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
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
|
using System;
using System.Collections.Generic;
using KKSG;
using UnityEngine;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient
{
internal class XSpectateSceneDocument : XDocComponent
{
public override uint ID
{
get
{
return XSpectateSceneDocument.uuID;
}
}
public SpectateSceneView _SpectateSceneView
{
get
{
return this._view;
}
set
{
this._view = value;
}
}
public uint CurrentBuffID
{
get
{
return this._currentBuffID;
}
}
public bool ShowStrengthPresevedBar
{
get
{
return this._showStrengthPresevedBar;
}
}
public bool ShowTeamMemberDamageHUD { get; set; }
public LiveTable LiveConfigTable
{
get
{
return XSpectateSceneDocument._liveConfigTable;
}
}
public bool IsCrossServerBattle { get; set; }
public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("SpectateSceneDocument");
private SpectateSceneView _view = null;
private uint _currentBuffID = 0u;
private bool _showStrengthPresevedBar = false;
private XEntity _strengthPresevedEntity = null;
private List<BattleLine> _BattleLines = new List<BattleLine>();
private static string LINEFX = "Effects/FX_Particle/Roles/Lzg_Ty/shuangren_xian";
public List<XTeamBloodUIData> LeftTeamMonitorData = new List<XTeamBloodUIData>();
public List<XTeamBloodUIData> RightTeamMonitorData = new List<XTeamBloodUIData>();
public Dictionary<ulong, bool> IsBlueTeamDict = new Dictionary<ulong, bool>();
public HashSet<ulong> UnInitRoleList = new HashSet<ulong>();
public ulong BlueSaveID = 0UL;
public ulong RedSaveID = 0UL;
public uint BlueFightGroup = uint.MaxValue;
public uint RedFightGroup = uint.MaxValue;
public int WatchNum = 0;
public int CommendNum = 0;
public int WatchTarget;
public int CommendTarget;
public static XTableAsyncLoader AsyncLoader = new XTableAsyncLoader();
private static LiveTable _liveConfigTable = new LiveTable();
private float LastLevelSceneTime = 0f;
public OneLiveRecordInfo liveRecordInfo;
public static void Execute(OnLoadedCallback callback = null)
{
XSpectateSceneDocument.AsyncLoader.AddTask("Table/LiveTable", XSpectateSceneDocument._liveConfigTable, false);
XSpectateSceneDocument.AsyncLoader.Execute(callback);
}
public override void OnAttachToHost(XObject host)
{
base.OnAttachToHost(host);
this.ShowTeamMemberDamageHUD = (XSingleton<XGlobalConfig>.singleton.GetInt("ShowTeamMemberDamageHUD") == 1);
}
public void GetTargetNum(bool isBattle = false)
{
LiveTable.RowData rowData;
if (isBattle)
{
rowData = XSpectateSceneDocument._liveConfigTable.Table[0];
}
else
{
rowData = XSpectateSceneDocument._liveConfigTable.GetBySceneType(XFastEnumIntEqualityComparer<SceneType>.ToInt(XSingleton<XScene>.singleton.SceneType));
}
bool flag = rowData != null;
if (flag)
{
this.WatchTarget = rowData.ShowWatch;
this.CommendTarget = rowData.ShowPraise;
}
else
{
XSingleton<XDebug>.singleton.AddErrorLog("Can't find liveConfigTable by Scenetype. Scenetype = ", XFastEnumIntEqualityComparer<SceneType>.ToInt(XSingleton<XScene>.singleton.SceneType).ToString(), null, null, null, null);
}
}
public override void OnEnterScene()
{
base.OnEnterScene();
this._BattleLines.Clear();
}
public override void OnEnterSceneFinally()
{
}
protected override void OnReconnected(XReconnectedEventArgs arg)
{
bool flag = this._view != null && this._view.IsLoaded() && this._view.IsVisible();
if (flag)
{
this.SendCheckTime();
}
}
protected override void EventSubscribe()
{
base.EventSubscribe();
base.RegisterEvent(XEventDefine.XEvent_ArmorRecover, new XComponent.XEventHandler(this.OnArmorRecover));
base.RegisterEvent(XEventDefine.XEvent_ArmorBroken, new XComponent.XEventHandler(this.OnArmorBroken));
base.RegisterEvent(XEventDefine.XEvent_WoozyOn, new XComponent.XEventHandler(this.OnWoozyOn));
base.RegisterEvent(XEventDefine.XEvent_WoozyOff, new XComponent.XEventHandler(this.OnWoozyOff));
base.RegisterEvent(XEventDefine.XEvent_StrengthPresevedOn, new XComponent.XEventHandler(this.OnStrengthPresevedOn));
base.RegisterEvent(XEventDefine.XEvent_StrengthPresevedOff, new XComponent.XEventHandler(this.OnStrengthPresevedOff));
base.RegisterEvent(XEventDefine.XEvent_ProjectDamage, new XComponent.XEventHandler(this.OnProjectDamage));
base.RegisterEvent(XEventDefine.XEvent_BuffChange, new XComponent.XEventHandler(this.OnBuffChange));
base.RegisterEvent(XEventDefine.XEvent_OnEntityCreated, new XComponent.XEventHandler(this.OnEntityCreate));
base.RegisterEvent(XEventDefine.XEvent_OnEntityDeleted, new XComponent.XEventHandler(this.OnEntityDelete));
}
public override void OnLeaveScene()
{
base.OnLeaveScene();
bool bSpectator = XSingleton<XScene>.singleton.bSpectator;
if (bSpectator)
{
this.UnInitRoleList.Clear();
this.BlueFightGroup = uint.MaxValue;
this.RedFightGroup = uint.MaxValue;
}
}
public bool TryGetSummonedIsBlueTeam(XEntity entity, out bool isBlueTeam)
{
isBlueTeam = true;
XEntity entityConsiderDeath = XSingleton<XEntityMgr>.singleton.GetEntityConsiderDeath(entity.Attributes.HostID);
bool flag = XEntity.ValideEntity(entityConsiderDeath);
bool result;
if (flag)
{
result = this.TryGetEntityIsBlueTeam(entityConsiderDeath, out isBlueTeam);
}
else
{
XSingleton<XDebug>.singleton.AddGreenLog("Set Summoned billboard on spectator mode, but master invalide. try get team by fight group.", null, null, null, null, null);
bool flag2 = entity.Attributes == null;
if (flag2)
{
result = false;
}
else
{
bool flag3 = this.BlueFightGroup != uint.MaxValue;
if (flag3)
{
isBlueTeam = (entity.Attributes.FightGroup == this.BlueFightGroup);
result = true;
}
else
{
bool flag4 = this.RedFightGroup != uint.MaxValue;
if (flag4)
{
isBlueTeam = (entity.Attributes.FightGroup != this.RedFightGroup);
result = true;
}
else
{
result = false;
}
}
}
}
return result;
}
public bool TryGetTeam(XEntity entity, out bool isBlueTeam)
{
isBlueTeam = true;
SceneType sceneType = XSingleton<XScene>.singleton.SceneType;
if (sceneType <= SceneType.SCENE_GPR)
{
if (sceneType != SceneType.SCENE_GMF && sceneType != SceneType.SCENE_GPR)
{
goto IL_BF;
}
}
else if (sceneType != SceneType.SCENE_LEAGUE_BATTLE && sceneType != SceneType.SCENE_GCF)
{
goto IL_BF;
}
XTeamLeagueBattleDocument specificDocument = XDocuments.GetSpecificDocument<XTeamLeagueBattleDocument>(XTeamLeagueBattleDocument.uuID);
bool flag = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_LEAGUE_BATTLE;
ulong num;
if (flag)
{
num = specificDocument.GetBattleTeamLeagueID(entity.Attributes.RoleID);
}
else
{
num = (entity.Attributes as XRoleAttributes).GuildID;
}
bool flag2 = num == this.BlueSaveID || num == this.RedSaveID;
if (flag2)
{
isBlueTeam = (num == this.BlueSaveID);
this.IsBlueTeamDict[entity.Attributes.RoleID] = isBlueTeam;
return true;
}
return false;
IL_BF:
return this.IsBlueTeamDict.TryGetValue(entity.Attributes.RoleID, out isBlueTeam);
}
public bool TryGetEntityIsBlueTeam(XEntity entity, out bool isBlueTeam)
{
isBlueTeam = true;
bool flag = entity.Attributes == null;
bool result;
if (flag)
{
result = false;
}
else
{
bool flag2 = !this.TryGetTeam(entity, out isBlueTeam);
if (flag2)
{
bool flag3 = !this.UnInitRoleList.Contains(entity.Attributes.RoleID);
if (flag3)
{
this.UnInitRoleList.Add(entity.Attributes.RoleID);
}
XSingleton<XDebug>.singleton.AddLog("Can't find this player's TeamMsg, Maybe scene is end. ID = ", entity.ID.ToString(), " Name = ", entity.Name, " Scene = ", XSingleton<XScene>.singleton.SceneType.ToString(), XDebugColor.XDebug_None);
result = false;
}
else
{
bool flag4 = isBlueTeam;
if (flag4)
{
this.BlueFightGroup = entity.Attributes.FightGroup;
}
else
{
this.RedFightGroup = entity.Attributes.FightGroup;
}
result = true;
}
}
return result;
}
public void DealWithTeamMessage(OneLiveRecordInfo data)
{
XSingleton<XDebug>.singleton.AddLog("Get TeamMonitor Data In Spectator Mode.", null, null, null, null, null, XDebugColor.XDebug_None);
this.liveRecordInfo = data;
bool flag = DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.SpectateTeamMonitor != null;
if (flag)
{
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.SpectateTeamMonitor.OnLeftTeamInfoChanged(true, this.LeftTeamMonitorData);
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.SpectateTeamMonitor.OnLeftTeamInfoChanged(false, this.RightTeamMonitorData);
}
this.IsBlueTeamDict.Clear();
bool flag2 = data.liveType == LiveType.LIVE_GUILDBATTLE || data.liveType == LiveType.LIVE_CROSSGVG;
if (flag2)
{
XGuildDocument specificDocument = XDocuments.GetSpecificDocument<XGuildDocument>(XGuildDocument.uuID);
bool flag3 = specificDocument.bInGuild && specificDocument.BasicData.guildName.Equals(data.nameInfos[1].guildName);
if (flag3)
{
this.BlueSaveID = data.nameInfos[1].guildID;
this.RedSaveID = data.nameInfos[0].guildID;
}
else
{
this.BlueSaveID = data.nameInfos[0].guildID;
this.RedSaveID = data.nameInfos[1].guildID;
}
}
else
{
bool flag4 = data.liveType == LiveType.LIVE_LEAGUEBATTLE;
if (flag4)
{
XFreeTeamVersusLeagueDocument specificDocument2 = XDocuments.GetSpecificDocument<XFreeTeamVersusLeagueDocument>(XFreeTeamVersusLeagueDocument.uuID);
bool flag5 = specificDocument2.TeamLeagueID == data.nameInfos[1].leagueID;
if (flag5)
{
this.BlueSaveID = data.nameInfos[1].leagueID;
this.RedSaveID = data.nameInfos[0].leagueID;
}
else
{
this.BlueSaveID = data.nameInfos[0].leagueID;
this.RedSaveID = data.nameInfos[1].leagueID;
}
}
else
{
XHeroBattleDocument specificDocument3 = XDocuments.GetSpecificDocument<XHeroBattleDocument>(XHeroBattleDocument.uuID);
bool flag6 = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_HEROBATTLE;
if (flag6)
{
specificDocument3.SpectateUid = 0UL;
}
for (int i = 0; i < data.nameInfos.Count; i++)
{
this.IsBlueTeamDict[data.nameInfos[i].roleInfo.roleID] = data.nameInfos[i].isLeft;
bool flag7 = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_HEROBATTLE && data.nameInfos[i].isLeft && specificDocument3.SpectateUid == 0UL;
if (flag7)
{
specificDocument3.SpectateUid = data.nameInfos[i].roleInfo.roleID;
}
}
}
}
bool flag8 = this.UnInitRoleList.Count != 0;
if (flag8)
{
XSingleton<XDebug>.singleton.AddGreenLog("deal with un init role on spectate msg, cout = ", this.UnInitRoleList.Count.ToString(), null, null, null, null);
foreach (ulong id in this.UnInitRoleList)
{
XEntity entityConsiderDeath = XSingleton<XEntityMgr>.singleton.GetEntityConsiderDeath(id);
bool flag9 = entityConsiderDeath != null;
if (flag9)
{
this.DealWithUnitAppear(entityConsiderDeath);
bool flag10 = entityConsiderDeath.BillBoard != null;
if (flag10)
{
entityConsiderDeath.BillBoard.Refresh();
}
bool flag11 = DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IndicateHandler != null;
if (flag11)
{
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IndicateHandler.ResetMiniMapElement(id);
}
}
}
}
}
public void DealWithUnitAppear(XEntity entity)
{
bool flag = !entity.IsRole;
if (!flag)
{
bool flag2 = !DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IsLoaded();
if (!flag2)
{
for (int i = 0; i < this.LeftTeamMonitorData.Count; i++)
{
bool flag3 = this.LeftTeamMonitorData[i].uid == entity.Attributes.RoleID;
if (flag3)
{
return;
}
}
for (int j = 0; j < this.RightTeamMonitorData.Count; j++)
{
bool flag4 = this.RightTeamMonitorData[j].uid == entity.Attributes.RoleID;
if (flag4)
{
return;
}
}
XSingleton<XDebug>.singleton.AddLog("DealWithUnitAppear ID = ", entity.Attributes.RoleID.ToString(), null, null, null, null, XDebugColor.XDebug_None);
bool flag5 = true;
bool flag6 = !this.TryGetEntityIsBlueTeam(entity, out flag5);
if (!flag6)
{
XTeamBloodUIData xteamBloodUIData = new XTeamBloodUIData();
xteamBloodUIData.uid = entity.Attributes.RoleID;
xteamBloodUIData.entityID = entity.Attributes.RoleID;
xteamBloodUIData.level = entity.Attributes.Level;
xteamBloodUIData.name = entity.Attributes.Name;
xteamBloodUIData.profession = (RoleType)entity.Attributes.TypeID;
xteamBloodUIData.bIsLeader = false;
xteamBloodUIData.isLeft = flag5;
bool flag7 = flag5;
if (flag7)
{
this.LeftTeamMonitorData.Add(xteamBloodUIData);
bool flag8 = this.LeftTeamMonitorData.Count == 1;
if (flag8)
{
XSingleton<XEntityMgr>.singleton.Player.WatchIt(entity as XRole);
}
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.SpectateTeamMonitor.OnLeftTeamInfoChanged(true, this.LeftTeamMonitorData);
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.SpectateTeamMonitor.OnLeftTeamInfoChanged(false, this.RightTeamMonitorData);
}
else
{
this.RightTeamMonitorData.Add(xteamBloodUIData);
bool flag9 = this.LeftTeamMonitorData.Count == 0;
if (flag9)
{
XSingleton<XEntityMgr>.singleton.Player.WatchIt(entity as XRole);
}
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.SpectateTeamMonitor.OnLeftTeamInfoChanged(true, this.LeftTeamMonitorData);
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.SpectateTeamMonitor.OnLeftTeamInfoChanged(false, this.RightTeamMonitorData);
}
}
}
}
}
public void DealWithUnitDisAppear(ulong roleID)
{
bool flag = !DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IsLoaded();
if (!flag)
{
bool flag2 = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_GMF || XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_GPR || XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_LEAGUE_BATTLE;
if (flag2)
{
this.DeleteMonitorByRoleID(roleID);
}
else
{
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.SpectateTeamMonitor.OnTeamInfoChanged();
}
this.ChangeSpectateWhenWatchNull();
}
}
public void DeleteMonitorByRoleID(ulong roleID)
{
XSingleton<XDebug>.singleton.AddLog("GuildArena DeleteMonitorByRoleID ID = ", roleID.ToString(), null, null, null, null, XDebugColor.XDebug_None);
for (int i = 0; i < this.LeftTeamMonitorData.Count; i++)
{
bool flag = this.LeftTeamMonitorData[i].uid == roleID;
if (flag)
{
this.LeftTeamMonitorData.RemoveAt(i);
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.SpectateTeamMonitor.OnLeftTeamInfoChanged(true, this.LeftTeamMonitorData);
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.SpectateTeamMonitor.OnLeftTeamInfoChanged(false, this.RightTeamMonitorData);
return;
}
}
for (int j = 0; j < this.RightTeamMonitorData.Count; j++)
{
bool flag2 = this.RightTeamMonitorData[j].uid == roleID;
if (flag2)
{
this.RightTeamMonitorData.RemoveAt(j);
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.SpectateTeamMonitor.OnLeftTeamInfoChanged(true, this.LeftTeamMonitorData);
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.SpectateTeamMonitor.OnLeftTeamInfoChanged(false, this.RightTeamMonitorData);
return;
}
}
XSingleton<XDebug>.singleton.AddLog("Delete Monitor in Spectate Mode fail. MayBe isn't a role. ID = ", roleID.ToString(), null, null, null, null, XDebugColor.XDebug_None);
}
private void ChangeSpectateWhenWatchNull()
{
bool flag = XSingleton<XEntityMgr>.singleton.Player != null && XSingleton<XEntityMgr>.singleton.Player.WatchTo == null;
if (flag)
{
for (int i = 0; i < this.LeftTeamMonitorData.Count; i++)
{
XEntity entityConsiderDeath = XSingleton<XEntityMgr>.singleton.GetEntityConsiderDeath(this.LeftTeamMonitorData[i].uid);
bool flag2 = entityConsiderDeath != null && entityConsiderDeath.IsRole;
if (flag2)
{
XSingleton<XEntityMgr>.singleton.Player.WatchIt(entityConsiderDeath as XRole);
return;
}
}
for (int j = 0; j < this.RightTeamMonitorData.Count; j++)
{
XEntity entityConsiderDeath2 = XSingleton<XEntityMgr>.singleton.GetEntityConsiderDeath(this.RightTeamMonitorData[j].uid);
bool flag3 = entityConsiderDeath2 != null && entityConsiderDeath2.IsRole;
if (flag3)
{
XSingleton<XEntityMgr>.singleton.Player.WatchIt(entityConsiderDeath2 as XRole);
return;
}
}
XSingleton<XDebug>.singleton.AddLog("Scene have not player. watch null.", null, null, null, null, null, XDebugColor.XDebug_None);
}
}
protected bool OnProjectDamage(XEventArgs args)
{
bool flag = this._view == null || !this._view.IsVisible();
bool result;
if (flag)
{
result = false;
}
else
{
XProjectDamageEventArgs xprojectDamageEventArgs = args as XProjectDamageEventArgs;
this._view.OnProjectDamage(xprojectDamageEventArgs.Damage, xprojectDamageEventArgs.Receiver);
result = true;
}
return result;
}
protected bool OnArmorRecover(XEventArgs args)
{
XArmorRecoverArgs xarmorRecoverArgs = args as XArmorRecoverArgs;
XEntity self = xarmorRecoverArgs.Self;
bool flag = this._view == null;
bool result;
if (flag)
{
result = false;
}
else
{
this._view.OnPlaySuperarmorFx(self, false);
this._view.SetupSpeedFx(self, false, Color.white);
result = true;
}
return result;
}
protected bool OnArmorBroken(XEventArgs args)
{
XArmorBrokenArgs xarmorBrokenArgs = args as XArmorBrokenArgs;
XEntity self = xarmorBrokenArgs.Self;
bool flag = this._view == null;
bool result;
if (flag)
{
result = false;
}
else
{
this._view.OnPlaySuperarmorFx(self, true);
this._view.SetupSpeedFx(self, false, Color.white);
result = true;
}
return result;
}
protected bool OnWoozyOn(XEventArgs args)
{
XWoozyOnArgs xwoozyOnArgs = args as XWoozyOnArgs;
bool flag = this._view == null;
bool result;
if (flag)
{
result = false;
}
else
{
this._view.OnStopSuperarmorFx(xwoozyOnArgs.Self);
result = true;
}
return result;
}
protected bool OnWoozyOff(XEventArgs args)
{
XWoozyOffArgs xwoozyOffArgs = args as XWoozyOffArgs;
bool flag = this._view == null;
bool result;
if (flag)
{
result = false;
}
else
{
this._view.OnStopSuperarmorFx(xwoozyOffArgs.Self);
result = true;
}
return result;
}
protected bool OnStrengthPresevedOn(XEventArgs args)
{
this._showStrengthPresevedBar = true;
XStrengthPresevationOnArgs xstrengthPresevationOnArgs = args as XStrengthPresevationOnArgs;
this._strengthPresevedEntity = xstrengthPresevationOnArgs.Host;
bool flag = this._view == null;
bool result;
if (flag)
{
result = false;
}
else
{
this._view.ShowStrengthPresevedBar(xstrengthPresevationOnArgs.Host);
result = true;
}
return result;
}
protected bool OnStrengthPresevedOff(XEventArgs args)
{
XStrengthPresevationOffArgs xstrengthPresevationOffArgs = args as XStrengthPresevationOffArgs;
bool flag = !this._showStrengthPresevedBar;
bool result;
if (flag)
{
result = false;
}
else
{
bool flag2 = this._strengthPresevedEntity == null;
if (flag2)
{
result = false;
}
else
{
this._showStrengthPresevedBar = false;
this._strengthPresevedEntity = null;
bool flag3 = this._view == null;
if (flag3)
{
result = false;
}
else
{
this._view.HideStrengthPresevedBar();
this._view.StopNotice();
result = true;
}
}
}
return result;
}
protected bool OnBuffChange(XEventArgs args)
{
XBuffChangeEventArgs xbuffChangeEventArgs = args as XBuffChangeEventArgs;
this.OnBuffChange(xbuffChangeEventArgs.entity);
return true;
}
protected void OnBuffChange(XEntity entity)
{
bool flag = entity == null || !DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IsLoaded();
if (!flag)
{
bool isRole = entity.IsRole;
if (isRole)
{
XBuffComponent buffs = entity.Buffs;
bool flag2 = buffs != null;
if (flag2)
{
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.SpectateTeamMonitor.m_TeamMonitor_Left.OnTeamMemberBuffChange(entity.ID, buffs.GetUIBuffList());
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.SpectateTeamMonitor.m_TeamMonitor_Right.OnTeamMemberBuffChange(entity.ID, buffs.GetUIBuffList());
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.EnemyInfoHandler.OnBuffChange(entity.ID);
}
}
else
{
bool isBoss = entity.IsBoss;
if (isBoss)
{
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.EnemyInfoHandler.OnBuffChange(entity.ID);
}
}
}
}
public bool CheckBindQTE()
{
List<uint> buffList = XSingleton<XEntityMgr>.singleton.Player.Buffs.GetBuffList();
string[] array = XSingleton<XGlobalConfig>.singleton.GetValue("BindBuffID").Split(XGlobalConfig.ListSeparator);
for (int i = 0; i < buffList.Count; i++)
{
for (int j = 0; j < array.Length; j++)
{
bool flag = buffList[i] == uint.Parse(array[j]);
if (flag)
{
this._currentBuffID = buffList[i];
return true;
}
}
}
this._currentBuffID = 0u;
return false;
}
public void LineStateChange(ulong e1, ulong e2, bool on)
{
BattleLine battleLine = this.FindBattleLine(e1, e2);
if (on)
{
bool flag = battleLine == null;
if (flag)
{
BattleLine battleLine2 = new BattleLine();
battleLine2.e1 = e1;
battleLine2.e2 = e2;
this._BattleLines.Add(battleLine2);
battleLine = battleLine2;
}
battleLine.xe1 = XSingleton<XEntityMgr>.singleton.GetEntity(e1);
battleLine.xe2 = XSingleton<XEntityMgr>.singleton.GetEntity(e2);
battleLine.fx = XSingleton<XFxMgr>.singleton.CreateFx(XSpectateSceneDocument.LINEFX, null, true);
Vector3 position = (battleLine.xe1.EngineObject.Position + battleLine.xe2.EngineObject.Position) / 2f + new Vector3(0f, battleLine.xe1.Height / 2f, 0f);
Quaternion rotation = Quaternion.FromToRotation(battleLine.xe1.EngineObject.Position - battleLine.xe2.EngineObject.Position, Vector3.right);
battleLine.fx.Play(position, rotation, Vector3.one, 1f);
}
else
{
bool flag2 = battleLine != null;
if (flag2)
{
this._BattleLines.Remove(battleLine);
XSingleton<XFxMgr>.singleton.DestroyFx(battleLine.fx, true);
}
}
}
public void RefreshTowerSceneInfo(PtcG2C_TowerSceneInfoNtf infoNtf)
{
XExpeditionDocument specificDocument = XDocuments.GetSpecificDocument<XExpeditionDocument>(XExpeditionDocument.uuID);
ExpeditionTable.RowData expeditionDataByID = specificDocument.GetExpeditionDataByID(specificDocument.ExpeditionId);
uint randomID = expeditionDataByID.RandomSceneIDs[infoNtf.Data.curTowerFloor - 1];
List<uint> randomSceneList = specificDocument.GetRandomSceneList(randomID);
bool flag = randomSceneList.Count > 0;
if (flag)
{
SceneTable.RowData sceneData = XSingleton<XSceneMgr>.singleton.GetSceneData(randomSceneList[0]);
string file = sceneData.configFile + "_sc";
XSingleton<XLevelScriptMgr>.singleton.PreloadLevelScript(file);
}
}
protected BattleLine FindBattleLine(ulong e1, ulong e2)
{
for (int i = 0; i < this._BattleLines.Count; i++)
{
bool flag = (e1 == this._BattleLines[i].e1 && e2 == this._BattleLines[i].e2) || (e1 == this._BattleLines[i].e2 && e2 == this._BattleLines[i].e1);
if (flag)
{
return this._BattleLines[i];
}
}
return null;
}
private bool OnEntityCreate(XEventArgs args)
{
XOnEntityCreatedArgs xonEntityCreatedArgs = args as XOnEntityCreatedArgs;
this.DealWithUnitAppear(xonEntityCreatedArgs.entity);
this.MiniMapAdd(xonEntityCreatedArgs.entity);
return true;
}
private bool OnEntityDelete(XEventArgs args)
{
XOnEntityDeletedArgs xonEntityDeletedArgs = args as XOnEntityDeletedArgs;
this.MiniMapDel(xonEntityDeletedArgs.Id);
this.DealWithUnitDisAppear(xonEntityDeletedArgs.Id);
return true;
}
private void MiniMapAdd(XEntity e)
{
bool flag = DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IsLoaded();
if (flag)
{
bool flag2 = DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IndicateHandler != null;
if (flag2)
{
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IndicateHandler.MiniMapAdd(e);
}
}
}
private void MiniMapDel(ulong uid)
{
bool flag = DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IsLoaded();
if (flag)
{
bool flag2 = DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IndicateHandler != null;
if (flag2)
{
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IndicateHandler.MiniMapDel(uid);
}
}
}
public static void SetMiniMapElement(ulong id, string spriteName, int width, int height)
{
bool flag = DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IsLoaded();
if (flag)
{
bool flag2 = DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IndicateHandler != null;
if (flag2)
{
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IndicateHandler.SetMiniMapElement(id, spriteName, width, height);
}
}
}
public static void ResetMiniMapElement(ulong id)
{
bool flag = DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IsLoaded();
if (flag)
{
bool flag2 = DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IndicateHandler != null;
if (flag2)
{
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IndicateHandler.ResetMiniMapElement(id);
}
}
}
public override void Update(float fDeltaT)
{
base.Update(fDeltaT);
for (int i = 0; i < this._BattleLines.Count; i++)
{
this._BattleLines[i].fx.Position = (this._BattleLines[i].xe1.EngineObject.Position + this._BattleLines[i].xe2.EngineObject.Position) / 2f + new Vector3(0f, this._BattleLines[i].xe1.Height / 2f, 0f);
this._BattleLines[i].fx.Rotation = Quaternion.FromToRotation(this._BattleLines[i].xe1.EngineObject.Position - this._BattleLines[i].xe2.EngineObject.Position, Vector3.right);
}
}
public void SendCommendBtnClick()
{
RpcC2G_CommendWatchBattle rpc = new RpcC2G_CommendWatchBattle();
XSingleton<XClientNetwork>.singleton.Send(rpc);
}
public void LevelScene()
{
bool flag = Time.time - this.LastLevelSceneTime < 5f;
if (!flag)
{
this.LastLevelSceneTime = Time.time;
XSingleton<XScene>.singleton.ReqLeaveScene();
}
}
public static bool WhetherWathchNumShow(int watchNum, int commendNum, int sceneType)
{
LiveTable.RowData bySceneType = XSpectateSceneDocument._liveConfigTable.GetBySceneType(sceneType);
bool flag = bySceneType == null;
bool result;
if (flag)
{
result = false;
}
else
{
bool flag2 = watchNum >= bySceneType.ShowWatch || commendNum >= bySceneType.ShowPraise;
result = flag2;
}
return result;
}
public void CommendClickSuccess()
{
bool flag = DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IsVisible() && DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.SpectateHandler != null;
if (flag)
{
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.SpectateHandler.CommendSuccess();
}
}
public static void SetMiniMapSize(Vector2 size, float scale = 0f)
{
bool flag = DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IsLoaded();
if (flag)
{
bool flag2 = DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IndicateHandler != null;
if (flag2)
{
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IndicateHandler.SetMiniMapSize(size, scale);
}
}
}
public static uint AddMiniMapFx(Vector3 pos, string fx)
{
bool flag = DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IsLoaded();
if (flag)
{
bool flag2 = DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IndicateHandler != null;
if (flag2)
{
return DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IndicateHandler.MiniMapFxAdd(pos, fx);
}
}
return 0u;
}
public static void DelMiniMapFx(uint token)
{
bool flag = DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IsLoaded();
if (flag)
{
bool flag2 = DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IndicateHandler != null;
if (flag2)
{
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IndicateHandler.MiniMapFxDel(token);
}
}
}
public static uint AddMiniMapPic(Vector3 pos, string fx)
{
bool flag = DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IsLoaded();
if (flag)
{
bool flag2 = DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IndicateHandler != null;
if (flag2)
{
return DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IndicateHandler.MiniMapPicAdd(pos, fx);
}
}
return 0u;
}
public static void DelMiniMapPic(uint token)
{
bool flag = DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IsLoaded();
if (flag)
{
bool flag2 = DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IndicateHandler != null;
if (flag2)
{
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IndicateHandler.MiniMapPicDel(token);
}
}
}
public void SendCheckTime()
{
bool sceneStarted = XSingleton<XScene>.singleton.SceneStarted;
if (sceneStarted)
{
RpcC2G_QuerySceneTime rpc = new RpcC2G_QuerySceneTime();
XSingleton<XClientNetwork>.singleton.Send(rpc);
}
}
public void ResetSceneTime(int time)
{
bool flag = !DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IsVisible();
if (!flag)
{
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.ResetLeftTime(time);
}
}
public void ChangeSpectator(XRole role)
{
bool flag = DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IsLoaded();
if (flag)
{
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IndicateHandler.ChangeWatchToEntity(role);
bool flag2 = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_PVP;
if (flag2)
{
XBattleCaptainPVPDocument specificDocument = XDocuments.GetSpecificDocument<XBattleCaptainPVPDocument>(XBattleCaptainPVPDocument.uuID);
bool flag3 = specificDocument.spectateInitTeam == 0;
if (flag3)
{
specificDocument.ReqBattleCaptainPVPRefreshInfo(true);
}
else
{
bool flag4 = this.IsBlueTeamDict[role.ID];
if (flag4)
{
specificDocument.spectateNowTeam = 1;
}
else
{
specificDocument.spectateNowTeam = 2;
}
}
}
}
}
}
}
|