summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/PrerogativeDlg.cs
blob: 8302ed2510634e829005952550ed032079ff6a2c (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
157
158
using System;
using UILib;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient
{
	internal class PrerogativeDlg : DlgBase<PrerogativeDlg, PrerogativeDlgBehaviour>
	{
		public override string fileName
		{
			get
			{
				return "GameSystem/Welfare/PrerogativeFrame";
			}
		}

		public override int sysid
		{
			get
			{
				return XFastEnumIntEqualityComparer<XSysDefine>.ToInt(XSysDefine.XSys_Prerogative);
			}
		}

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

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

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

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

		private XPrerogativeDocument _Doc = null;

		private PreSettingNodeHandler _settingHandler;

		protected override void OnLoad()
		{
			this._Doc.View = null;
			base.OnLoad();
		}

		protected override void Init()
		{
			base.Init();
			DlgHandlerBase.EnsureCreate<PreSettingNodeHandler>(ref this._settingHandler, base.uiBehaviour._setting.gameObject, this, false);
		}

		public override void RegisterEvent()
		{
			base.RegisterEvent();
			this._Doc = XDocuments.GetSpecificDocument<XPrerogativeDocument>(XPrerogativeDocument.uuID);
			this._Doc.View = this;
			base.uiBehaviour._ruleBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnHelpHandler));
			base.uiBehaviour._shopBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.SkipToShop));
			base.uiBehaviour.m_Close.RegisterClickEventHandler(new ButtonClickEventHandler(this.ClickClose));
		}

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

		private bool _OnHelpHandler(IXUIButton btn)
		{
			DlgBase<XCommonHelpTipView, XCommonHelpTipBehaviour>.singleton.ShowHelp(XSysDefine.XSys_Prerogative);
			return true;
		}

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

		private bool ClickClose(IXUIButton btn)
		{
			this.SetVisibleWithAnimation(false, null);
			return false;
		}

		private void SetupFadeIn()
		{
			base.uiBehaviour._desc.SetText(XStringDefineProxy.GetString("XSys_Predesc"));
			bool flag = this._settingHandler != null;
			if (flag)
			{
				bool flag2 = this._settingHandler.IsVisible();
				if (flag2)
				{
					this._settingHandler.RefreshData();
				}
				else
				{
					this._settingHandler.SetVisible(true);
				}
			}
		}

		public override void StackRefresh()
		{
			base.StackRefresh();
			this.Refresh();
		}

		public void Refresh()
		{
			this.SetupSetting();
		}

		protected override void OnUnload()
		{
			DlgHandlerBase.EnsureUnload<PreSettingNodeHandler>(ref this._settingHandler);
			base.OnUnload();
		}

		private void SetupSetting()
		{
			bool flag = this._settingHandler != null && this._settingHandler.IsVisible();
			if (flag)
			{
				this._settingHandler.RefreshData();
			}
		}

		private bool SkipToShop(IXUIButton btn)
		{
			DlgBase<MallSystemDlg, MallSystemBehaviour>.singleton.ShowShopSystem(XSysDefine.XSys_PrerogativeShop, 0UL);
			return true;
		}
	}
}