summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/UI/WeekendPartyHandler.cs
blob: 130f40c6d40acfbc18c4acbffce2cad74f7fe9f1 (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
using System;
using KKSG;
using UILib;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

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

		private XWeekendPartyDocument m_Doc;

		private IXUILabel m_BlueScore;

		private IXUILabel m_RedScore;

		private IXUILabel m_ReviveTime;

		private XLeftTimeCounter m_LeftTimeCounter;

		protected override void Init()
		{
			base.Init();
			this.m_Doc = XDocuments.GetSpecificDocument<XWeekendPartyDocument>(XWeekendPartyDocument.uuID);
			this.m_Doc.WeekendPartyBattleHandler = this;
			this.m_BlueScore = (base.PanelObject.transform.Find("Battle/Score/Bluenum").GetComponent("XUILabel") as IXUILabel);
			this.m_RedScore = (base.PanelObject.transform.Find("Battle/Score/Rednum").GetComponent("XUILabel") as IXUILabel);
			this.m_ReviveTime = (base.PanelObject.transform.Find("LeftTime").GetComponent("XUILabel") as IXUILabel);
			this.m_LeftTimeCounter = new XLeftTimeCounter(this.m_ReviveTime, true);
			this.m_LeftTimeCounter.SetFormat(false);
		}

		public override void RegisterEvent()
		{
			base.RegisterEvent();
		}

		public override void OnUnload()
		{
			this.m_Doc.WeekendPartyBattleHandler = null;
			base.OnUnload();
		}

		protected override void OnShow()
		{
			base.OnShow();
			this.RefreshWeekendPartyBattleData();
			this.SetLeftTime();
		}

		private void SetLeftTime()
		{
			WeekEnd4v4List.RowData activityInfo = this.m_Doc.GetActivityInfo(this.m_Doc.CurrActID);
			bool flag = activityInfo != null;
			if (flag)
			{
				bool flag2 = DlgBase<BattleMain, BattleMainBehaviour>.singleton.IsLoaded() && DlgBase<BattleMain, BattleMainBehaviour>.singleton.IsVisible();
				if (flag2)
				{
					DlgBase<BattleMain, BattleMainBehaviour>.singleton.SetLeftTime(activityInfo.MaxTime, -1);
				}
			}
		}

		public void RefreshWeekendPartyBattleData()
		{
			bool flag = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_WEEKEND4V4_CRAZYBOMB || XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_WEEKEND4V4_LIVECHALLENGE;
			if (flag)
			{
				this.m_BlueScore.SetText(this.m_Doc.EnemyScore.ToString());
				this.m_RedScore.SetText(this.m_Doc.SelfScore.ToString());
			}
			else
			{
				this.m_BlueScore.SetText(this.m_Doc.SelfScore.ToString());
				this.m_RedScore.SetText(this.m_Doc.EnemyScore.ToString());
			}
		}

		public void ShowReviveUI(uint time)
		{
			this.m_LeftTimeCounter.SetLeftTime(time, -1);
		}

		public override void OnUpdate()
		{
			this.m_LeftTimeCounter.Update();
		}
	}
}