summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/UI/HeroBattleHandler.cs
blob: 8c394044635ec403a5e6112a821e91ae8c91d08c (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
using System;
using System.Collections.Generic;
using KKSG;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient.UI
{
	internal class HeroBattleHandler : DlgHandlerBase
	{
		protected override string FileName
		{
			get
			{
				return "Battle/HeroBattleHandler";
			}
		}

		private XHeroBattleDocument _doc = null;

		private XHeroBattleSkillDocument _skillDoc = null;

		private List<HeroBattleTeam> m_Team = new List<HeroBattleTeam>();

		private GameObject m_Death;

		private IXUILabel m_ReviveLeftTime;

		private Transform m_ProgressTs;

		private IXUILabel m_ProgressTips;

		private Transform m_ProgressTipsTs;

		private IXUIProgress m_Progress;

		private Transform m_AddTimeTs;

		private IXUIProgress m_AddTimeProgress;

		private IXUIButton m_ChangeHeroBtn;

		private IXUILabel m_KillText;

		private IXUILabel m_DeadText;

		private IXUILabel m_AssitText;

		private Transform m_AncientParent;

		private IXUILabel m_AncientPercent;

		private IXUIProgress m_AncientSlider;

		private IXUISprite[] m_AncientSkill = new IXUISprite[3];

		private bool _isAncientFull;

		private IXUISprite m_AttrShowBtn;

		private IXUISprite m_AncientTipsBtn;

		private IXUISprite m_AncientTipsCloseBtn;

		private IXUILabel m_AncientTips;

		private uint m_AncientTipsCloseToken;

		private Color blueColor;

		private Color redColor;

		private XFx _Fx;

		private XFx _OccupantFx;

		private XFx _EndFx;

		private uint _MiniMapFxToken;

		private uint _CurrentOccupant;

		private bool _InCircleMyself;

		private bool _IsInFight;

		private uint _ProgressTeam;

		private bool _InAddTime;

		private float _AddTimePerTurn;

		private float _SignTime;

		private bool _OnDeath;

		private float _ReviveTime;

		private float _ReviveSignTime;

		private float _LootProgress;

		private bool _HaveEnd;

		private XFx[] _skillFx = new XFx[3];

		private XFx _barFx;

		public MapSignalHandler m_MapSignalHandler;

		protected override void Init()
		{
			base.Init();
			this._doc = XDocuments.GetSpecificDocument<XHeroBattleDocument>(XHeroBattleDocument.uuID);
			this._skillDoc = XDocuments.GetSpecificDocument<XHeroBattleSkillDocument>(XHeroBattleSkillDocument.uuID);
			this._doc._HeroBattleHandler = this;
			this.m_Death = base.transform.Find("Death").gameObject;
			this.m_Death.transform.localPosition = XGameUI.Far_Far_Away;
			this.m_ReviveLeftTime = (this.m_Death.transform.Find("LeftTime").GetComponent("XUILabel") as IXUILabel);
			this.m_ChangeHeroBtn = (this.m_Death.gameObject.transform.Find("ChangeHeroBtn").GetComponent("XUIButton") as IXUIButton);
			this.m_ProgressTs = base.transform.Find("Progress");
			this.m_ProgressTipsTs = base.transform.Find("TextTs");
			this.m_ProgressTs.localPosition = XGameUI.Far_Far_Away;
			this.m_ProgressTipsTs.localPosition = XGameUI.Far_Far_Away;
			this.m_Progress = (this.m_ProgressTs.Find("ProgressBar").GetComponent("XUIProgress") as IXUIProgress);
			this.m_AddTimeTs = base.transform.Find("AddTime");
			this.m_AddTimeTs.localPosition = XGameUI.Far_Far_Away;
			this.m_AddTimeProgress = (this.m_AddTimeTs.Find("AddtimeBar").GetComponent("XUIProgress") as IXUIProgress);
			this.m_ProgressTips = (base.transform.Find("TextTs/Text").GetComponent("XUILabel") as IXUILabel);
			this.m_ProgressTips.SetText(XStringDefineProxy.GetString("HeroBattleLoot"));
			GameObject gameObject = base.transform.Find("Score").gameObject;
			gameObject.SetActive(!XSingleton<XScene>.singleton.bSpectator);
			this.m_KillText = (base.transform.Find("Score/kill").GetComponent("XUILabel") as IXUILabel);
			this.m_DeadText = (base.transform.Find("Score/dead").GetComponent("XUILabel") as IXUILabel);
			this.m_AssitText = (base.transform.Find("Score/help").GetComponent("XUILabel") as IXUILabel);
			this.m_AttrShowBtn = (base.transform.Find("AttrShowBtn").GetComponent("XUISprite") as IXUISprite);
			this.m_AncientParent = base.transform.Find("AncientBarParent");
			this.m_AncientPercent = (base.transform.Find("AncientBarParent/AncientSkillBar/Num").GetComponent("XUILabel") as IXUILabel);
			this.m_AncientSlider = (base.transform.Find("AncientBarParent/AncientSkillBar").GetComponent("XUIProgress") as IXUIProgress);
			for (int i = 0; i < 3; i++)
			{
				this.m_AncientSkill[i] = (base.transform.Find(string.Format("AncientSkill/Skill{0}", i)).GetComponent("XUISprite") as IXUISprite);
				this.m_AncientSkill[i].ID = (ulong)((long)i + 1L);
				this.m_AncientSkill[i].RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnAncientSkillClick));
				this.m_AncientSkill[i].SetVisible(false);
			}
			this._isAncientFull = false;
			this.SetAncientPercent(0f);
			this.m_AncientTipsBtn = (base.transform.Find("AncientBarParent/AncientSkillBar/Foreground").GetComponent("XUISprite") as IXUISprite);
			this.m_AncientTips = (base.transform.Find("AncientTips/Desc").GetComponent("XUILabel") as IXUILabel);
			this.m_AncientTipsCloseBtn = (base.transform.Find("AncientTips/Close").GetComponent("XUISprite") as IXUISprite);
			this.m_AncientTips.gameObject.transform.parent.gameObject.SetActive(false);
			this.m_Team.Clear();
			HeroBattleTeam item = new HeroBattleTeam(base.transform.Find("Scoreboard/BlueTeam"));
			HeroBattleTeam item2 = new HeroBattleTeam(base.transform.Find("Scoreboard/RedTeam"));
			this.m_Team.Add(item);
			this.m_Team.Add(item2);
			List<int> intList = XSingleton<XGlobalConfig>.singleton.GetIntList("HeroBattleBlueColor");
			this.blueColor = new Color((float)intList[0] / 255f, (float)intList[1] / 255f, (float)intList[2] / 255f);
			intList = XSingleton<XGlobalConfig>.singleton.GetIntList("HeroBattleRedColor");
			this.redColor = new Color((float)intList[0] / 255f, (float)intList[1] / 255f, (float)intList[2] / 255f);
			this._AddTimePerTurn = float.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("HeroBattleOverTime"));
			this._ReviveTime = float.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("HeroBattleReviveTime"));
			this._CurrentOccupant = 0u;
			this._InCircleMyself = false;
			this._IsInFight = false;
			this._ProgressTeam = 0u;
			this._LootProgress = 0f;
			this._MiniMapFxToken = 0u;
			this._InAddTime = false;
			this._OnDeath = false;
			this._HaveEnd = false;
			this.SetFx(0u);
			bool bSpectator = XSingleton<XScene>.singleton.bSpectator;
			if (bSpectator)
			{
				this.m_AncientSlider.SetVisible(false);
				base.transform.Find("MapSignalHandler").gameObject.SetActive(false);
				this.m_AttrShowBtn.SetVisible(false);
			}
			else
			{
				DlgHandlerBase.EnsureCreate<MapSignalHandler>(ref this.m_MapSignalHandler, base.transform.Find("MapSignalHandler").gameObject, this, true);
			}
		}

		public override void RegisterEvent()
		{
			base.RegisterEvent();
			this.m_ChangeHeroBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnChangeHeroBtnClick));
			this.m_AttrShowBtn.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnAttrShowBtnClick));
			this.m_AncientTipsBtn.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnAncientTipsBtnClick));
			this.m_AncientTipsCloseBtn.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnAncientCloseBtnClick));
		}

		public void OnAttrShowBtnClick(IXUISprite isp)
		{
			bool flag = XSingleton<XAttributeMgr>.singleton.XPlayerData == null;
			if (!flag)
			{
				uint num = 0u;
				this._doc.heroIDIndex.TryGetValue(XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID, out num);
				bool flag2 = num > 0u;
				if (flag2)
				{
					DlgBase<HeroAttrDlg, HeroAttrBehaviour>.singleton.ShowByType(SceneType.SCENE_HEROBATTLE, num);
				}
			}
		}

		public override void OnUnload()
		{
			this._doc._HeroBattleHandler = null;
			XSingleton<XTimerMgr>.singleton.KillTimer(this.m_AncientTipsCloseToken);
			bool flag = this._Fx != null;
			if (flag)
			{
				XSingleton<XFxMgr>.singleton.DestroyFx(this._Fx, true);
				this._Fx = null;
			}
			bool flag2 = this._OccupantFx != null;
			if (flag2)
			{
				XSingleton<XFxMgr>.singleton.DestroyFx(this._OccupantFx, true);
				this._OccupantFx = null;
			}
			bool flag3 = this._EndFx != null;
			if (flag3)
			{
				XSingleton<XFxMgr>.singleton.DestroyFx(this._EndFx, true);
				this._EndFx = null;
			}
			bool flag4 = this._barFx != null;
			if (flag4)
			{
				XSingleton<XFxMgr>.singleton.DestroyFx(this._barFx, true);
				this._barFx = null;
			}
			for (int i = 0; i < this._skillFx.Length; i++)
			{
				bool flag5 = this._skillFx[i] != null;
				if (flag5)
				{
					XSingleton<XFxMgr>.singleton.DestroyFx(this._skillFx[i], true);
					this._skillFx[i] = null;
				}
			}
			bool bSpectator = XSingleton<XScene>.singleton.bSpectator;
			if (bSpectator)
			{
				XSpectateSceneDocument.DelMiniMapFx(this._MiniMapFxToken);
			}
			else
			{
				XBattleDocument.DelMiniMapFx(this._MiniMapFxToken);
			}
			bool flag6 = this.m_MapSignalHandler != null;
			if (flag6)
			{
				DlgHandlerBase.EnsureUnload<MapSignalHandler>(ref this.m_MapSignalHandler);
			}
			base.OnUnload();
		}

		protected override void OnShow()
		{
			base.OnShow();
		}

		public void SetTeamData(HeroBattleTeamMsg data)
		{
			int num = (this._doc.MyTeam == data.teamdata[0].teamid) ? 0 : 1;
			this.m_Team[0].Score = data.teamdata[num].point;
			this.m_Team[1].Score = data.teamdata[1 - num].point;
			bool flag = !this._HaveEnd;
			if (flag)
			{
				bool flag2 = data.teamdata[0].point == 100u || data.teamdata[1].point == 100u;
				if (flag2)
				{
					this._HaveEnd = true;
					bool flag3 = data.teamdata[0].point == 100u;
					if (flag3)
					{
						this.SetResultFx(data.teamdata[0].teamid == this._doc.MyTeam);
					}
					else
					{
						this.SetResultFx(data.teamdata[1].teamid == this._doc.MyTeam);
					}
				}
			}
		}

		public void SetResultFx(bool isWinMySelf)
		{
			HeroBattleMapCenter.RowData bySceneID = this._doc.HeroBattleMapReader.GetBySceneID(XSingleton<XScene>.singleton.SceneID);
			bool flag = bySceneID == null;
			if (flag)
			{
				XSingleton<XDebug>.singleton.AddErrorLog("Can't find hero battle map data by sceneID = ", XSingleton<XScene>.singleton.SceneID.ToString(), null, null, null, null);
			}
			else
			{
				Vector3 position;
				position= new Vector3(bySceneID.Center[0], bySceneID.Center[1], bySceneID.Center[2]);
				bool flag2 = this._EndFx != null;
				if (flag2)
				{
					XSingleton<XFxMgr>.singleton.DestroyFx(this._EndFx, true);
				}
				if (isWinMySelf)
				{
					this._EndFx = XSingleton<XFxMgr>.singleton.CreateFx(bySceneID.OccWinFx[0], null, true);
				}
				else
				{
					this._EndFx = XSingleton<XFxMgr>.singleton.CreateFx(bySceneID.OccWinFx[1], null, true);
				}
				this._EndFx.Play(position, Quaternion.identity, Vector3.one, 1f);
			}
		}

		public void SetProgressData(HeroBattleSyncData data)
		{
			bool flag = this._IsInFight != data.isInFight;
			if (flag)
			{
				this.m_ProgressTips.SetText(XStringDefineProxy.GetString(data.isInFight ? "HeroBattleInFight" : "HeroBattleLoot"));
				this._IsInFight = data.isInFight;
			}
			bool flag2 = this._CurrentOccupant != data.occupant;
			int num;
			if (flag2)
			{
				num = ((this._doc.MyTeam == data.occupant) ? 0 : 1);
				this.m_Team[num].SetOccupantState(true);
				this.m_Team[1 - num].SetOccupantState(false);
				this._CurrentOccupant = data.occupant;
				this.SetFx(this._CurrentOccupant);
			}
			num = ((this._doc.MyTeam == data.lootTeam) ? 0 : 1);
			bool flag3 = this._ProgressTeam != data.lootTeam;
			if (flag3)
			{
				bool flag4 = data.lootTeam > 0u;
				if (flag4)
				{
					this.m_Progress.SetForegroundColor((num == 0) ? this.blueColor : this.redColor);
					this.m_Team[(this._ProgressTeam == this._doc.MyTeam) ? 0 : 1].SetOccupyValue(0f);
				}
				else
				{
					this.m_Team[(this._ProgressTeam == this._doc.MyTeam) ? 0 : 1].SetOccupyValue(0f);
					this.m_ProgressTs.localPosition = XGameUI.Far_Far_Away;
					this.m_ProgressTipsTs.localPosition = XGameUI.Far_Far_Away;
				}
				this._ProgressTeam = data.lootTeam;
			}
			bool flag5 = this._ProgressTeam > 0u;
			if (flag5)
			{
				this.m_Team[num].SetOccupyValue(data.lootProgress / 100f);
				this.m_Progress.value = data.lootProgress / 100f;
				this._LootProgress = data.lootProgress;
			}
			this.m_ProgressTs.localPosition = ((this._InCircleMyself && this._ProgressTeam != 0u && this._LootProgress > 0.5f) ? Vector3.zero : XGameUI.Far_Far_Away);
			this.m_ProgressTipsTs.localPosition = ((this._IsInFight || (this._InCircleMyself && this._ProgressTeam != 0u)) ? Vector3.zero : XGameUI.Far_Far_Away);
		}

		public void SetInCircleData(HeroBattleInCircle data)
		{
			bool flag = false;
			bool bSpectator = XSingleton<XScene>.singleton.bSpectator;
			if (bSpectator)
			{
				flag = true;
			}
			else
			{
				for (int i = 0; i < data.roleInCircle.Count; i++)
				{
					bool flag2 = data.roleInCircle[i] == XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
					if (flag2)
					{
						flag = true;
					}
				}
			}
			bool flag3 = this._InCircleMyself != flag;
			if (flag3)
			{
				this._InCircleMyself = flag;
				this.m_ProgressTs.localPosition = ((this._InCircleMyself && this._ProgressTeam != 0u && this._LootProgress > 0.5f) ? Vector3.zero : XGameUI.Far_Far_Away);
			}
			this.m_ProgressTipsTs.localPosition = ((this._IsInFight || (this._InCircleMyself && this._ProgressTeam != 0u)) ? Vector3.zero : XGameUI.Far_Far_Away);
		}

		public void StartAddTime(int time)
		{
			this._InAddTime = (time != 0);
			this._AddTimePerTurn = (float)time / 1000f;
			this.m_AddTimeTs.localPosition = (this._InAddTime ? Vector3.zero : XGameUI.Far_Far_Away);
			this._SignTime = Time.realtimeSinceStartup;
		}

		public void RefreshScoreBoard(uint kill, uint dead, uint assit)
		{
			this.m_KillText.SetText(kill.ToString());
			this.m_DeadText.SetText(dead.ToString());
			this.m_AssitText.SetText(assit.ToString());
		}

		public void SetFx(uint occupant)
		{
			HeroBattleMapCenter.RowData bySceneID = this._doc.HeroBattleMapReader.GetBySceneID(XSingleton<XScene>.singleton.SceneID);
			bool flag = bySceneID == null;
			if (flag)
			{
				XSingleton<XDebug>.singleton.AddErrorLog("Can't find hero battle map data by sceneID = ", XSingleton<XScene>.singleton.SceneID.ToString(), null, null, null, null);
			}
			else
			{
				Vector3 vector;
				vector= new Vector3(bySceneID.Center[0], bySceneID.Center[1], bySceneID.Center[2]);
				float num = bySceneID.Param[0] * bySceneID.ClientFxScalse;
				float num2 = ((bySceneID.CenterType == 1u) ? bySceneID.Param[0] : bySceneID.Param[1]) * bySceneID.ClientFxScalse;
				Vector3 scale;
				scale= new Vector3(num, 1f, num2);
				bool flag2 = this._Fx != null;
				if (flag2)
				{
					XSingleton<XFxMgr>.singleton.DestroyFx(this._Fx, true);
					this._Fx = null;
				}
				bool bSpectator = XSingleton<XScene>.singleton.bSpectator;
				if (bSpectator)
				{
					XSpectateSceneDocument.DelMiniMapFx(this._MiniMapFxToken);
				}
				else
				{
					XBattleDocument.DelMiniMapFx(this._MiniMapFxToken);
				}
				bool flag3 = occupant == 0u;
				if (flag3)
				{
					this._Fx = XSingleton<XFxMgr>.singleton.CreateFx(bySceneID.OccupantFx[0], null, true);
					bool bSpectator2 = XSingleton<XScene>.singleton.bSpectator;
					if (bSpectator2)
					{
						this._MiniMapFxToken = XSpectateSceneDocument.AddMiniMapFx(vector, bySceneID.MiniMapFx[0]);
					}
					else
					{
						this._MiniMapFxToken = XBattleDocument.AddMiniMapFx(vector, bySceneID.MiniMapFx[0]);
					}
				}
				else
				{
					bool flag4 = occupant == this._doc.MyTeam;
					if (flag4)
					{
						this._Fx = XSingleton<XFxMgr>.singleton.CreateFx(bySceneID.OccupantFx[1], null, true);
						bool bSpectator3 = XSingleton<XScene>.singleton.bSpectator;
						if (bSpectator3)
						{
							this._MiniMapFxToken = XSpectateSceneDocument.AddMiniMapFx(vector, bySceneID.MiniMapFx[1]);
						}
						else
						{
							this._MiniMapFxToken = XBattleDocument.AddMiniMapFx(vector, bySceneID.MiniMapFx[1]);
						}
					}
					else
					{
						this._Fx = XSingleton<XFxMgr>.singleton.CreateFx(bySceneID.OccupantFx[2], null, true);
						bool bSpectator4 = XSingleton<XScene>.singleton.bSpectator;
						if (bSpectator4)
						{
							this._MiniMapFxToken = XSpectateSceneDocument.AddMiniMapFx(vector, bySceneID.MiniMapFx[2]);
						}
						else
						{
							this._MiniMapFxToken = XBattleDocument.AddMiniMapFx(vector, bySceneID.MiniMapFx[2]);
						}
					}
				}
				this._Fx.Play(vector, Quaternion.identity, scale, 1f);
				bool flag5 = occupant > 0u;
				if (flag5)
				{
					bool flag6 = this._OccupantFx != null;
					if (flag6)
					{
						XSingleton<XFxMgr>.singleton.DestroyFx(this._OccupantFx, true);
					}
					bool flag7 = occupant == this._doc.MyTeam;
					if (flag7)
					{
						this._OccupantFx = XSingleton<XFxMgr>.singleton.CreateFx(bySceneID.OccSuccessFx[0], null, true);
					}
					else
					{
						this._OccupantFx = XSingleton<XFxMgr>.singleton.CreateFx(bySceneID.OccSuccessFx[1], null, true);
					}
					this._OccupantFx.Play(vector, Quaternion.identity, scale, 1f);
				}
			}
		}

		private bool OnChangeHeroBtnClick(IXUIButton btn)
		{
			bool flag = this._skillDoc.m_HeroBattleSkillHandler != null;
			if (flag)
			{
				this._skillDoc.m_HeroBattleSkillHandler.SetVisible(true);
				this._skillDoc.m_HeroBattleSkillHandler.RefreshTab();
			}
			return true;
		}

		public void SetDeathGoState(bool state)
		{
			this.m_Death.gameObject.transform.localPosition = (state ? Vector3.zero : XGameUI.Far_Far_Away);
		}

		public void SetReviveLeftTime()
		{
			this._OnDeath = true;
			this._ReviveSignTime = Time.realtimeSinceStartup;
		}

		public override void OnUpdate()
		{
			bool inAddTime = this._InAddTime;
			if (inAddTime)
			{
				float num = Time.realtimeSinceStartup - this._SignTime;
				this.m_AddTimeProgress.value = 1f - num / this._AddTimePerTurn;
				bool flag = num > this._AddTimePerTurn;
				if (flag)
				{
					this._InAddTime = false;
					this.m_AddTimeTs.localPosition = XGameUI.Far_Far_Away;
				}
			}
			bool onDeath = this._OnDeath;
			if (onDeath)
			{
				float num = Time.realtimeSinceStartup - this._ReviveSignTime;
				int num2 = (int)(this._ReviveTime - num);
				this.m_ReviveLeftTime.SetText(num2.ToString());
				bool flag2 = this._ReviveTime - num < 0f;
				if (flag2)
				{
					this._OnDeath = false;
				}
			}
		}

		private void PlayShowSkillFx()
		{
			bool flag = this._barFx != null;
			if (flag)
			{
				XSingleton<XFxMgr>.singleton.DestroyFx(this._barFx, true);
			}
			this._barFx = XSingleton<XFxMgr>.singleton.CreateUIFx("Effects/FX_Particle/UIfx/UI_yxxg_jindutiao", this.m_AncientParent, false);
			for (int i = 0; i < 3; i++)
			{
				bool flag2 = this._skillFx[i] != null;
				if (flag2)
				{
					XSingleton<XFxMgr>.singleton.DestroyFx(this._skillFx[i], true);
				}
				switch (i)
				{
				case 0:
					this._skillFx[i] = XSingleton<XFxMgr>.singleton.CreateUIFx("Effects/FX_Particle/UIfx/UI_yxxg_tubiao_hong", this.m_AncientSkill[i].transform, false);
					break;
				case 1:
					this._skillFx[i] = XSingleton<XFxMgr>.singleton.CreateUIFx("Effects/FX_Particle/UIfx/UI_yxxg_tubiao_lan", this.m_AncientSkill[i].transform, false);
					break;
				case 2:
					this._skillFx[i] = XSingleton<XFxMgr>.singleton.CreateUIFx("Effects/FX_Particle/UIfx/UI_yxxg_tubiao_lu", this.m_AncientSkill[i].transform, false);
					break;
				}
			}
		}

		protected void DestroyShowSkillFx(object o)
		{
			GameObject o2 = o as GameObject;
			XSingleton<XResourceLoaderMgr>.singleton.UnSafeDestroy(o2, true, false);
		}

		private void OnAncientSkillClick(IXUISprite iSp)
		{
			this._doc.QueryUseAncientSkill((int)iSp.ID);
		}

		public void SetAncientPercent(float percent)
		{
			bool flag = percent > 99.99f;
			if (flag)
			{
				percent = 100f;
			}
			bool flag2 = percent == 100f;
			bool flag3 = flag2 != this._isAncientFull;
			if (flag3)
			{
				for (int i = 0; i < 3; i++)
				{
					this.m_AncientSkill[i].SetVisible(flag2);
				}
				this.m_AncientSlider.SetVisible(!flag2);
				bool flag4 = flag2;
				if (flag4)
				{
					this.PlayShowSkillFx();
				}
				this._isAncientFull = flag2;
				bool flag5 = flag2;
				if (flag5)
				{
					this.OnAncientCloseBtnClick(null);
				}
			}
			this.m_AncientSlider.value = percent / 100f;
			this.m_AncientPercent.SetText(string.Format("{0}%", (int)(percent + 0.49f)));
		}

		public void OnAncientTipsBtnClick(IXUISprite iSp)
		{
			this.m_AncientTips.gameObject.transform.parent.gameObject.SetActive(true);
			this.m_AncientTips.SetText(XSingleton<UiUtility>.singleton.ReplaceReturn(XStringDefineProxy.GetString("HeroBattleAncientTips")));
			this.m_AncientTipsCloseToken = XSingleton<XTimerMgr>.singleton.SetTimer(5f, new XTimerMgr.ElapsedEventHandler(this.AutoClose), null);
		}

		public void AutoClose(object o = null)
		{
			this.OnAncientCloseBtnClick(null);
		}

		public void OnAncientCloseBtnClick(IXUISprite iSp)
		{
			this.m_AncientTips.gameObject.transform.parent.gameObject.SetActive(false);
			XSingleton<XTimerMgr>.singleton.KillTimer(this.m_AncientTipsCloseToken);
		}
	}
}