summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/UI/GuildInheritProcessDlg.cs
blob: 9762b08361e8c6d0b3e3cb4e1b8387cc70741a76 (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
using System;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient.UI
{
	internal class GuildInheritProcessDlg : DlgBase<GuildInheritProcessDlg, GuildInheritProcessBehaviour>
	{
		public override string fileName
		{
			get
			{
				return "Guild/GuildInheritProcessDlg";
			}
		}

		public override bool isMainUI
		{
			get
			{
				return true;
			}
		}

		private XElapseTimer m_lastTime;

		private float m_totalTime;

		private GuildInheritProcessDlg.OnSliderProcessEnd _endEvent;

		public delegate void OnSliderProcessEnd();

		public void ShowProcess(float countdownTime, string mess, string tips, GuildInheritProcessDlg.OnSliderProcessEnd events = null)
		{
			bool flag = this.m_lastTime == null;
			if (flag)
			{
				this.m_lastTime = new XElapseTimer();
			}
			this._endEvent = events;
			this.m_totalTime = countdownTime;
			this.m_lastTime.LeftTime = this.m_totalTime;
			this.SetVisibleWithAnimation(true, null);
			base.uiBehaviour.mProcessLabel.SetText(mess);
			base.uiBehaviour.mContentLabel.SetText(tips);
		}

		public void HideProcess()
		{
			this.SetVisibleWithAnimation(false, null);
		}

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

		protected override void OnUnload()
		{
			this.m_lastTime = null;
			base.OnUnload();
		}

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

		private void UpdateTime()
		{
			this.m_lastTime.Update();
			bool flag = this.m_lastTime.LeftTime > 0f;
			if (flag)
			{
				float value = this.m_lastTime.LeftTime / this.m_totalTime;
				base.uiBehaviour.mProcessSlider.Value = value;
			}
			else
			{
				this.SetVisibleWithAnimation(false, null);
				bool flag2 = this._endEvent != null;
				if (flag2)
				{
					this._endEvent();
				}
			}
		}
	}
}