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

namespace XMainClient.UI
{
	internal class PPTCheckMgr : XSingleton<PPTCheckMgr>
	{
		private ButtonClickEventHandler mGoStillHandler;

		public bool CheckMyPPT(int needPPT)
		{
			XMainInterfaceDocument xmainInterfaceDocument = XSingleton<XGame>.singleton.Doc.GetXComponent(XMainInterfaceDocument.uuID) as XMainInterfaceDocument;
			int playerPPT = xmainInterfaceDocument.GetPlayerPPT();
			return playerPPT >= needPPT;
		}

		public void ShowPPTNotEnoughDlg(ulong btnID, ButtonClickEventHandler goBattleHandle)
		{
			this.mGoStillHandler = goBattleHandle;
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.Load();
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetSingleButtonMode(false);
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(false, true);
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetLabelsWithSymbols(XStringDefineProxy.GetString("LEVEL_POWERLOWER"), XStringDefineProxy.GetString("LEVEL_POWERUP"), XStringDefineProxy.GetString("LEVEL_CONTINUE"));
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.uiBehaviour.m_CancelButton.ID = btnID;
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetModalCallback(new ButtonClickEventHandler(this.GoPowerUp), new ButtonClickEventHandler(this.GoStill));
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetTweenTargetAndPlay(DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.uiBehaviour.gameObject);
		}

		private bool GoStill(IXUIButton go)
		{
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(false, true);
			bool flag = this.mGoStillHandler != null;
			if (flag)
			{
				this.mGoStillHandler(go);
			}
			this.mGoStillHandler = null;
			return true;
		}

		private bool GoPowerUp(IXUIButton go)
		{
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(false, true);
			bool flag = !XSingleton<XGameSysMgr>.singleton.IsSystemOpened(XSysDefine.XSys_Strong);
			bool result;
			if (flag)
			{
				XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("StrengthNotOpen"), "fece00");
				result = true;
			}
			else
			{
				XSingleton<UIManager>.singleton.ClearUIinStack();
				XSingleton<XGameSysMgr>.singleton.OpenSystem(XFastEnumIntEqualityComparer<XSysDefine>.ToInt(XSysDefine.XSys_Strong));
				result = true;
			}
			return result;
		}
	}
}