summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/GuildMinePVPBattleHandler.cs
blob: 4b02fc7b355820a691387dc7ae49b10e7e8a86be (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
using System;
using UILib;
using UnityEngine;
using XMainClient.UI;
using XMainClient.UI.UICommon;

namespace XMainClient
{
	internal class GuildMinePVPBattleHandler : DlgHandlerBase
	{
		protected override string FileName
		{
			get
			{
				return "Battle/SkyArenaBattle";
			}
		}

		private XGuildMineBattleDocument doc = null;

		private Transform m_Info;

		private IXUILabel m_BlueScore;

		private IXUILabel m_RedScore;

		private IXUILabel m_BlueDamage;

		private IXUILabel m_RedDamage;

		private IXUILabel m_TimeLabel;

		private IXUILabel m_RestTip;

		protected override void Init()
		{
			base.Init();
			this.doc = XDocuments.GetSpecificDocument<XGuildMineBattleDocument>(XGuildMineBattleDocument.uuID);
			this.doc.BattleHandler = this;
			this.m_Info = base.transform.Find("Bg/Info");
			this.m_BlueScore = (base.transform.Find("Bg/Info/Blue/Score").GetComponent("XUILabel") as IXUILabel);
			this.m_RedScore = (base.transform.Find("Bg/Info/Red/Score").GetComponent("XUILabel") as IXUILabel);
			this.m_BlueDamage = (base.transform.Find("Bg/Info/Blue/Damage").GetComponent("XUILabel") as IXUILabel);
			this.m_RedDamage = (base.transform.Find("Bg/Info/Red/Damage").GetComponent("XUILabel") as IXUILabel);
			this.m_RestTip = (base.transform.Find("Bg/start").GetComponent("XUILabel") as IXUILabel);
			this.m_TimeLabel = (base.transform.Find("Bg/Time").GetComponent("XUILabel") as IXUILabel);
		}

		public override void RegisterEvent()
		{
		}

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

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

		public override void OnUnload()
		{
			this.doc.BattleHandler = null;
			base.OnUnload();
		}

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

		private void RefreshInfo()
		{
			this.m_BlueScore.SetText("0");
			this.m_RedScore.SetText("0");
			this.m_BlueDamage.SetText("0");
			this.m_RedDamage.SetText("0");
			DlgBase<BattleMain, BattleMainBehaviour>.singleton.HideLeftTime();
			this.m_RestTip.gameObject.SetActive(false);
			this.m_TimeLabel.gameObject.SetActive(false);
		}

		public void SetScore(uint score, bool isBlue)
		{
			if (isBlue)
			{
				this.m_BlueScore.SetText(score.ToString());
			}
			else
			{
				this.m_RedScore.SetText(score.ToString());
			}
		}

		public void SetDamage(ulong damage, bool isBlue)
		{
			if (isBlue)
			{
				this.m_BlueDamage.SetText(damage.ToString());
			}
			else
			{
				this.m_RedDamage.SetText(damage.ToString());
			}
		}

		public void RefreshStatusTime(uint time)
		{
			DlgBase<BattleMain, BattleMainBehaviour>.singleton.SetLeftTime(time, -1);
		}
	}
}