summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/XMyTeamHandler.cs
blob: 33c0e6d780f545fee65333647b87c1759e343add (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
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
using System;
using System.Collections.Generic;
using KKSG;
using UILib;
using UnityEngine;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient
{
	internal class XMyTeamHandler : DlgHandlerBase
	{
		public static readonly int SMALL_TEAM_CAPACITY = 4;

		public static readonly int LARGE_TEAM_CAPACITY = 8;

		public GameObject m_StartHighlight;

		public IXUIButton m_BtnStart;

		public IXUIButton m_BtnBroadcast;

		public IXUIButton m_BtnMatchMembers;

		public IXUISprite m_BtnSetting;

		public IXUISprite m_BtnLeave;

		private Vector3 m_PosLeave;

		private Vector3 m_PosStart;

		public IXUILabel m_MatchMembersIdleLabel;

		public IXUILabel m_MatchMembersMatchingLabel;

		public IXUILabel m_StartLabel;

		public XUIPool m_MemberPoolSmall = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);

		public XUIPool m_MemberPoolLarge = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);

		public IXUIButton m_BtnAddCount;

		private IXUISprite m_BtnHelper;

		private IXUISprite m_HelperSelected;

		private IXUISprite m_BtnTicket;

		private IXUISprite m_TicketSelected;

		private IXUILabel m_PPTRequirement;

		private GameObject m_PPTRequirementTotal;

		private GameObject m_GoldGroup;

		private GameObject m_GoldGroupDescri;

		private XTeamDocument doc;

		private XExpeditionDocument expDoc;

		private XCaptainPVPDocument capDoc;

		private XHeroBattleDocument heroDoc;

		private XPrerogativeDocument preDoc;

		private XDragonNestDocument dragonDoc;

		private XTeamBonusHandler m_BonusHandler = null;

		private XTeamPartnerBonusHandler m_FriendBonusHandler = null;

		private XTeamSettingHandler m_SettingHandler = null;

		private XTeamPasswordHandler m_PasswordHandler = null;

		private XDummy[] m_Avatars = new XDummy[XMyTeamHandler.SMALL_TEAM_CAPACITY];

		private IUIDummy[] m_UIDummys = new IUIDummy[XMyTeamHandler.SMALL_TEAM_CAPACITY];

		private int m_MemberCount = 0;

		private Dictionary<GameObject, XTeamFriendDegreeHandler> m_DicFriendDegree = new Dictionary<GameObject, XTeamFriendDegreeHandler>();

		private Dictionary<ulong, uint> m_ChatTimerToken = new Dictionary<ulong, uint>();

		private List<XFx> m_preEffects = new List<XFx>();

		private bool m_bDirty;

		private HashSet<int> m_MilitaryIconTypes = new HashSet<int>();

		private float guildInviteTime = 0f;

		private ulong m_SelectedMemberID;

		protected override void Init()
		{
			base.Init();
			this.m_BtnStart = (base.PanelObject.transform.Find("BtnStart").GetComponent("XUIButton") as IXUIButton);
			this.m_BtnBroadcast = (base.PanelObject.transform.Find("BtnBroadcast").GetComponent("XUIButton") as IXUIButton);
			this.m_BtnMatchMembers = (base.PanelObject.transform.Find("BtnMatchMembers").GetComponent("XUIButton") as IXUIButton);
			this.m_StartHighlight = this.m_BtnStart.gameObject.transform.Find("Highlight").gameObject;
			this.m_BtnSetting = (base.PanelObject.transform.Find("BtnTeamSetting").GetComponent("XUISprite") as IXUISprite);
			this.m_BtnLeave = (base.PanelObject.transform.Find("BtnLeave").GetComponent("XUISprite") as IXUISprite);
			this.m_PosLeave = this.m_BtnLeave.gameObject.transform.localPosition;
			this.m_PosStart = this.m_BtnStart.gameObject.transform.localPosition;
			Transform transform = base.PanelObject.transform.Find("Panel/MemberTpl4");
			this.m_MemberPoolSmall.SetupPool(transform.parent.gameObject, transform.gameObject, 4u, false);
			transform = base.PanelObject.transform.Find("Panel/MemberTpl6");
			this.m_MemberPoolLarge.SetupPool(transform.parent.gameObject, transform.gameObject, 6u, false);
			this.m_MatchMembersIdleLabel = (this.m_BtnMatchMembers.gameObject.transform.Find("IdleLabel").GetComponent("XUILabel") as IXUILabel);
			this.m_MatchMembersMatchingLabel = (this.m_BtnMatchMembers.gameObject.transform.Find("MatchingLabel").GetComponent("XUILabel") as IXUILabel);
			this.m_StartLabel = (this.m_BtnStart.gameObject.transform.Find("Label").GetComponent("XUILabel") as IXUILabel);
			this.m_BtnAddCount = (base.PanelObject.transform.Find("BtnAddCount").GetComponent("XUIButton") as IXUIButton);
			this.m_BtnHelper = (base.PanelObject.transform.Find("BtnHelper").GetComponent("XUISprite") as IXUISprite);
			this.m_HelperSelected = (base.PanelObject.transform.Find("BtnHelper/Selected").GetComponent("XUISprite") as IXUISprite);
			this.m_BtnTicket = (base.PanelObject.transform.Find("BtnTicket").GetComponent("XUISprite") as IXUISprite);
			this.m_TicketSelected = (base.PanelObject.transform.Find("BtnTicket/Selected").GetComponent("XUISprite") as IXUISprite);
			this.m_PPTRequirementTotal = base.PanelObject.transform.Find("BattlePoint").gameObject;
			this.m_PPTRequirement = (this.m_PPTRequirementTotal.gameObject.transform.Find("Num").GetComponent("XUILabel") as IXUILabel);
			this.m_GoldGroup = base.PanelObject.transform.Find("RewardHunt").gameObject;
			this.m_GoldGroupDescri = this.m_GoldGroup.transform.Find("Description").gameObject;
			this.doc = XDocuments.GetSpecificDocument<XTeamDocument>(XTeamDocument.uuID);
			this.doc.MyTeamView = this;
			this.expDoc = XDocuments.GetSpecificDocument<XExpeditionDocument>(XExpeditionDocument.uuID);
			this.capDoc = XDocuments.GetSpecificDocument<XCaptainPVPDocument>(XCaptainPVPDocument.uuID);
			this.heroDoc = XDocuments.GetSpecificDocument<XHeroBattleDocument>(XHeroBattleDocument.uuID);
			this.preDoc = XDocuments.GetSpecificDocument<XPrerogativeDocument>(XPrerogativeDocument.uuID);
			this.dragonDoc = XDocuments.GetSpecificDocument<XDragonNestDocument>(XDragonNestDocument.uuID);
			DlgHandlerBase.EnsureCreate<XTeamBonusHandler>(ref this.m_BonusHandler, base.PanelObject.transform.Find("GuildBonusFrame").gameObject, null, true);
			DlgHandlerBase.EnsureCreate<XTeamPartnerBonusHandler>(ref this.m_FriendBonusHandler, base.PanelObject.transform.Find("FriendBonusFrame").gameObject, this, true);
			DlgHandlerBase.EnsureCreate<XTeamPasswordHandler>(ref this.m_PasswordHandler, base.PanelObject.transform.Find("PasswordFrame").gameObject, this, false);
			DlgHandlerBase.EnsureCreate<XTeamSettingHandler>(ref this.m_SettingHandler, base.PanelObject.transform, false, this);
			this.m_FriendBonusHandler.bConsiderTeam = true;
			base.Alloc3DAvatarPool("XMyTeamHandler", 1);
			this.m_DicFriendDegree.Clear();
			this.m_MilitaryIconTypes.Clear();
			List<int> intList = XSingleton<XGlobalConfig>.singleton.GetIntList("TeamMilitaryIconTypes");
			this.m_MilitaryIconTypes.UnionWith(intList);
		}

		public override void RegisterEvent()
		{
			base.RegisterEvent();
			this.m_BtnStart.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnStartBtnClick));
			this.m_BtnBroadcast.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnBroadcastBtnClick));
			this.m_BtnMatchMembers.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnMatchMembersBtnClick));
			this.m_BtnLeave.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnMemberLeaveClick));
			this.m_BtnAddCount.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnAddCountClicked));
			this.m_BtnHelper.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnHelperClicked));
			this.m_BtnSetting.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnSettingBtnClicked));
			this.m_BtnTicket.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnTicketClicked));
		}

		protected override void OnShow()
		{
			base.OnShow();
			base.Alloc3DAvatarPool("XMyTeamHandler", 4);
			this.RefreshPage();
			this.ShowChat(true);
			this.m_bDirty = false;
		}

		protected override void OnHide()
		{
			XSingleton<X3DAvatarMgr>.singleton.EnableMainDummy(false, null);
			base.Return3DAvatarPool();
			this._ClearAvatarStates();
			this._ClearChatTimer();
			this._ClearPreEffect();
			this._ResetUIDummyCallback();
			this.ShowChat(false);
			base.OnHide();
		}

		private void ShowChat(bool show)
		{
			ShowSettingArgs showSettingArgs = new ShowSettingArgs();
			if (show)
			{
				showSettingArgs.position = 1;
				showSettingArgs.needforceshow = true;
				showSettingArgs.forceshow = true;
				showSettingArgs.needdepth = true;
				showSettingArgs.depth = 4;
			}
			else
			{
				showSettingArgs.position = 0;
				showSettingArgs.needforceshow = true;
				showSettingArgs.forceshow = false;
				showSettingArgs.needdepth = true;
				showSettingArgs.depth = 0;
				showSettingArgs.anim = false;
			}
			DlgBase<XChatSmallView, XChatSmallBehaviour>.singleton.ShowChatMiniUI(showSettingArgs);
		}

		public override void StackRefresh()
		{
			base.StackRefresh();
			base.Alloc3DAvatarPool("XMyTeamHandler", 4);
			this.RefreshPage();
			this.ShowChat(true);
			DlgBase<XChatSmallView, XChatSmallBehaviour>.singleton.SetForceShow(true);
		}

		public override void LeaveStackTop()
		{
			DlgBase<XChatSmallView, XChatSmallBehaviour>.singleton.SetForceShow(false);
			this.ShowChat(false);
			this._ResetUIDummyCallback();
			base.LeaveStackTop();
		}

		public override void OnUnload()
		{
			DlgHandlerBase.EnsureUnload<XTeamBonusHandler>(ref this.m_BonusHandler);
			DlgHandlerBase.EnsureUnload<XTeamPartnerBonusHandler>(ref this.m_FriendBonusHandler);
			DlgHandlerBase.EnsureUnload<XTeamSettingHandler>(ref this.m_SettingHandler);
			DlgHandlerBase.EnsureUnload<XTeamPasswordHandler>(ref this.m_PasswordHandler);
			this._ClearChatTimer();
			this._ClearPreEffect();
			this.doc.MyTeamView = null;
			this.m_DicFriendDegree.Clear();
			DlgBase<XChatSmallView, XChatSmallBehaviour>.singleton.SetForceShow(false);
			base.OnUnload();
		}

		public override void OnUpdate()
		{
			base.OnUpdate();
			bool bDirty = this.m_bDirty;
			if (bDirty)
			{
				this.RefreshPage();
				this.m_bDirty = false;
			}
		}

		private void _ClearChatTimer()
		{
			foreach (uint token in this.m_ChatTimerToken.Values)
			{
				XSingleton<XTimerMgr>.singleton.KillTimer(token);
			}
			this.m_ChatTimerToken.Clear();
		}

		private void _CloseChatTimer(ulong uid)
		{
			uint token = 0u;
			bool flag = this.m_ChatTimerToken.TryGetValue(uid, out token);
			if (flag)
			{
				XSingleton<XTimerMgr>.singleton.KillTimer(token);
				this.m_ChatTimerToken.Remove(uid);
			}
		}

		private void _ClearAvatarStates()
		{
			for (int i = 0; i < XMyTeamHandler.SMALL_TEAM_CAPACITY; i++)
			{
				bool flag = this.m_Avatars[i] == null;
				if (!flag)
				{
					this.m_Avatars[i] = null;
				}
			}
		}

		private void _RefreshAvatarStates()
		{
		}

		private void CheckTicketStates(bool userTicket = false)
		{
			XExpeditionDocument specificDocument = XDocuments.GetSpecificDocument<XExpeditionDocument>(XExpeditionDocument.uuID);
			ExpeditionTable.RowData expeditionDataByID = specificDocument.GetExpeditionDataByID((int)this.doc.currentDungeonID);
			bool flag = expeditionDataByID != null;
			if (flag)
			{
				uint num = expeditionDataByID.UseTicket[0];
				uint num2 = expeditionDataByID.UseTicket[1];
				bool flag2 = num > 0u;
				if (flag2)
				{
					XLevelSealDocument specificDocument2 = XDocuments.GetSpecificDocument<XLevelSealDocument>(XLevelSealDocument.uuID);
					uint sealType = specificDocument2.SealType;
					bool flag3 = num2 <= sealType;
					if (flag3)
					{
						this.m_BtnTicket.SetAlpha(1f);
						this.m_TicketSelected.SetAlpha(userTicket ? 1f : 0f);
						return;
					}
				}
			}
			this.m_BtnTicket.SetAlpha(0f);
			this.m_TicketSelected.SetAlpha(0f);
		}

		public void RefreshPage()
		{
			bool flag = !base.IsVisible();
			if (!flag)
			{
				bool bInTeam = this.doc.bInTeam;
				if (bInTeam)
				{
					int count = this.doc.MyTeam.members.Count;
					int playerNumber = this.doc.currentExpInfo.PlayerNumber;
					bool bIsLeader = this.doc.bIsLeader;
					this.m_BtnStart.SetVisible(bIsLeader);
					this.m_BtnMatchMembers.SetVisible(bIsLeader);
					this.m_BtnBroadcast.SetVisible(bIsLeader);
					this.m_BtnSetting.SetVisible(bIsLeader && this.doc.currentExpInfo.CostType.Count != 0);
					this.m_BtnLeave.gameObject.transform.localPosition = (bIsLeader ? this.m_PosLeave : this.m_PosStart);
					this.m_BtnHelper.SetAlpha((this.doc.currentExpInfo.CanHelp == 0 || bIsLeader) ? 0f : 1f);
					this.m_HelperSelected.SetAlpha(this.doc.bIsHelper ? 1f : 0f);
					this.m_PPTRequirementTotal.SetActive(this.doc.MyTeam.teamBrief.teamPPT > 0u);
					this.m_PPTRequirement.SetText(this.doc.MyTeam.teamBrief.GetStrTeamPPT(double.MaxValue));
					this.doc.MyTeam.teamBrief.goldGroup.SetUI(this.m_GoldGroup, true);
					this.m_GoldGroupDescri.SetActive(!bIsLeader);
					this.RefreshButtonStates();
					this.CheckTicketStates(this.doc.bIsTecket);
					bool flag2 = !this.m_bDirty;
					if (flag2)
					{
						XSingleton<X3DAvatarMgr>.singleton.ClearDummy(this.m_dummPool);
						this._ClearAvatarStates();
					}
					bool flag3 = this.doc.currentExpInfo != null && !this.doc.currentExpInfo.ShowPPT;
					bool flag4 = !flag3;
					if (flag4)
					{
						this.m_BonusHandler.SetVisible(true);
						this.m_FriendBonusHandler.SetVisible(true);
						this.m_BonusHandler.Refresh();
						this.m_FriendBonusHandler.RefreshData();
					}
					else
					{
						this.m_BonusHandler.SetVisible(false);
						this.m_FriendBonusHandler.SetVisible(false);
					}
					this.m_PasswordHandler.RefreshState();
					bool flag5 = this.doc.currentExpInfo == null || this.doc.currentExpInfo.PlayerNumber <= XMyTeamHandler.SMALL_TEAM_CAPACITY;
					this.m_MemberPoolSmall.FakeReturnAll();
					this.m_MemberPoolLarge.FakeReturnAll();
					int num = Math.Max(playerNumber, flag5 ? XMyTeamHandler.SMALL_TEAM_CAPACITY : XMyTeamHandler.LARGE_TEAM_CAPACITY);
					this.m_MemberCount = num;
					Vector3 vector = flag5 ? this.m_MemberPoolSmall.TplPos : this.m_MemberPoolLarge.TplPos;
					this._ClearUIDummy();
					this._ClearPreEffect();
					for (int i = 0; i < num; i++)
					{
						bool flag6 = flag5;
						GameObject gameObject;
						if (flag6)
						{
							gameObject = this.m_MemberPoolSmall.FetchGameObject(false);
							gameObject.transform.localPosition = new Vector3(vector.x + (float)(i * this.m_MemberPoolSmall.TplWidth), vector.y, vector.z);
						}
						else
						{
							gameObject = this.m_MemberPoolLarge.FetchGameObject(false);
							gameObject.transform.localPosition = new Vector3(vector.x + (float)(i % 4 * this.m_MemberPoolLarge.TplWidth), vector.y - (float)(i / 4 * this.m_MemberPoolLarge.TplHeight), vector.z);
						}
						bool flag7 = i < count;
						if (flag7)
						{
							this._SetMember(gameObject, this.doc.MyTeam.members[i], true, i, flag5);
						}
						else
						{
							bool flag8 = i < playerNumber;
							if (flag8)
							{
								this._SetMember(gameObject, null, true, i, flag5);
							}
							else
							{
								this._SetMember(gameObject, null, false, i, flag5);
							}
						}
					}
					this.m_MemberPoolSmall.ActualReturnAll(false);
					this.m_MemberPoolLarge.ActualReturnAll(false);
				}
				else
				{
					DlgBase<XTeamView, TabDlgBehaviour>.singleton.ShowTeamView();
				}
			}
		}

		private void _TryCreateFriendDegreeHandler(GameObject go)
		{
			XTeamFriendDegreeHandler value;
			bool flag = this.m_DicFriendDegree.TryGetValue(go, out value);
			if (!flag)
			{
				DlgHandlerBase.EnsureCreate<XTeamFriendDegreeHandler>(ref value, go.transform.Find("Info/FriendDegreeFrame").gameObject, null, true);
				this.m_DicFriendDegree.Add(go, value);
			}
		}

		public void HideChatUI(object obj)
		{
			IXUISprite ixuisprite = obj as IXUISprite;
			ixuisprite.SetVisible(false);
			ixuisprite.ID = 0UL;
		}

		private void _ClearUIDummy()
		{
			for (int i = 0; i < this.m_UIDummys.Length; i++)
			{
				bool flag = this.m_UIDummys[i] != null;
				if (flag)
				{
					this.m_UIDummys[i].RefreshRenderQueue = null;
					this.m_UIDummys[i] = null;
				}
			}
		}

		private void _ClearPreEffect()
		{
			bool flag = this.m_preEffects != null;
			if (flag)
			{
				int i = 0;
				int count = this.m_preEffects.Count;
				while (i < count)
				{
					bool flag2 = this.m_preEffects[i] != null;
					if (flag2)
					{
						XSingleton<XFxMgr>.singleton.DestroyFx(this.m_preEffects[i], true);
					}
					i++;
				}
				this.m_preEffects.Clear();
			}
		}

		private void _ResetUIDummyCallback()
		{
			for (int i = 0; i < this.m_UIDummys.Length; i++)
			{
				bool flag = this.m_UIDummys[i] != null;
				if (!flag)
				{
					break;
				}
				this.m_UIDummys[i].RefreshRenderQueue = null;
			}
		}

		private void _SetMember(GameObject go, XTeamMember data, bool bActive, int index, bool bSmallMember)
		{
			GameObject gameObject = go.transform.Find("Info").gameObject;
			GameObject gameObject2 = go.transform.Find("OpMenu").gameObject;
			IXUILabel ixuilabel = go.transform.Find("Lock").GetComponent("XUILabel") as IXUILabel;
			GameObject gameObject3 = go.transform.Find("BgSmall").gameObject;
			IXUIButton ixuibutton = go.transform.Find("BtnInvite").GetComponent("XUIButton") as IXUIButton;
			Transform transform = go.transform.Find("Loading");
			IXUISprite ixuisprite = go.transform.Find("Bg_GoldGroup").GetComponent("XUISprite") as IXUISprite;
			gameObject.SetActive(data != null && bActive);
			gameObject2.SetActive(data != null && bActive);
			gameObject3.SetActive(bActive);
			ixuibutton.SetVisible(data == null && bActive);
			bool flag = ixuibutton.IsVisible();
			if (flag)
			{
				GameObject gameObject4 = ixuibutton.gameObject.transform.Find("LetsMakeFriends").gameObject;
				bool flag2 = this.doc.currentDungeonType == TeamLevelType.TeamLevelWedding || this.doc.currentDungeonType == TeamLevelType.TeamLevelWeddingLicense;
				if (flag2)
				{
					gameObject4.SetActive(false);
				}
				else
				{
					gameObject4.SetActive(this.doc.MyTeam.members.Count == index);
				}
			}
			bool flag3 = transform != null;
			if (flag3)
			{
				transform.gameObject.SetActive(data != null && bActive);
			}
			if (bActive)
			{
				ixuilabel.SetVisible(false);
			}
			else
			{
				ixuilabel.SetVisible(true);
				ixuilabel.SetText(XStringDefineProxy.GetString("TEAM_MAX_MEMBER_COUNT", new object[]
				{
					this.doc.currentExpInfo.PlayerNumber
				}));
			}
			IXUISprite ixuisprite2 = go.transform.Find("chatvoice").GetComponent("XUISprite") as IXUISprite;
			IXUISprite ixuisprite3 = go.transform.Find("chattext").GetComponent("XUISprite") as IXUISprite;
			bool flag4 = bActive || data == null || !this.m_ChatTimerToken.ContainsKey(data.uid);
			if (flag4)
			{
				ixuisprite2.SetVisible(false);
				ixuisprite3.SetVisible(false);
			}
			ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnInviteBtnClick));
			IXUISprite ixuisprite4 = go.transform.Find("Bg").GetComponent("XUISprite") as IXUISprite;
			IXUISprite ixuisprite5 = go.transform.GetComponent("XUISprite") as IXUISprite;
			ixuisprite5.ID = (ulong)((long)index);
			ixuisprite5.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnMemberClicked));
			bool flag5 = data == null;
			if (flag5)
			{
				ixuisprite.SetSprite("", "", false);
			}
			else
			{
				bool flag6 = data.uid == XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
				IXUILabel ixuilabel2 = gameObject.transform.Find("Name").GetComponent("XUILabel") as IXUILabel;
				IXUILabelSymbol ixuilabelSymbol = ixuilabel2.gameObject.GetComponent("XUILabelSymbol") as IXUILabelSymbol;
				IXUILabel ixuilabel3 = gameObject.transform.Find("Level").GetComponent("XUILabel") as IXUILabel;
				GameObject gameObject5 = gameObject.transform.Find("Leader").gameObject;
				Transform transform2 = gameObject.transform.Find("Snapshot");
				transform2.gameObject.SetActive(true);
				IXUISprite ixuisprite6 = gameObject.transform.Find("ProfIcon").GetComponent("XUISprite") as IXUISprite;
				GameObject gameObject6 = gameObject.transform.Find("Helper").gameObject;
				IXUISprite ixuisprite7 = gameObject.transform.Find("Rewardless").GetComponent("XUISprite") as IXUISprite;
				IXUISprite ixuisprite8 = gameObject.transform.Find("MilitaryRank").GetComponent("XUISprite") as IXUISprite;
				IXUISprite ixuisprite9 = gameObject.transform.Find("DragonMedal").GetComponent("XUISprite") as IXUISprite;
				ixuisprite9.gameObject.SetActive(false);
				Transform transform3 = gameObject.transform.Find("CrossServer");
				GameObject gameObject7 = gameObject.transform.Find("Mysterious").gameObject;
				IXUISprite ixuisprite10 = gameObject.transform.Find("Regression").GetComponent("XUISprite") as IXUISprite;
				ixuisprite10.SetVisible(data.regression);
				ixuilabelSymbol.InputText = XSingleton<XCommon>.singleton.StringCombine(data.name, XWelfareDocument.GetMemberPrivilegeIconString(data.paymemberid), XRechargeDocument.GetVIPIconString(data.vip));
				bool flag7 = flag6;
				if (flag7)
				{
					ixuilabel2.SetColor(new Color(0.9137255f, 0.819607854f, 0.607843161f));
				}
				else
				{
					ixuilabel2.SetColor(new Color(0.572549045f, 0.7137255f, 0.9490196f));
				}
				ixuilabel3.SetText(flag6 ? XSingleton<XAttributeMgr>.singleton.XPlayerData.Level.ToString() : data.level.ToString());
				gameObject5.SetActive(data.bIsLeader);
				GameObject gameObject8 = gameObject.transform.Find("BattlePointBG").gameObject;
				bool flag8 = this.doc.currentExpInfo != null && !this.doc.currentExpInfo.ShowPPT;
				if (flag8)
				{
					gameObject8.SetActive(false);
				}
				else
				{
					gameObject8.SetActive(true);
					IXUILabel ixuilabel4 = gameObject8.transform.Find("Power").GetComponent("XUILabel") as IXUILabel;
					IXUISprite ixuisprite11 = gameObject8.transform.Find("SisterTA").GetComponent("XUISprite") as IXUISprite;
					IXUILabel ixuilabel5 = ixuisprite11.transform.Find("Info").GetComponent("XUILabel") as IXUILabel;
					bool flag9 = ixuilabel5 != null;
					if (flag9)
					{
						ixuilabel5.SetVisible(false);
					}
					uint num = 0u;
					bool flag10 = flag6;
					bool flag11;
					if (flag10)
					{
						num = (uint)XSingleton<XAttributeMgr>.singleton.XPlayerData.GetAttr(XAttributeDefine.XAttr_POWER_POINT_Basic);
						flag11 = this.doc.TryGetPveProfessionPPT(this.doc.IsTarja, XSingleton<XAttributeMgr>.singleton.XPlayerData.TypeID, ref num);
					}
					else
					{
						num = data.ppt;
						flag11 = this.doc.TryGetPveProfessionPPT(data.IsTarja, (uint)XFastEnumIntEqualityComparer<RoleType>.ToInt(data.profession), ref num);
					}
					ixuisprite11.SetVisible(flag11);
					ixuilabel4.SetText(flag11 ? string.Format("[c][f1d309]{0}[-][/c]", num) : num.ToString());
					ixuisprite11.ID = 0UL;
					ixuisprite11.RegisterSpritePressEventHandler(new SpritePressEventHandler(this.OnShowTarjaTipHandle));
				}
				int profID = XFastEnumIntEqualityComparer<RoleType>.ToInt(data.profession);
				ixuisprite6.spriteName = XSingleton<XProfessionSkillMgr>.singleton.GetProfIcon(profID);
				this._SetRelation(gameObject, data, flag6);
				gameObject6.SetActive(data.bIsHelper);
				ixuisprite7.SetVisible(!data.bIsHelper && this.dragonDoc.GetDragonNestRewardlessLevel(this.doc.currentDungeonID) <= data.level);
				ixuisprite7.RegisterSpritePressEventHandler(new SpritePressEventHandler(this._OnRewardlessPressed));
				ixuisprite7.transform.Find("Popup").gameObject.SetActive(false);
				this._SetLeftCount(gameObject, data, flag6);
				if (bSmallMember)
				{
					bool active = this._SetMemberAvatar(transform2, data, index);
					transform.gameObject.SetActive(active);
				}
				else
				{
					IXUISprite ixuisprite12 = transform2.GetComponent("XUISprite") as IXUISprite;
					ixuisprite12.SetSprite(XSingleton<XProfessionSkillMgr>.singleton.GetProfHeadIcon2(profID));
				}
				bool flag12 = ixuisprite3.ID != data.uid;
				if (flag12)
				{
					this._CloseChatTimer(ixuisprite3.ID);
					ixuisprite3.SetVisible(false);
					ixuisprite3.ID = 0UL;
				}
				bool flag13 = ixuisprite2.ID != data.uid;
				if (flag13)
				{
					this._CloseChatTimer(ixuisprite2.ID);
					ixuisprite2.SetVisible(false);
					ixuisprite2.ID = 0UL;
				}
				IXUISprite ixuisprite13 = gameObject2.transform.Find("Kick").GetComponent("XUISprite") as IXUISprite;
				ixuisprite13.ID = (ulong)((long)index);
				ixuisprite13.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnMemberLeaveClick));
				IXUISprite ixuisprite14 = gameObject2.transform.Find("LeaderCommission").GetComponent("XUISprite") as IXUISprite;
				ixuisprite14.ID = (ulong)((long)index);
				ixuisprite14.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnChangeLeaderClick));
				bool flag14 = flag6 && this.doc.bInTeam;
				if (flag14)
				{
					this.m_BtnLeave.ID = (ulong)((long)index);
					ixuisprite13.SetVisible(false);
				}
				else
				{
					ixuisprite13.SetVisible(this.doc.bIsLeader);
				}
				ixuisprite14.SetVisible(this.doc.bIsLeader && !data.bIsLeader);
				string text = string.Empty;
				bool flag15 = this.doc.bInTeam && data.bIsLeader && this.doc.MyTeam.teamBrief.goldGroup.type > GoldGroupType.GGT_NONE;
				if (flag15)
				{
					bool flag16 = this.doc.MyTeam.teamBrief.goldGroup.type == GoldGroupType.GGT_DIAMOND;
					if (flag16)
					{
						text = XSingleton<XGlobalConfig>.singleton.GetValue("TeamFrame_gct_1");
					}
					else
					{
						bool flag17 = this.doc.MyTeam.teamBrief.goldGroup.type == GoldGroupType.GGT_TICKET;
						if (flag17)
						{
							text = XSingleton<XGlobalConfig>.singleton.GetValue("TeamFrame_gct_2");
						}
					}
				}
				else
				{
					bool flag18 = flag6;
					if (flag18)
					{
						text = this.preDoc.GetPreContent(PrerogativeType.PreTeamBorder);
					}
					else
					{
						bool flag19 = data.outlook != null && data.outlook.pre != null;
						if (flag19)
						{
							text = XPrerogativeDocument.ConvertTypeToPreContent(PrerogativeType.PreTeamBorder, data.outlook.pre.setid);
						}
						else
						{
							text = XPrerogativeDocument.ConvertTypeToPreContent(PrerogativeType.PreTeamBorder, 0u);
						}
					}
				}
				bool flag20 = false;
				bool flag21 = !string.IsNullOrEmpty(text);
				if (flag21)
				{
					string[] array = text.Split(XGlobalConfig.SequenceSeparator);
					bool flag22 = array.Length >= 2;
					if (flag22)
					{
						flag20 = true;
						ixuisprite.SetSprite(array[1], array[0], false);
					}
				}
				bool flag23 = !flag20;
				if (flag23)
				{
					ixuisprite.SetSprite("", "", false);
				}
				List<uint> ids = null;
				bool flag24 = !flag6 && data.outlook.pre == null;
				if (flag24)
				{
					XSingleton<XDebug>.singleton.AddGreenLog("data.outlook.pre is null", null, null, null, null, null);
				}
				bool flag25 = !flag6 && data.outlook.pre != null;
				if (flag25)
				{
					uint score = data.outlook.pre.score;
					ids = data.outlook.pre.setid;
				}
				string text2 = flag6 ? this.preDoc.GetPreContent(PrerogativeType.PreTeamBackground) : XPrerogativeDocument.ConvertTypeToPreContent(PrerogativeType.PreTeamBackground, ids);
				string text3 = string.Empty;
				bool flag26 = !string.IsNullOrEmpty(text2);
				if (flag26)
				{
					string[] array2 = text2.Split(XGlobalConfig.ListSeparator);
					text3 = ((!bSmallMember && array2.Length > 1) ? array2[1] : array2[0]);
				}
				bool flag27 = !string.IsNullOrEmpty(text3);
				if (flag27)
				{
					XFx item = XSingleton<XFxMgr>.singleton.CreateUIFx(text3, ixuisprite.transform, false);
					this.m_preEffects.Add(item);
				}
				bool flag28 = this.m_MilitaryIconTypes.Contains(XFastEnumIntEqualityComparer<TeamLevelType>.ToInt(this.doc.currentDungeonType));
				if (flag28)
				{
					string militaryIcon = XMilitaryRankDocument.GetMilitaryIcon((data.outlook != null && data.outlook.military != null) ? data.outlook.military.military_rank : 0u);
					bool flag29 = string.IsNullOrEmpty(militaryIcon);
					if (flag29)
					{
						ixuisprite8.SetVisible(false);
					}
					else
					{
						ixuisprite8.SetVisible(true);
						ixuisprite8.SetSprite(militaryIcon);
					}
				}
				else
				{
					ixuisprite8.SetVisible(false);
				}
				bool flag30 = transform3 != null && this.doc.MyTeam != null && this.doc.MyTeam.myData != null;
				if (flag30)
				{
					bool flag31 = flag6;
					if (flag31)
					{
						transform3.gameObject.SetActive(false);
					}
					else
					{
						transform3.gameObject.SetActive(this.doc.MyTeam.myData.ServerID != data.ServerID);
					}
				}
				bool flag32 = gameObject7 != null;
				if (flag32)
				{
					bool flag33 = this.doc.MyTeam.teamBrief.rift != null && data.bIsLeader;
					if (flag33)
					{
						gameObject7.SetActive(true);
						this.doc.MyTeam.teamBrief.rift.SetUI(gameObject7);
					}
					else
					{
						gameObject7.SetActive(false);
					}
				}
			}
		}

		private void _SetRelation(GameObject infoGo, XTeamMember data, bool bIsPlayer)
		{
			if (bIsPlayer)
			{
				XTeamView.SetTeamRelationUI(infoGo.transform.Find("Relation"), null, false, XTeamRelation.Relation.TR_NONE);
			}
			else
			{
				data.Relation.UpdateRelation(data.uid, data.guildID, data.dragonGuildID);
				XTeamView.SetTeamRelationUI(infoGo.transform.Find("Relation"), data.Relation, false, XTeamRelation.Relation.TR_NONE);
			}
			IXUILabel ixuilabel = infoGo.transform.Find("FriendValue").GetComponent("XUILabel") as IXUILabel;
			if (bIsPlayer)
			{
				ixuilabel.SetVisible(false);
			}
			else
			{
				ixuilabel.SetVisible(true);
				XFriendData friendDataById = DlgBase<XFriendsView, XFriendsBehaviour>.singleton.GetFriendDataById(data.uid);
				bool flag = friendDataById != null;
				if (flag)
				{
					ixuilabel.SetText(friendDataById.degreeAll.ToString());
				}
				else
				{
					ixuilabel.SetText("0");
				}
			}
		}

		private void _SetLeftCount(GameObject infoGo, XTeamMember data, bool bIsPlayer)
		{
			IXUILabel ixuilabel = infoGo.transform.Find("LeftCount").GetComponent("XUILabel") as IXUILabel;
			GameObject gameObject = infoGo.transform.Find("NoCount").gameObject;
			bool flag = data.leftCount < 0;
			if (flag)
			{
				ixuilabel.SetVisible(true);
				ixuilabel.SetText(XStringDefineProxy.GetString("TEAM_TARGET_NOT_OPEN"));
				gameObject.SetActive(false);
			}
			else
			{
				bool flag2 = data.leftCount == 0 && this.doc.currentDungeonType != TeamLevelType.TeamLevelCaptainPVP && this.doc.currentDungeonType != TeamLevelType.TeamLevelMoba && this.doc.currentDungeonType != TeamLevelType.TeamLevelHeroBattle && this.doc.currentDungeonType != TeamLevelType.TeamLevelDragonNest && this.doc.currentDungeonType != TeamLevelType.TeamLevelTeamLeague && !data.bIsHelper && !data.bIsTicket;
				if (flag2)
				{
					ixuilabel.SetVisible(false);
					gameObject.SetActive(this.doc.currentExpInfo.CostCountType != 0);
				}
				else
				{
					bool flag3 = this.doc.currentDungeonType == TeamLevelType.TeamLevelGoddessTrial || this.doc.currentDungeonType == TeamLevelType.TeamLevelEndlessAbyss;
					if (flag3)
					{
						ixuilabel.SetVisible(true);
						ixuilabel.SetText(string.Format("{0}/{1}", bIsPlayer ? this.doc.GetMyDayCount() : data.leftCount, this.doc.GetCurrentDayMaxCount()));
						gameObject.SetActive(false);
					}
					else
					{
						ixuilabel.SetVisible(false);
						gameObject.SetActive(false);
					}
				}
			}
		}

		private bool OnShowTarjaTipHandle(IXUISprite sprite, bool pressed)
		{
			IXUILabel ixuilabel = sprite.transform.Find("Info").GetComponent("XUILabel") as IXUILabel;
			bool flag = ixuilabel == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				bool flag2 = sprite.ID == 1UL;
				if (flag2)
				{
					ixuilabel.SetText(XSingleton<UiUtility>.singleton.ReplaceReturn(XStringDefineProxy.GetString("TEAM_TARJA_DESC_TEAM")));
				}
				else
				{
					ixuilabel.SetText(XSingleton<UiUtility>.singleton.ReplaceReturn(XStringDefineProxy.GetString("TEAM_TARJA_DESC")));
				}
				ixuilabel.SetVisible(pressed);
				result = false;
			}
			return result;
		}

		private string _GetSceneDescription(SceneTable.RowData rowData)
		{
			SceneType type = (SceneType)rowData.type;
			if (type <= SceneType.SCENE_GUILD_HALL)
			{
				switch (type)
				{
				case SceneType.SCENE_HALL:
				case SceneType.SCENE_ARENA:
					break;
				case SceneType.SCENE_BATTLE:
					return XStringDefineProxy.GetString("MASTER_DUNGEON");
				case SceneType.SCENE_NEST:
				case (SceneType)4:
					goto IL_84;
				default:
					if (type != SceneType.SCENE_GUILD_HALL)
					{
						goto IL_84;
					}
					break;
				}
				return rowData.Comment;
			}
			if (type == SceneType.SCENE_ABYSSS)
			{
				return XStringDefineProxy.GetString("ABYSS_DUNGEON");
			}
			if (type == SceneType.SCENE_GODDESS)
			{
				return XStringDefineProxy.GetString("GODDESS_DUNGEON");
			}
			if (type == SceneType.SCENE_ENDLESSABYSS)
			{
				return XStringDefineProxy.GetString("EndlessAbyss");
			}
			IL_84:
			return rowData.Comment;
		}

		private void _OnDummyLoaded(XEquipComponent equipComp)
		{
			this.m_bDirty = true;
		}

		private bool _SetMemberAvatar(Transform snapShot, XTeamMember data, int index)
		{
			bool result = false;
			XDummy xdummy = null;
			IUIDummy iuidummy = snapShot.GetComponent("UIDummy") as IUIDummy;
			this.m_UIDummys[index] = iuidummy;
			bool flag = data.uid == XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
			if (flag)
			{
				XSingleton<X3DAvatarMgr>.singleton.EnableMainDummy(true, iuidummy);
				XSingleton<X3DAvatarMgr>.singleton.ResetMainAnimation();
			}
			else
			{
				xdummy = XSingleton<X3DAvatarMgr>.singleton.FindCreateCommonRoleDummy(this.m_dummPool, data.uid, (uint)XFastEnumIntEqualityComparer<RoleType>.ToInt(data.profession), data.outlook, iuidummy, index);
				bool flag2 = xdummy != null;
				if (flag2)
				{
					bool delayLoad = XSingleton<XResourceLoaderMgr>.singleton.DelayLoad;
					if (delayLoad)
					{
						xdummy.Equipment.SetLoadFinishedCallback(new LoadFinishedCallback(this._OnDummyLoaded));
					}
				}
				this.m_Avatars[index] = xdummy;
			}
			bool flag3 = xdummy != null;
			if (flag3)
			{
				result = xdummy.Equipment.IsLoadingPart();
			}
			return result;
		}

		public void RefreshButtonStates()
		{
			this.m_BtnAddCount.SetVisible(this.expDoc.GetBuyLimit(this.doc.currentDungeonType) > 0);
			bool bInTeam = this.doc.bInTeam;
			if (bInTeam)
			{
				this.m_BtnStart.SetGrey(this.doc.MyTeam.members.Count >= this.doc.currentExpInfo.PlayerLeastNumber);
				this.m_BtnStart.SetGrey(this.doc.currentDungeonType != TeamLevelType.TeamLevelPartner);
				bool flag = this.doc.currentDungeonType == TeamLevelType.TeamLevelWeddingLicense;
				if (flag)
				{
					this.m_BtnStart.SetGrey(false);
				}
				this.m_StartHighlight.SetActive(false);
				bool bIsLeader = this.doc.bIsLeader;
				bool flag2 = bIsLeader;
				if (flag2)
				{
					bool flag3 = this.doc.currentDungeonType == TeamLevelType.TeamLevelCaptainPVP || this.doc.currentDungeonType == TeamLevelType.TeamLevelHeroBattle || this.doc.currentDungeonType == TeamLevelType.TeamLevelMoba || this.doc.currentDungeonType == TeamLevelType.TeamLevelMultiPK || this.doc.currentDungeonType == TeamLevelType.TeamLevelWeekendParty || this.doc.currentDungeonType == TeamLevelType.TeamLevelCustomPKTwo;
					if (flag3)
					{
						this.m_BtnStart.SetVisible(false);
						this.m_BtnMatchMembers.SetVisible(true);
					}
					else
					{
						this.m_BtnStart.SetVisible(true);
						this.m_BtnMatchMembers.SetVisible(false);
					}
				}
				else
				{
					this.m_BtnStart.SetVisible(false);
					this.m_BtnMatchMembers.SetVisible(false);
				}
				IXUILabel ixuilabel = this.m_BtnStart.gameObject.transform.Find("Label").GetComponent("XUILabel") as IXUILabel;
				XFreeTeamVersusLeagueDocument specificDocument = XDocuments.GetSpecificDocument<XFreeTeamVersusLeagueDocument>(XFreeTeamVersusLeagueDocument.uuID);
				bool flag4 = this.doc.currentDungeonType == TeamLevelType.TeamLevelTeamLeague;
				if (flag4)
				{
					this.m_BtnStart.SetVisible(bIsLeader && specificDocument.TeamLeagueID == 0UL);
					this.m_BtnMatchMembers.SetVisible(bIsLeader && specificDocument.TeamLeagueID > 0UL);
					ixuilabel.SetText(XSingleton<XStringTable>.singleton.GetString("CREATE_TEAM_LEAGUE"));
				}
				else
				{
					ixuilabel.SetText(XSingleton<XStringTable>.singleton.GetString("START_FIGHT"));
				}
				this.m_MatchMembersIdleLabel.SetVisible(!this.doc.bMatching);
				this.m_MatchMembersMatchingLabel.SetVisible(this.doc.bMatching);
				bool flag5 = this.m_BtnBroadcast.IsVisible();
				if (flag5)
				{
					this.m_BtnBroadcast.SetEnable(true, false);
				}
			}
		}

		private bool _OnStartBtnClick(IXUIButton go)
		{
			bool flag = !this.doc.bIsLeader;
			bool result;
			if (flag)
			{
				result = true;
			}
			else
			{
				bool flag2 = this.doc.currentDungeonType == TeamLevelType.TeamLevelPartner || this.doc.currentDungeonType == TeamLevelType.TeamLevelWeddingLicense;
				if (flag2)
				{
					result = true;
				}
				else
				{
					bool flag3 = this.doc.MyTeam.members.Count < this.doc.currentExpInfo.PlayerLeastNumber && go == this.m_BtnStart;
					if (flag3)
					{
						bool flag4 = this.doc.currentDungeonType == TeamLevelType.TeamLevelGuildMine;
						if (flag4)
						{
							XSingleton<UiUtility>.singleton.ShowModalDialog(XStringDefineProxy.GetString("TEAM_LACK_OF_MEMBERS_CONFIRM", new object[]
							{
								this.doc.currentExpInfo.PlayerLeastNumber.ToString()
							}), XStringDefineProxy.GetString(XStringDefine.COMMON_OK), XStringDefineProxy.GetString(XStringDefine.COMMON_CANCEL), new ButtonClickEventHandler(this._OnStartConfirmBtnClick));
							return true;
						}
					}
					bool flag5 = this.doc.currentDungeonType == TeamLevelType.TeamLevelGuildMine;
					if (flag5)
					{
						XGuildMineEntranceDocument specificDocument = XDocuments.GetSpecificDocument<XGuildMineEntranceDocument>(XGuildMineEntranceDocument.uuID);
						specificDocument.ReqEnterMine();
					}
					else
					{
						bool flag6 = this.doc.currentDungeonType == TeamLevelType.TeamLevelTeamLeague;
						if (flag6)
						{
							DlgBase<XTeamLeagueCreateView, XTeamLeagueCreateBehaviour>.singleton.SetVisibleWithAnimation(true, null);
						}
						else
						{
							this.doc.ReqTeamOp(TeamOperate.TEAM_START_BATTLE, 0UL, null, TeamMemberType.TMT_NORMAL, null);
						}
					}
					result = true;
				}
			}
			return result;
		}

		private bool _OnStartConfirmBtnClick(IXUIButton btn)
		{
			this._OnStartBtnClick(btn);
			XSingleton<UiUtility>.singleton.CloseModalDlg();
			return true;
		}

		private bool _OnBroadcastBtnClick(IXUIButton go)
		{
			bool flag = this.doc.MyTeam == null;
			bool result;
			if (flag)
			{
				result = true;
			}
			else
			{
				bool flag2 = !string.IsNullOrEmpty(this.doc.password);
				if (flag2)
				{
					XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("CantBroadCastCausePassword"), "fece00");
					result = true;
				}
				else
				{
					XInvitationDocument specificDocument = XDocuments.GetSpecificDocument<XInvitationDocument>(XInvitationDocument.uuID);
					TeamLevelType currentDungeonType = this.doc.currentDungeonType;
					NoticeType noticeType;
					if (currentDungeonType != TeamLevelType.TeamLevelExpdition && currentDungeonType != TeamLevelType.TeamLevelNest)
					{
						if (currentDungeonType != TeamLevelType.TeamLevelGuildCamp)
						{
							noticeType = NoticeType.NT_INVITE_NORMALTEAM;
						}
						else
						{
							noticeType = NoticeType.NT_INVITE_GUILDTEAM;
						}
					}
					else
					{
						noticeType = NoticeType.NT_INVITE_NORMALTEAM;
					}
					bool flag3 = noticeType != NoticeType.NT_INVITE_GUILDTEAM || this._CanSendGuildInvite(true);
					if (flag3)
					{
						specificDocument.SendTeamInvitation(noticeType, (uint)this.doc.MyTeam.teamBrief.teamID, this.doc.MyTeam.teamBrief.dungeonID, this.doc.currentDungeonName);
					}
					XGuildDocument specificDocument2 = XDocuments.GetSpecificDocument<XGuildDocument>(XGuildDocument.uuID);
					bool bInGuild = specificDocument2.bInGuild;
					if (bInGuild)
					{
						bool flag4 = this._CanSendGuildInvite(false);
						if (flag4)
						{
							specificDocument.SendTeamInvitation(NoticeType.NT_INVITE_GUILDTEAM, (uint)this.doc.MyTeam.teamBrief.teamID, this.doc.MyTeam.teamBrief.dungeonID, this.doc.currentDungeonName);
						}
					}
					result = true;
				}
			}
			return result;
		}

		private bool _CanSendGuildInvite(bool bShowTips)
		{
			float time = Time.time;
			int @int = XSingleton<XGlobalConfig>.singleton.GetInt("GuildBroadcastCD");
			bool flag = time - this.guildInviteTime >= (float)@int;
			bool result;
			if (flag)
			{
				this.guildInviteTime = time;
				result = true;
			}
			else
			{
				if (bShowTips)
				{
					XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("GUILD_BROADCAST_TIMELIMIT", new object[]
					{
						((int)((float)@int - time + this.guildInviteTime + 1f)).ToString()
					}), "fece00");
				}
				result = false;
			}
			return result;
		}

		private bool _OnMatchMembersBtnClick(IXUIButton go)
		{
			TeamLevelType currentDungeonType = this.doc.currentDungeonType;
			if (currentDungeonType != TeamLevelType.TeamLevelCaptainPVP)
			{
				switch (currentDungeonType)
				{
				case TeamLevelType.TeamLevelHeroBattle:
				case TeamLevelType.TeamLevelMultiPK:
				case TeamLevelType.TeamLevelWeekendParty:
				case TeamLevelType.TeamLevelMoba:
				case TeamLevelType.TeamLevelCustomPKTwo:
					break;
				case TeamLevelType.TeamLevelTeamLeague:
				{
					XFreeTeamVersusLeagueDocument specificDocument = XDocuments.GetSpecificDocument<XFreeTeamVersusLeagueDocument>(XFreeTeamVersusLeagueDocument.uuID);
					specificDocument.ReqMatchGame(!this.doc.bMatching);
					return true;
				}
				case TeamLevelType.TeamLevelFestival:
				case TeamLevelType.TeamLevelTask:
				case TeamLevelType.TeamLevelSkyCraft:
					return true;
				default:
					return true;
				}
			}
			KMatchType type = XTeamDocument.TeamType2MatchType(this.doc.currentDungeonType);
			KMatchOp op = (!this.doc.bMatching) ? KMatchOp.KMATCH_OP_START : KMatchOp.KMATCH_OP_STOP;
			this.doc.ReqMatchStateChange(type, op, true);
			return true;
		}

		private bool _OnOpenListBtnClick(IXUIButton go)
		{
			DlgBase<XTeamListView, XTeamListBehaviour>.singleton.SetVisibleWithAnimation(true, null);
			return true;
		}

		private void _OnSettingBtnClicked(IXUISprite go)
		{
			this.m_SettingHandler.SetVisible(true);
		}

		private bool _OnChatBtnClick(IXUIButton go)
		{
			DlgBase<XChatView, XChatBehaviour>.singleton.ShowChannel(ChatChannelType.Team);
			return true;
		}

		private bool _OnInviteBtnClick(IXUIButton go)
		{
			bool flag = this.doc.currentDungeonType == TeamLevelType.TeamLevelWedding;
			if (flag)
			{
				RoleOutLookBrief teamLoverRole = XWeddingDocument.Doc.GetTeamLoverRole();
				bool flag2 = teamLoverRole != null;
				if (flag2)
				{
					this.doc.ReqTeamOp(TeamOperate.TEAM_INVITE, teamLoverRole.roleid, null, TeamMemberType.TMT_NORMAL, null);
					XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("WeddingLoverInviteTip", new object[]
					{
						teamLoverRole.name
					}), "fece00");
				}
			}
			else
			{
				DlgBase<XTeamInviteView, XTeamInviteBehaviour>.singleton.SetVisibleWithAnimation(true, null);
			}
			return true;
		}

		private void _OnMemberLeaveClick(IXUISprite go)
		{
			int num = (int)go.ID;
			bool flag = !this.doc.bInTeam || num >= this.doc.MyTeam.members.Count;
			if (!flag)
			{
				this.m_SelectedMemberID = this.doc.MyTeam.members[num].uid;
				bool flag2 = this.m_SelectedMemberID == XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
				if (flag2)
				{
					this.doc.ReqTeamOp(TeamOperate.TEAM_LEAVE, 0UL, null, TeamMemberType.TMT_NORMAL, null);
				}
				else
				{
					XSingleton<UiUtility>.singleton.ShowModalDialog(XStringDefineProxy.GetString("TEAM_FIREMEMBER_CONFIRM", new object[]
					{
						this.doc.MyTeam.members[num].name
					}), XStringDefineProxy.GetString("COMMON_OK"), XStringDefineProxy.GetString("COMMON_CANCEL"), new ButtonClickEventHandler(this._DoFireFromTeam));
				}
			}
		}

		private bool _DoFireFromTeam(IXUIButton btn)
		{
			XSingleton<UiUtility>.singleton.CloseModalDlg();
			this.doc.ReqTeamOp(TeamOperate.TEAM_KICK, this.m_SelectedMemberID, null, TeamMemberType.TMT_NORMAL, null);
			return true;
		}

		private void _OnChangeLeaderClick(IXUISprite go)
		{
			int num = (int)go.ID;
			bool flag = !this.doc.bInTeam || num >= this.doc.MyTeam.members.Count;
			if (!flag)
			{
				this.m_SelectedMemberID = this.doc.MyTeam.members[num].uid;
				bool flag2 = this.m_SelectedMemberID != XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
				if (flag2)
				{
					XSingleton<UiUtility>.singleton.ShowModalDialog(XStringDefineProxy.GetString("TEAM_CHANGELEADER_CONFIRM", new object[]
					{
						this.doc.MyTeam.members[num].name
					}), XStringDefineProxy.GetString("COMMON_OK"), XStringDefineProxy.GetString("COMMON_CANCEL"), new ButtonClickEventHandler(this._DoChangeLeader));
				}
			}
		}

		private bool _DoChangeLeader(IXUIButton btn)
		{
			XSingleton<UiUtility>.singleton.CloseModalDlg();
			this.doc.ReqTeamOp(TeamOperate.TEAM_TRAHS_LEADER, this.m_SelectedMemberID, null, TeamMemberType.TMT_NORMAL, null);
			return true;
		}

		private void _OnMemberClicked(IXUISprite go)
		{
			bool flag = !this.doc.bInTeam;
			if (!flag)
			{
				int num = (int)go.ID;
				bool flag2 = num < this.doc.MyTeam.members.Count;
				if (flag2)
				{
					XTeamMember xteamMember = this.doc.MyTeam.members[num];
					bool flag3 = xteamMember.uid == XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
					if (!flag3)
					{
						bool flag4 = !xteamMember.bIsRobot;
						if (flag4)
						{
							XCharacterCommonMenuDocument.ReqCharacterMenuInfo(xteamMember.uid, false);
						}
					}
				}
			}
		}

		private bool _OnAddCountClicked(IXUIButton btn)
		{
			DlgBase<XBuyCountView, XBuyCountBehaviour>.singleton.ActiveShow(this.doc.currentDungeonType);
			return true;
		}

		private void _OnHelperClicked(IXUISprite sp)
		{
			this.doc.ReqTeamOp(TeamOperate.TEAM_MEMBER_TYPE, 0UL, null, this.doc.bIsHelper ? TeamMemberType.TMT_NORMAL : TeamMemberType.TMT_HELPER, null);
		}

		private void _OnTicketClicked(IXUISprite sp)
		{
			this.doc.ReqTeamOp(TeamOperate.TEAM_MEMBER_TYPE, 0UL, null, this.doc.bIsTecket ? TeamMemberType.TMT_NORMAL : TeamMemberType.TMT_USETICKET, null);
		}

		private bool _OnRewardlessPressed(IXUISprite sp, bool isPress)
		{
			Transform transform = sp.transform.Find("Popup");
			transform.gameObject.SetActive(isPress);
			return true;
		}
	}
}