summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/Guild/XGuildTerritoryDocument.cs
blob: 897ec27df4f5cfd79ee6b8c0e4b90c70e63fa7f5 (plain)
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
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
using System;
using System.Collections.Generic;
using System.Text;
using KKSG;
using UILib;
using UnityEngine;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient
{
	internal class XGuildTerritoryDocument : XDocComponent
	{
		public override uint ID
		{
			get
			{
				return XGuildTerritoryDocument.uuID;
			}
		}

		public uint bHavaTerritoryRecCount
		{
			get
			{
				return this.mHaveTerritoryCount;
			}
			set
			{
				this.mHaveTerritoryCount = value;
				DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.RefreshH5ButtonState(XSysDefine.XSys_GuildTerritoryAllianceInterface, true);
			}
		}

		public XGuildTerritoryDocument.GuildTerritoryStyle TerritoryStyle
		{
			get
			{
				return this.mCurTerritoryStyle;
			}
			set
			{
				this.mCurTerritoryStyle = value;
				DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.RefreshH5ButtonState(XSysDefine.XSys_GuildTerritoryIconInterface, true);
				this.RefreshGuildTerritoryInfo();
			}
		}

		public bool bHavaShowMessageIcon
		{
			get
			{
				return this.mShowMessageIcon;
			}
			set
			{
				this.mShowMessageIcon = value;
				DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.RefreshH5ButtonState(XSysDefine.XSys_GuildTerritoryMessageInterface, true);
			}
		}

		public List<GuildTerrChallInfo> GuildTerrChallList
		{
			get
			{
				return this.mGuildTerrChall;
			}
		}

		public List<CityData> CityDataList
		{
			get
			{
				return this.mCityDataList;
			}
		}

		public List<GuildTerritoryAllianceInfo> GuildTerrAllianceInfos
		{
			get
			{
				return this.mGuildTerritoryAllianceList;
			}
		}

		public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("XGuildTerritoryDocument");

		public static readonly uint GAME_INFO = 1u;

		public static XTableAsyncLoader AsyncLoader = new XTableAsyncLoader();

		private static FightDesignation mGuildDestination = new FightDesignation();

		public static GuildTransfer mGuildTransfer = new GuildTransfer();

		public static TerritoryBattle mGuildTerritoryList = new TerritoryBattle();

		public static TerritoryRewd mTerritoryRewd = new TerritoryRewd();

		public XFx[] fxJvDians = new XFx[9];

		public Vector3[] fxJvPos = new Vector3[3];

		private float lastShowInfoTime;

		public Queue<XBattleCaptainPVPDocument.KillInfo> qInfo = new Queue<XBattleCaptainPVPDocument.KillInfo>();

		public uint mapid = 0u;

		public List<GCFJvDianInfo> jvdians = new List<GCFJvDianInfo>();

		public List<GCFGuild> guilds = new List<GCFGuild>();

		public List<GCFRoleBrief> roles = new List<GCFRoleBrief>();

		public List<GCFBattleField> fields = new List<GCFBattleField>();

		public List<ItemBrief> rwds = new List<ItemBrief>();

		public GCFRoleBrief mmyinfo = new GCFRoleBrief();

		public uint feats = 0u;

		public GCFGuildBrief winguild;

		public uint ready_lefttime = 0u;

		public uint fight_lefttime = 0u;

		public uint territoryid = 0u;

		public bool myPostion = true;

		private uint[] maptoken = new uint[3];

		private string[] fxs = new string[]
		{
			"Effects/FX_Particle/UIfx/UI_xdtts_white",
			"Effects/FX_Particle/UIfx/UI_xdtts_bule",
			"Effects/FX_Particle/UIfx/UI_xdtts_red"
		};

		private Dictionary<uint, CityData> mCityDataDic = new Dictionary<uint, CityData>();

		private List<CityData> mCityDataList = new List<CityData>();

		private List<GuildTerrChallInfo> mGuildTerrChall = new List<GuildTerrChallInfo>();

		private List<GuildTerritoryAllianceInfo> mGuildTerritoryAllianceList = new List<GuildTerritoryAllianceInfo>();

		private uint mHaveTerritoryCount = 0u;

		private XGuildTerritoryDocument.GuildTerritoryStyle mCurTerritoryStyle = XGuildTerritoryDocument.GuildTerritoryStyle.NONE;

		public ulong Allianceid = 0UL;

		public GUILDTERRTYPE CurrentType = GUILDTERRTYPE.TERR_NOT_OPEN;

		public uint SelfGuildTerritoryID = 0u;

		public uint SelfTargetTerritoryID = 0u;

		public List<GuildTerrAllianceInfo> guildAllianceInfos;

		public bool mShowMessage = true;

		public bool mShowMessageIcon = false;

		public ulong SelfAllianceID = 0UL;

		public uint CurrentTerritoryID = 0u;

		public uint EnterBattleTime = 0u;

		public enum GuildTerritoryStyle
		{
			NONE,
			INFORM,
			ACTIVITY
		}

		protected override void OnReconnected(XReconnectedEventArgs arg)
		{
			bool flag = DlgBase<GuildTerritoryReportDlg, GuildTerritoryBahaviour>.singleton.IsVisible();
			if (flag)
			{
				this.SendGCFCommonReq(GCFReqType.GCF_FIGHT_REPORT);
			}
		}

		public static void Execute(OnLoadedCallback callback = null)
		{
			XGuildTerritoryDocument.AsyncLoader.AddTask("Table/TerritoryBattleDesignation", XGuildTerritoryDocument.mGuildDestination, false);
			XGuildTerritoryDocument.AsyncLoader.AddTask("Table/TerritoryBattleTransfer", XGuildTerritoryDocument.mGuildTransfer, false);
			XGuildTerritoryDocument.AsyncLoader.AddTask("Table/territorybattle", XGuildTerritoryDocument.mGuildTerritoryList, false);
			XGuildTerritoryDocument.AsyncLoader.AddTask("Table/TerritoryRewd", XGuildTerritoryDocument.mTerritoryRewd, false);
			XGuildTerritoryDocument.AsyncLoader.Execute(callback);
		}

		public static void OnLoadcallback()
		{
		}

		public override void OnEnterScene()
		{
			base.OnEnterScene();
			bool flag = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_HALL;
			if (flag)
			{
				GuildMiniReportHandler.msgs.Clear();
			}
			bool flag2 = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_CASTLE_WAIT;
			if (flag2)
			{
				XSingleton<GuildPassMgr>.singleton.InitBoard();
			}
			bool flag3 = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_CASTLE_FIGHT;
			if (flag3)
			{
				for (int i = 0; i < this.fxJvDians.Length; i++)
				{
					bool flag4 = i % 3 == 0;
					if (flag4)
					{
						this.fxJvDians[i] = XSingleton<XFxMgr>.singleton.CreateFx("Effects/FX_Particle/Roles/Lzg_Ty/Ty_ldzd_fanwei_grey", null, true);
					}
					else
					{
						bool flag5 = i % 3 == 1;
						if (flag5)
						{
							this.fxJvDians[i] = XSingleton<XFxMgr>.singleton.CreateFx("Effects/FX_Particle/Roles/Lzg_Ty/Ty_ldzd_fanwei_red", null, true);
						}
						else
						{
							this.fxJvDians[i] = XSingleton<XFxMgr>.singleton.CreateFx("Effects/FX_Particle/Roles/Lzg_Ty/Ty_ldzd_fanwei_blue", null, true);
						}
					}
					bool flag6 = i / 3 == 0;
					if (flag6)
					{
						List<float> floatList = XSingleton<XGlobalConfig>.singleton.GetFloatList("GuildTerritoryUpPos");
						Vector3 vector;
						vector= new Vector3(floatList[0], floatList[1], floatList[2]);
						float num = float.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("TerritoryBattleUpRadius")) * float.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("TerritoryBattleClientRadiusK"));
						this.fxJvDians[i].Play(vector, Quaternion.identity, new Vector3(num, 1f, num), 1f);
						this.fxJvPos[0] = vector;
					}
					else
					{
						bool flag7 = i / 3 == 1;
						if (flag7)
						{
							List<float> floatList2 = XSingleton<XGlobalConfig>.singleton.GetFloatList("GuildTerritoryMidPos");
							Vector3 vector2;
							vector2= new Vector3(floatList2[0], floatList2[1], floatList2[2]);
							float num2 = float.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("TerritoryBattleMidRadius")) * float.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("TerritoryBattleClientRadiusK"));
							this.fxJvDians[i].Play(vector2, Quaternion.identity, new Vector3(num2, 1f, num2), 1f);
							this.fxJvPos[1] = vector2;
						}
						else
						{
							List<float> floatList3 = XSingleton<XGlobalConfig>.singleton.GetFloatList("GuildTerritoryBtmPos");
							Vector3 vector3;
							vector3= new Vector3(floatList3[0], floatList3[1], floatList3[2]);
							float num3 = float.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("TerritoryBattleBtmRadius")) * float.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("TerritoryBattleClientRadiusK"));
							this.fxJvDians[i].Play(vector3, Quaternion.identity, new Vector3(num3, 1f, num3), 1f);
							this.fxJvPos[2] = vector3;
						}
					}
				}
			}
		}

		public override void OnEnterSceneFinally()
		{
			base.OnEnterSceneFinally();
			this.CheckJvDianState();
			bool flag = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_CASTLE_WAIT;
			if (flag)
			{
				bool flag2 = DlgBase<BattleMain, BattleMainBehaviour>.singleton.IsLoaded() && DlgBase<BattleMain, BattleMainBehaviour>.singleton.IsVisible();
				if (flag2)
				{
					DlgBase<BattleMain, BattleMainBehaviour>.singleton.SkillHandler.SetVisible(false);
				}
			}
			bool flag3 = Process_RpcC2G_DoEnterScene.runstate > 0u;
			if (flag3)
			{
				bool flag4 = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_CASTLE_WAIT || XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_CASTLE_FIGHT;
				if (flag4)
				{
					XLevelRewardDocument specificDocument = XDocuments.GetSpecificDocument<XLevelRewardDocument>(XLevelRewardDocument.uuID);
					bool flag5 = specificDocument != null;
					if (flag5)
					{
						bool flag6 = DlgBase<BattleMain, BattleMainBehaviour>.singleton.IsLoaded();
						if (flag6)
						{
							DlgBase<BattleMain, BattleMainBehaviour>.singleton.SkillHandler.ResetPressState();
							DlgBase<BattleMain, BattleMainBehaviour>.singleton.SetVisiblePure(false);
							DlgBase<RadioBattleDlg, RadioBattleBahaviour>.singleton.Show(false);
							DlgBase<XChatSmallView, XChatSmallBehaviour>.singleton.SetFakeHide(true);
						}
						specificDocument.ShowLevelReward();
					}
				}
			}
		}

		public override void OnLeaveScene()
		{
			bool flag = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_CASTLE_WAIT;
			if (flag)
			{
				XSingleton<GuildPassMgr>.singleton.ClearAll();
				bool flag2 = DlgBase<BattleMain, BattleMainBehaviour>.singleton.IsLoaded() && DlgBase<BattleMain, BattleMainBehaviour>.singleton.IsVisible();
				if (flag2)
				{
					DlgBase<BattleMain, BattleMainBehaviour>.singleton.SkillHandler.SetVisible(true);
				}
			}
			bool flag3 = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_CASTLE_FIGHT;
			if (flag3)
			{
				for (int i = 0; i < this.fxJvDians.Length; i++)
				{
					bool flag4 = this.fxJvDians[i] != null;
					if (flag4)
					{
						XSingleton<XFxMgr>.singleton.DestroyFx(this.fxJvDians[i], true);
					}
					this.fxJvDians[i] = null;
				}
				XBattleDocument.DelMiniMapFx(this.maptoken[0]);
				XBattleDocument.DelMiniMapFx(this.maptoken[1]);
				XBattleDocument.DelMiniMapFx(this.maptoken[2]);
			}
			base.OnLeaveScene();
		}

		public override void OnDetachFromHost()
		{
			this.jvdians.Clear();
			this.roles.Clear();
			this.guilds.Clear();
			this.rwds.Clear();
			base.OnDetachFromHost();
		}

		public override void PostUpdate(float fDeltaT)
		{
			base.PostUpdate(fDeltaT);
			bool flag = Time.frameCount % 60 == 0;
			if (flag)
			{
				bool flag2 = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_CASTLE_WAIT;
				if (flag2)
				{
					this.SendGCFReadysInfo();
					this.SendGFCFightInfo();
				}
				else
				{
					bool flag3 = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_CASTLE_FIGHT;
					if (flag3)
					{
						this.SendGFCFightInfo();
					}
				}
			}
			bool flag4 = Time.time > this.lastShowInfoTime + 10f;
			if (flag4)
			{
				bool flag5 = this.qInfo.Count != 0;
				if (flag5)
				{
					this.qInfo.Clear();
				}
				bool flag6 = DlgBase<BattleMain, BattleMainBehaviour>.singleton.IsVisible() && DlgBase<BattleMain, BattleMainBehaviour>.singleton.m_miniReportHandler != null;
				if (flag6)
				{
					DlgBase<BattleMain, BattleMainBehaviour>.singleton.m_miniReportHandler.ShowBuffs();
				}
			}
		}

		public FightDesignation.RowData GetDesignation(uint hit)
		{
			FightDesignation.RowData[] table = XGuildTerritoryDocument.mGuildDestination.Table;
			for (int i = table.Length - 1; i >= 0; i--)
			{
				bool flag = table[i].ID <= hit;
				if (flag)
				{
					return table[i];
				}
			}
			return null;
		}

		public void ActiveJvDian(GCFJvDianType type, int index)
		{
			bool flag = type == GCFJvDianType.GCF_JUDIAN_UP;
			if (flag)
			{
				bool flag2 = this.fxJvDians[0] != null && this.fxJvDians[1] != null && this.fxJvDians[2] != null;
				if (flag2)
				{
					this.fxJvDians[0].SetActive(index == 0);
					this.fxJvDians[1].SetActive(index == 1);
					this.fxJvDians[2].SetActive(index == 2);
				}
			}
			else
			{
				bool flag3 = type == GCFJvDianType.GCF_JUDIAN_MID;
				if (flag3)
				{
					bool flag4 = this.fxJvDians[3] != null && this.fxJvDians[4] != null && this.fxJvDians[5] != null;
					if (flag4)
					{
						this.fxJvDians[3].SetActive(index == 0);
						this.fxJvDians[4].SetActive(index == 1);
						this.fxJvDians[5].SetActive(index == 2);
					}
				}
				else
				{
					bool flag5 = this.fxJvDians[6] != null && this.fxJvDians[7] != null && this.fxJvDians[8] != null;
					if (flag5)
					{
						this.fxJvDians[6].SetActive(index == 0);
						this.fxJvDians[7].SetActive(index == 1);
						this.fxJvDians[8].SetActive(index == 2);
					}
				}
			}
		}

		public void SendGCFEnterin(int index)
		{
			this.mapid = XGuildTerritoryDocument.mGuildTransfer.GetByid((uint)index).sceneid;
			this.SendGCFCommonReq(GCFReqType.GCF_JOIN_FIGHT_SCENE);
		}

		public void SendWaitScene(uint tid)
		{
			this.territoryid = tid;
			this.SendGCFCommonReq(GCFReqType.GCF_JOIN_READY_SCENE);
		}

		public void SendGCFCommonReq(GCFReqType type)
		{
			RpcC2M_GCFCommonReq rpcC2M_GCFCommonReq = new RpcC2M_GCFCommonReq();
			rpcC2M_GCFCommonReq.oArg.mapid = this.mapid;
			rpcC2M_GCFCommonReq.oArg.reqtype = type;
			rpcC2M_GCFCommonReq.oArg.territoryid = this.territoryid;
			XSingleton<XClientNetwork>.singleton.Send(rpcC2M_GCFCommonReq);
		}

		public void RespGCFCommon(GCFReqType type, GCFCommonRes res)
		{
			this.jvdians = res.jvdians;
			this.guilds.Clear();
			for (int i = 0; i < res.guilds.Count; i++)
			{
				GCFGuild gcfguild = new GCFGuild();
				gcfguild.brief = res.guilds[i];
				gcfguild.groupScore = this.GetGroupPoint(res.guilds, gcfguild.brief.group);
				this.guilds.Add(gcfguild);
			}
			this.roles = res.roles;
			this.rwds = res.rewards;
			this.fields = res.fields;
			this.mmyinfo = res.myinfo;
			bool flag = this.mmyinfo != null;
			if (flag)
			{
				this.feats = this.mmyinfo.feats;
			}
			this.territoryid = res.territoryid;
			this.winguild = res.winguild;
			bool flag2 = type == GCFReqType.GCF_FIGHT_REPORT;
			if (flag2)
			{
				bool flag3 = DlgBase<GuildTerritoryReportDlg, GuildTerritoryBahaviour>.singleton.IsVisible();
				if (flag3)
				{
					DlgBase<GuildTerritoryReportDlg, GuildTerritoryBahaviour>.singleton.RefreshAll();
				}
			}
			else
			{
				bool flag4 = type == GCFReqType.GCF_JOIN_READY_SCENE;
				if (!flag4)
				{
					bool flag5 = type == GCFReqType.GCF_FIGHT_RESULT;
					if (flag5)
					{
						LevelRewardTerritoryHandler territoryHandler = DlgBase<XLevelRewardView, XLevelRewardBehaviour>.singleton.GetTerritoryHandler();
						bool flag6 = territoryHandler != null;
						if (flag6)
						{
							territoryHandler.RefreshAll();
						}
						else
						{
							XSingleton<XDebug>.singleton.AddErrorLog("level reward is nil", null, null, null, null, null);
						}
					}
					else
					{
						bool flag7 = type == GCFReqType.GCF_JOIN_FIGHT_SCENE;
						if (flag7)
						{
						}
					}
				}
			}
		}

		public void SendGCFReadysInfo()
		{
			RpcC2M_GCFReadysInfoReq rpc = new RpcC2M_GCFReadysInfoReq();
			XSingleton<XClientNetwork>.singleton.Send(rpc);
		}

		public void RespGCFReadysInfo(GCFReadyInfoRes ores)
		{
			this.ready_lefttime = ores.lefttime;
			bool flag = DlgBase<BattleMain, BattleMainBehaviour>.singleton.IsVisible() && !XSingleton<GuildPassMgr>.singleton.isOpen && this.ready_lefttime > 0u;
			if (flag)
			{
				DlgBase<BattleMain, BattleMainBehaviour>.singleton.SetLeftTime(this.ready_lefttime, -1);
			}
			XSingleton<GuildPassMgr>.singleton.UpdateInfo(ores.allinfo);
		}

		public void SendGFCFightInfo()
		{
			RpcC2M_GCFFightInfoReqC2M rpc = new RpcC2M_GCFFightInfoReqC2M();
			XSingleton<XClientNetwork>.singleton.Send(rpc);
		}

		public void RespGCFFightInfo(GCFFightInfoRes res)
		{
			this.fight_lefttime = res.lefttime;
			bool flag = DlgBase<BattleMain, BattleMainBehaviour>.singleton.IsVisible() && XSingleton<GuildPassMgr>.singleton.isOpen && this.fight_lefttime > 0u;
			if (flag)
			{
				DlgBase<BattleMain, BattleMainBehaviour>.singleton.SetLeftTime(this.fight_lefttime, -1);
			}
			XGuildDocument specificDocument = XDocuments.GetSpecificDocument<XGuildDocument>(XGuildDocument.uuID);
			this.guilds.Clear();
			for (int i = 0; i < res.guilds.Count; i++)
			{
				GCFGuild gcfguild = new GCFGuild();
				gcfguild.brief = res.guilds[i];
				gcfguild.groupScore = this.GetGroupPoint(res.guilds, gcfguild.brief.group);
				gcfguild.isPartern = (res.guilds[i].group == res.mygroup);
				bool flag2 = gcfguild.brief.guildid == specificDocument.UID;
				if (flag2)
				{
					this.myPostion = gcfguild.isPartern;
				}
				this.guilds.Add(gcfguild);
			}
			this.jvdians = res.JvDians;
			this.guilds.Sort(new Comparison<GCFGuild>(this.SortGuildsInfo));
			GuildBattleMiniRankHandler miniRankHandler = DlgBase<BattleMain, BattleMainBehaviour>.singleton.m_miniRankHandler;
			bool flag3 = miniRankHandler != null;
			if (flag3)
			{
				miniRankHandler.RefreshAll();
			}
			this.CheckJvDianState();
			GuildMiniReportHandler miniReportHandler = DlgBase<BattleMain, BattleMainBehaviour>.singleton.m_miniReportHandler;
			bool flag4 = miniReportHandler != null;
			if (flag4)
			{
				miniReportHandler.RefreshMyInfo(res.myinfo);
			}
		}

		private uint GetGroupPoint(List<GCFGuildBrief> guilds, int group)
		{
			uint num = 0u;
			for (int i = 0; i < guilds.Count; i++)
			{
				bool flag = guilds[i].group == group;
				if (flag)
				{
					num += guilds[i].point;
				}
			}
			return num;
		}

		private int SortGuildsInfo(GCFGuild x, GCFGuild y)
		{
			bool flag = x.groupScore != y.groupScore;
			int result;
			if (flag)
			{
				result = (int)(y.groupScore - x.groupScore);
			}
			else
			{
				result = (int)(y.brief.point - x.brief.point);
			}
			return result;
		}

		public void OnFeatsChange(uint feat)
		{
			this.feats = feat;
		}

		public void OnZhanLingNotify(GCFZhanLingPara data)
		{
			GCFZhanLingType zltype = data.zltype;
			XEntity entity = XSingleton<XEntityMgr>.singleton.GetEntity(data.roleID);
			bool flag = entity == null || entity.Attributes == null;
			if (!flag)
			{
				XTerritoryComponent xterritoryComponent = entity.GetXComponent(XTerritoryComponent.uuID) as XTerritoryComponent;
				bool flag2 = zltype == GCFZhanLingType.GCFZL_BEGIN;
				if (flag2)
				{
					xterritoryComponent.ToStart();
				}
				else
				{
					bool flag3 = zltype == GCFZhanLingType.GCFZL_BREAK;
					if (flag3)
					{
						xterritoryComponent.Interupt();
					}
					else
					{
						bool flag4 = zltype == GCFZhanLingType.GCFZL_END;
						if (flag4)
						{
							xterritoryComponent.Success();
						}
					}
				}
			}
		}

		public void ModifyMinimapState(GCFJvDianType type1, int index2)
		{
			int num = XFastEnumIntEqualityComparer<GCFJvDianType>.ToInt(type1);
			Vector3 pos = this.fxJvPos[num - 1];
			string fx = this.fxs[index2];
			bool flag = type1 == GCFJvDianType.GCF_JUDIAN_UP;
			if (flag)
			{
				XBattleDocument.DelMiniMapFx(this.maptoken[0]);
				this.maptoken[0] = XBattleDocument.AddMiniMapFx(pos, fx);
			}
			else
			{
				bool flag2 = type1 == GCFJvDianType.GCF_JUDIAN_MID;
				if (flag2)
				{
					XBattleDocument.DelMiniMapFx(this.maptoken[1]);
					this.maptoken[1] = XBattleDocument.AddMiniMapFx(pos, fx);
				}
				else
				{
					XBattleDocument.DelMiniMapFx(this.maptoken[2]);
					this.maptoken[2] = XBattleDocument.AddMiniMapFx(pos, fx);
				}
			}
		}

		public void OnGCFSynG2CNtf(GCFG2CSynPara data)
		{
			GuildMiniReportHandler miniReportHandler = DlgBase<BattleMain, BattleMainBehaviour>.singleton.m_miniReportHandler;
			bool flag = miniReportHandler != null;
			if (flag)
			{
				miniReportHandler.Push(data.type, data);
			}
			bool flag2 = data.type == GCFG2CSynType.GCF_G2C_SYN_KILL_COUNT;
			if (flag2)
			{
				XEntity entity = XSingleton<XEntityMgr>.singleton.GetEntity(data.roleid);
				bool flag3 = entity != null;
				if (flag3)
				{
					bool flag4 = entity.BillBoard != null;
					if (flag4)
					{
						entity.BillBoard.OnFightDesignationInfoChange(data.killcount);
					}
				}
			}
		}

		public void ReceiveBattleSkill(PvpBattleKill battleSkillInfo)
		{
			bool flag = XSingleton<XScene>.singleton.SceneType != SceneType.SCENE_CASTLE_FIGHT;
			if (!flag)
			{
				GVGBattleSkill gvgbattleSkill = new GVGBattleSkill();
				gvgbattleSkill.killerID = battleSkillInfo.killID;
				gvgbattleSkill.deadID = battleSkillInfo.deadID;
				gvgbattleSkill.contiKillCount = battleSkillInfo.contiKillCount;
				XEntity entityConsiderDeath = XSingleton<XEntityMgr>.singleton.GetEntityConsiderDeath(gvgbattleSkill.killerID);
				XEntity entityConsiderDeath2 = XSingleton<XEntityMgr>.singleton.GetEntityConsiderDeath(gvgbattleSkill.deadID);
				bool flag2 = entityConsiderDeath == null || entityConsiderDeath2 == null;
				if (flag2)
				{
					XSingleton<XDebug>.singleton.AddErrorLog("entity id: " + gvgbattleSkill.killerID, " dead id: " + gvgbattleSkill.deadID, null, null, null, null);
				}
				else
				{
					gvgbattleSkill.killerName = entityConsiderDeath.Name;
					gvgbattleSkill.deadName = entityConsiderDeath2.Name;
					bool flag3 = XSingleton<XEntityMgr>.singleton.IsAlly(entityConsiderDeath);
					gvgbattleSkill.killerPosition = (this.myPostion ? flag3 : (!flag3));
					DlgBase<BattleContiDlg, BattleContiBehaviour>.singleton.AddBattleSkill(gvgbattleSkill);
					XSingleton<XDebug>.singleton.AddGreenLog(string.Format("ReceiveBattleSkill:{0} --- ,{1} ,.... {2}", gvgbattleSkill.killerName, gvgbattleSkill.deadName, gvgbattleSkill.contiKillCount), null, null, null, null, null);
				}
			}
		}

		private void CheckJvDianState()
		{
			bool flag = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_CASTLE_FIGHT;
			if (flag)
			{
				for (int i = 0; i < this.jvdians.Count; i++)
				{
					bool flag2 = string.IsNullOrEmpty(this.jvdians[i].guildname);
					if (flag2)
					{
						this.ActiveJvDian(this.jvdians[i].type, 0);
						this.ModifyMinimapState(this.jvdians[i].type, 0);
					}
					else
					{
						this.ActiveJvDian(this.jvdians[i].type, this.IsPartener(this.jvdians[i].guildname) ? 2 : 1);
						this.ModifyMinimapState(this.jvdians[i].type, this.IsPartener(this.jvdians[i].guildname) ? 1 : 2);
					}
				}
			}
		}

		private bool IsPartener(string guildname)
		{
			for (int i = 0; i < this.guilds.Count; i++)
			{
				bool flag = this.guilds[i].brief.guildname == guildname;
				if (flag)
				{
					return this.guilds[i].isPartern;
				}
			}
			return false;
		}

		public void OnAddBuff(ulong roleID, uint doodadID)
		{
			BuffTable.RowData buffData = XSingleton<XBuffTemplateManager>.singleton.GetBuffData((int)doodadID, 1);
			string text = string.Empty;
			bool flag = buffData == null;
			if (flag)
			{
				XSingleton<XDebug>.singleton.AddErrorLog(string.Format("GuildTerritory: Buff data not found: [{0} {1}]", doodadID, 1), null, null, null, null, null);
			}
			else
			{
				text = buffData.BuffName;
			}
			XEntity entity = XSingleton<XEntityMgr>.singleton.GetEntity(roleID);
			bool flag2 = entity == null;
			if (flag2)
			{
				XSingleton<XDebug>.singleton.AddWarningLog("entity is null", null, null, null, null, null);
			}
			else
			{
				string name = entity.Name;
				StringBuilder stringBuilder = new StringBuilder();
				bool flag3 = false;
				for (int i = 0; i < text.Length; i++)
				{
					bool flag4 = text[i] == '[';
					if (flag4)
					{
						flag3 = true;
					}
					bool flag5 = text[i] == ')';
					if (flag5)
					{
						flag3 = false;
					}
					bool flag6 = flag3;
					if (flag6)
					{
						stringBuilder.Append(text[i]);
					}
					bool flag7 = text[i] == '(';
					if (flag7)
					{
						flag3 = true;
					}
					bool flag8 = text[i] == ']';
					if (flag8)
					{
						flag3 = false;
					}
				}
				this.AddBuffInfo(name, stringBuilder.ToString());
			}
		}

		private void AddBuffInfo(string left, string right)
		{
			this.lastShowInfoTime = Time.time;
			XBattleCaptainPVPDocument.KillInfo item = default(XBattleCaptainPVPDocument.KillInfo);
			item.KillName = left;
			item.DeadName = right;
			this.qInfo.Enqueue(item);
			bool flag = (long)this.qInfo.Count > (long)((ulong)XGuildTerritoryDocument.GAME_INFO);
			if (flag)
			{
				this.qInfo.Dequeue();
			}
			bool flag2 = DlgBase<BattleMain, BattleMainBehaviour>.singleton.IsVisible() && DlgBase<BattleMain, BattleMainBehaviour>.singleton.m_miniReportHandler != null;
			if (flag2)
			{
				DlgBase<BattleMain, BattleMainBehaviour>.singleton.m_miniReportHandler.ShowBuffs();
			}
		}

		public void OnClickTerritoryIcon()
		{
			XGuildTerritoryDocument.GuildTerritoryStyle territoryStyle = this.TerritoryStyle;
			if (territoryStyle != XGuildTerritoryDocument.GuildTerritoryStyle.INFORM)
			{
				if (territoryStyle == XGuildTerritoryDocument.GuildTerritoryStyle.ACTIVITY)
				{
					DlgBase<GuildTerritoryMainDlg, GuildTerritoryMainBehaviour>.singleton.SetVisibleWithAnimation(true, null);
				}
			}
			else
			{
				this.TerritoryStyle = XGuildTerritoryDocument.GuildTerritoryStyle.NONE;
				XSingleton<UiUtility>.singleton.ShowModalDialog(XStringDefineProxy.GetString("NOTICE_TERRITORY_STRING"), XStringDefineProxy.GetString("NOTICE_TERRITORY_STRING_GO"), XStringDefineProxy.GetString("NOTICE_TERRITORY_STRING_ENSURE"), new ButtonClickEventHandler(this.OnInformClick));
			}
		}

		private bool OnInformClick(IXUIButton btn)
		{
			XSingleton<UiUtility>.singleton.CloseModalDlg();
			DlgBase<GuildTerritoryMainDlg, GuildTerritoryMainBehaviour>.singleton.SetVisibleWithAnimation(true, null);
			return false;
		}

		public bool TryTerritoryAlliance(uint terriroryID, out int messageID)
		{
			bool result = false;
			messageID = 0;
			bool flag = terriroryID == this.SelfGuildTerritoryID;
			if (flag)
			{
				messageID = 4;
			}
			else
			{
				uint targetTerrioryType = this.GetTargetTerrioryType(terriroryID);
				uint targetTerrioryType2 = this.GetTargetTerrioryType(this.SelfGuildTerritoryID);
				bool flag2 = targetTerrioryType == 0u;
				if (flag2)
				{
					messageID = 0;
				}
				int num = (int)(targetTerrioryType - targetTerrioryType2);
				bool flag3 = num > 1;
				if (flag3)
				{
					bool flag4 = targetTerrioryType == 3u;
					if (flag4)
					{
						messageID = 2;
					}
					else
					{
						bool flag5 = targetTerrioryType == 2u;
						if (flag5)
						{
							messageID = 1;
						}
					}
				}
				else
				{
					bool flag6 = num < 1;
					if (flag6)
					{
						bool flag7 = targetTerrioryType2 == 3u;
						if (flag7)
						{
							messageID = 5;
						}
						else
						{
							messageID = 3;
						}
					}
					else
					{
						result = true;
					}
				}
			}
			return result;
		}

		public uint GetTargetTerrioryType(uint cityID)
		{
			uint result = 0u;
			bool flag = cityID > 0u;
			if (flag)
			{
				TerritoryBattle.RowData byID = XGuildTerritoryDocument.mGuildTerritoryList.GetByID(cityID);
				bool flag2 = byID != null;
				if (flag2)
				{
					result = byID.territorylevel;
				}
			}
			return result;
		}

		public bool TryGetCityData(uint cityID, out CityData data)
		{
			return this.mCityDataDic.TryGetValue(cityID, out data);
		}

		public void SendGuildTerritoryCityInfo()
		{
			RpcC2M_ReqGuildTerrCityInfo rpc = new RpcC2M_ReqGuildTerrCityInfo();
			XSingleton<XClientNetwork>.singleton.Send(rpc);
		}

		public void ReceiveGuildTerritoryCityInfo(ReqGuildTerrCityInfo res)
		{
			XGuildDocument specificDocument = XDocuments.GetSpecificDocument<XGuildDocument>(XGuildDocument.uuID);
			this.CurrentType = res.type;
			this.SelfTargetTerritoryID = res.targetid;
			this.SelfGuildTerritoryID = 0u;
			this.SelfAllianceID = res.allianceId;
			this.mCityDataList.Clear();
			XSingleton<XDebug>.singleton.AddGreenLog("ReceiveGuildTerritoryCityInfo:", this.CurrentType.ToString(), res.targetid.ToString(), res.cityinfo.Count.ToString(), null, null);
			int i = 0;
			int count = res.cityinfo.Count;
			while (i < count)
			{
				bool flag = this.mCityDataDic.ContainsKey(res.cityinfo[i].id);
				if (flag)
				{
					this.mCityDataDic[res.cityinfo[i].id] = res.cityinfo[i];
				}
				else
				{
					this.mCityDataDic.Add(res.cityinfo[i].id, res.cityinfo[i]);
				}
				bool flag2 = res.cityinfo[i].guildid > 0UL;
				if (flag2)
				{
					this.mCityDataList.Add(res.cityinfo[i]);
				}
				bool flag3 = specificDocument.BasicData.uid == res.cityinfo[i].guildid;
				if (flag3)
				{
					this.SelfGuildTerritoryID = res.cityinfo[i].id;
				}
				i++;
			}
			this.mCityDataList.Sort(new Comparison<CityData>(this.CompareCityData));
			bool flag4 = DlgBase<GuildTerritoryMainDlg, GuildTerritoryMainBehaviour>.singleton.IsVisible();
			if (flag4)
			{
				DlgBase<GuildTerritoryMainDlg, GuildTerritoryMainBehaviour>.singleton.RefreshData();
			}
		}

		public void SetGuildTerritoryCityInfo(uint cityID, ulong guildID)
		{
			this.RefreshGuildTerritoryInfo();
		}

		private int CompareCityData(CityData city1, CityData city2)
		{
			return (int)(city2.id - city1.id);
		}

		public void RefreshGuildTerritoryInfo()
		{
			bool flag = DlgBase<GuildTerritoryMainDlg, GuildTerritoryMainBehaviour>.singleton.IsVisible();
			if (flag)
			{
				this.SendGuildTerritoryCityInfo();
			}
			bool flag2 = DlgBase<GuildTerritoryDeclareDlg, GuildTerritoryDeclareBehaviour>.singleton.IsVisible();
			if (flag2)
			{
				this.SendGuildTerritoryChallInfo(this.CurrentTerritoryID);
			}
		}

		public void SendGuildTerritoryChallInfo(uint uid)
		{
			bool flag = uid == 0u;
			if (!flag)
			{
				RpcC2M_ReqGuildTerrChallInfo rpcC2M_ReqGuildTerrChallInfo = new RpcC2M_ReqGuildTerrChallInfo();
				rpcC2M_ReqGuildTerrChallInfo.oArg.id = uid;
				this.CurrentTerritoryID = uid;
				XSingleton<XClientNetwork>.singleton.Send(rpcC2M_ReqGuildTerrChallInfo);
			}
		}

		public void ReceiveGuildTerritoryChallInfo(ReqGuildTerrChallInfoArg arg, ReqGuildTerrChallInfoRes res)
		{
			XSingleton<XDebug>.singleton.AddGreenLog("ReceiveGuildTerritoryChallInfo:", res.challinfo.Count.ToString(), null, null, null, null);
			this.mGuildTerrChall.Clear();
			this.mGuildTerrChall.AddRange(res.challinfo);
			this.mGuildTerritoryAllianceList.Clear();
			this.EnterBattleTime = res.cdtime;
			Dictionary<ulong, GuildTerritoryAllianceInfo> dictionary = new Dictionary<ulong, GuildTerritoryAllianceInfo>();
			int i = 0;
			int count = res.challinfo.Count;
			while (i < count)
			{
				bool flag = dictionary.ContainsKey(res.challinfo[i].allianceid);
				if (flag)
				{
					dictionary[res.challinfo[i].allianceid].Add(res.challinfo[i]);
				}
				else
				{
					bool flag2 = !dictionary.ContainsKey(res.challinfo[i].guildid);
					if (flag2)
					{
						GuildTerritoryAllianceInfo guildTerritoryAllianceInfo = new GuildTerritoryAllianceInfo();
						guildTerritoryAllianceInfo.Set(res.challinfo[i]);
						dictionary.Add(res.challinfo[i].guildid, guildTerritoryAllianceInfo);
					}
				}
				i++;
			}
			this.mGuildTerritoryAllianceList.AddRange(dictionary.Values);
			bool flag3 = this.CurrentTerritoryID > 0u;
			if (flag3)
			{
				bool flag4 = DlgBase<GuildTerritoryDeclareDlg, GuildTerritoryDeclareBehaviour>.singleton.IsVisible();
				if (flag4)
				{
					DlgBase<GuildTerritoryDeclareDlg, GuildTerritoryDeclareBehaviour>.singleton.RefreshWhenShow();
				}
				else
				{
					DlgBase<GuildTerritoryDeclareDlg, GuildTerritoryDeclareBehaviour>.singleton.SetVisibleWithAnimation(true, null);
				}
			}
		}

		public void SendReceiveTerritroyInfo()
		{
			RpcC2M_ReqGuildTerrIntellInfo rpc = new RpcC2M_ReqGuildTerrIntellInfo();
			XSingleton<XClientNetwork>.singleton.Send(rpc);
		}

		public void ReceiveTerritoryInterllInfo(ReqGuildTerrIntellInfoRes oRes)
		{
			bool flag = DlgBase<GuildTerritoryMessageDlg, GuildTerritoryMessageBehaviour>.singleton.IsVisible();
			if (flag)
			{
				DlgBase<GuildTerritoryMessageDlg, GuildTerritoryMessageBehaviour>.singleton.SetNewInfo(oRes.intellInfo);
			}
		}

		public bool TryGetTerritoryGuildName(ulong guildid, out string guildName)
		{
			guildName = string.Empty;
			int i = 0;
			int count = this.mGuildTerrChall.Count;
			while (i < count)
			{
				bool flag = this.mGuildTerrChall[i].guildid == guildid;
				if (flag)
				{
					guildName = this.mGuildTerrChall[i].guildname;
					return true;
				}
				i++;
			}
			return false;
		}

		public void SendGuildTerrAllianceInfo()
		{
			RpcC2M_ReqGuildTerrAllianceInfo rpc = new RpcC2M_ReqGuildTerrAllianceInfo();
			XSingleton<XClientNetwork>.singleton.Send(rpc);
		}

		public void ReceiveGuildTerrAllianceInfo(ReqGuildTerrAllianceInfoRes res)
		{
			this.Allianceid = res.allianceid;
			this.guildAllianceInfos = res.allianceinfo;
			DlgBase<GuildTerritoryLeagueDlg, GuildTerritoryLeagueBehaviour>.singleton.RefreshData();
		}

		public void SendAllianceGuildTerr(uint territoryID)
		{
			XGuildDocument specificDocument = XDocuments.GetSpecificDocument<XGuildDocument>(XGuildDocument.uuID);
			bool flag = specificDocument.Position == GuildPosition.GPOS_LEADER || specificDocument.Position == GuildPosition.GPOS_VICELEADER;
			if (flag)
			{
				RpcC2M_AllianceGuildTerr rpcC2M_AllianceGuildTerr = new RpcC2M_AllianceGuildTerr();
				rpcC2M_AllianceGuildTerr.oArg.id = territoryID;
				XSingleton<XClientNetwork>.singleton.Send(rpcC2M_AllianceGuildTerr);
			}
			else
			{
				XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("ERR_TB_DECLEAR_NO_PERMISSON"), "fece00");
			}
		}

		public void ReceiveAllianceGuildTerr(AllianceGuildTerrArg arg, AllianceGuildTerrRes res)
		{
			bool flag = res.errorcod > ErrorCode.ERR_SUCCESS;
			if (flag)
			{
				XSingleton<UiUtility>.singleton.ShowSystemTip(res.errorcod, "fece00");
				bool flag2 = res.errorcod == ErrorCode.ERR_DECLAREWAR_OUT_TIME;
				if (flag2)
				{
					this.RefreshGuildTerritoryInfo();
				}
			}
			else
			{
				this.RefreshGuildTerritoryInfo();
			}
		}

		public void SendTryAlliance(ulong guildID)
		{
			XSingleton<XDebug>.singleton.AddGreenLog("SendTryAlliance", guildID.ToString(), null, null, null, null);
			RpcC2M_TryAlliance rpcC2M_TryAlliance = new RpcC2M_TryAlliance();
			rpcC2M_TryAlliance.oArg.guild = guildID;
			XSingleton<XClientNetwork>.singleton.Send(rpcC2M_TryAlliance);
		}

		public void ReceiveTryAlliance(TryAllianceArg arg, TryAlliance res)
		{
			XSingleton<XDebug>.singleton.AddGreenLog("ReceiveTryAlliance", null, null, null, null, null);
			bool flag = res.errorcode > ErrorCode.ERR_SUCCESS;
			if (flag)
			{
				XSingleton<UiUtility>.singleton.ShowSystemTip(res.errorcode, "fece00");
			}
			else
			{
				this.SendGuildTerritoryChallInfo(this.CurrentTerritoryID);
			}
		}

		public void SendRecAlliance(ulong guildID)
		{
			RpcC2M_RecAlliance rpcC2M_RecAlliance = new RpcC2M_RecAlliance();
			rpcC2M_RecAlliance.oArg.guildid = guildID;
			XSingleton<XClientNetwork>.singleton.Send(rpcC2M_RecAlliance);
		}

		public void ReceiveRecAlliance(RecAllianceArg arg, RecAllianceRes res)
		{
			bool flag = res.errorcode > ErrorCode.ERR_SUCCESS;
			if (flag)
			{
				XSingleton<UiUtility>.singleton.ShowSystemTip(res.errorcode, "fece00");
			}
			else
			{
				this.bHavaTerritoryRecCount = 0u;
				DlgBase<GuildTerritoryLeagueDlg, GuildTerritoryLeagueBehaviour>.singleton.SetVisibleWithAnimation(false, null);
			}
		}

		public void SendClearGuildTerrAlliance()
		{
			RpcC2M_ClearGuildTerrAlliance rpc = new RpcC2M_ClearGuildTerrAlliance();
			XSingleton<XClientNetwork>.singleton.Send(rpc);
		}

		public void ReceiveClearGuildTerrAlliance(ClearGuildTerrAllianceRes res)
		{
			bool flag = res.errorcode > ErrorCode.ERR_SUCCESS;
			if (flag)
			{
				XSingleton<UiUtility>.singleton.ShowSystemTip(res.errorcode, "fece00");
			}
			else
			{
				this.bHavaTerritoryRecCount = 0u;
				DlgBase<GuildTerritoryLeagueDlg, GuildTerritoryLeagueBehaviour>.singleton.SetVisibleWithAnimation(false, null);
			}
		}
	}
}