summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/UI/SuperRiskDlg.cs
blob: 962d67ad63720a68e74f4a3ba9e11e4385718ce4 (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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
using System;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient.UI
{
	internal class SuperRiskDlg : DlgBase<SuperRiskDlg, SuperRiskDlgBehaviour>
	{
		private XSuperRiskDocument _doc
		{
			get
			{
				return XSuperRiskDocument.Doc;
			}
		}

		public override string fileName
		{
			get
			{
				return "GameSystem/SuperRisk/SuperRiskDlg";
			}
		}

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

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

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

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

		private SuperRiskSelectMapHandler _SelectMapHandler;

		private SuperRiskGameHandler _GameHandler;

		protected override void Init()
		{
			DlgHandlerBase.EnsureCreate<SuperRiskGameHandler>(ref this._GameHandler, base.uiBehaviour.m_RiskMapPanel.transform, false, null);
			DlgHandlerBase.EnsureCreate<SuperRiskSelectMapHandler>(ref this._SelectMapHandler, base.uiBehaviour.m_SelectMapPanel.transform, false, null);
		}

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

		protected override void OnUnload()
		{
			DlgHandlerBase.EnsureUnload<SuperRiskSelectMapHandler>(ref this._SelectMapHandler);
			DlgHandlerBase.EnsureUnload<SuperRiskGameHandler>(ref this._GameHandler);
			base.OnUnload();
		}

		public override void LeaveStackTop()
		{
			bool flag = this._GameHandler != null && this._GameHandler.IsVisible();
			if (flag)
			{
				this._GameHandler.LeaveStackTop();
			}
			base.LeaveStackTop();
		}

		public override void RegisterEvent()
		{
		}

		protected override void OnHide()
		{
			XSingleton<XGameSysMgr>.singleton.RecalculateRedPointState(XSysDefine.XSys_SuperRisk, true);
			base.OnHide();
		}

		protected override void OnShow()
		{
			bool isNeedEnterMainGame = this._doc.IsNeedEnterMainGame;
			if (isNeedEnterMainGame)
			{
				this.ShowGameMap();
				XSuperRiskDocument.Doc.IsNeedEnterMainGame = false;
			}
			else
			{
				this.ShowSelectMap();
			}
		}

		public override void OnUpdate()
		{
			base.OnUpdate();
			bool flag = this._GameHandler != null && this._GameHandler.IsVisible();
			if (flag)
			{
				this._GameHandler.OnUpdate();
			}
		}

		public override void StackRefresh()
		{
			base.StackRefresh();
			bool flag = this._GameHandler != null && this._GameHandler.IsVisible();
			if (flag)
			{
				this._GameHandler.StackRefresh();
			}
		}

		public void Show(bool isNeedEnterMainGame, int mapId = 0)
		{
			this._doc.CurrentMapID = mapId;
			bool flag = !this._doc.IsNeedEnterMainGame;
			if (flag)
			{
				this._doc.IsNeedEnterMainGame = isNeedEnterMainGame;
			}
			this.SetVisibleWithAnimation(true, null);
		}

		public void ShowGameMap()
		{
			this._SelectMapHandler.SetVisible(false);
			this._GameHandler.SetVisible(true);
		}

		public void ShowSelectMap()
		{
			this._GameHandler.SetVisible(false);
			this._SelectMapHandler.SetVisible(true);
		}
	}
}