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

namespace XMainClient.UI
{
	internal class XTeamBattleQuickConfirmView : DlgBase<XTeamBattleQuickConfirmView, XTeamBattleQuickConfirmBehaviour>
	{
		public override string fileName
		{
			get
			{
				return "Team/BattleQuickBeginConfirmDlg";
			}
		}

		public override int layer
		{
			get
			{
				return 1;
			}
		}

		public override int group
		{
			get
			{
				return 1;
			}
		}

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

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

		private XTeamDocument doc;

		private float FIGHT_VOTE_TIME = 3f;

		private float m_fLeftTime;

		private int m_nLeftTime;

		protected override void Init()
		{
			this.doc = XDocuments.GetSpecificDocument<XTeamDocument>(XTeamDocument.uuID);
			this.FIGHT_VOTE_TIME = (float)XSingleton<XGlobalConfig>.singleton.GetInt("TeamFastMatchConfirmT");
		}

		public override void RegisterEvent()
		{
			base.uiBehaviour.m_Cancel.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnCancelBtnClick));
		}

		protected override void OnShow()
		{
			base.OnShow();
			this.m_fLeftTime = this.FIGHT_VOTE_TIME;
			this.m_nLeftTime = (int)this.FIGHT_VOTE_TIME;
			base.uiBehaviour.m_Time.SetText(this.m_nLeftTime.ToString());
			base.uiBehaviour.m_Cancel.SetVisible(true);
		}

		public override void OnUpdate()
		{
			base.OnUpdate();
			bool flag = this.m_fLeftTime > 0f;
			if (flag)
			{
				this.m_fLeftTime -= Time.deltaTime;
				int num = Mathf.CeilToInt(this.m_fLeftTime);
				bool flag2 = this.m_nLeftTime != num;
				if (flag2)
				{
					this.m_nLeftTime = num;
					base.uiBehaviour.m_Time.SetText(this.m_nLeftTime.ToString());
				}
			}
			else
			{
				base.uiBehaviour.m_Cancel.SetVisible(false);
				this.SetVisibleWithAnimation(false, null);
			}
		}

		private bool _OnCancelBtnClick(IXUIButton go)
		{
			PtcC2M_FMBRefuseC2M ptcC2M_FMBRefuseC2M = new PtcC2M_FMBRefuseC2M();
			ptcC2M_FMBRefuseC2M.Data.refuse = true;
			XSingleton<XClientNetwork>.singleton.Send(ptcC2M_FMBRefuseC2M);
			this.SetVisibleWithAnimation(false, null);
			return true;
		}

		protected override void OnPopupBlocked()
		{
			PtcC2M_FMBRefuseC2M ptcC2M_FMBRefuseC2M = new PtcC2M_FMBRefuseC2M();
			ptcC2M_FMBRefuseC2M.Data.refuse = true;
			XSingleton<XClientNetwork>.singleton.Send(ptcC2M_FMBRefuseC2M);
		}
	}
}