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

namespace XMainClient.UI
{
	internal class XCommonHelpTipView : DlgBase<XCommonHelpTipView, XCommonHelpTipBehaviour>
	{
		public override bool autoload
		{
			get
			{
				return true;
			}
		}

		public override string fileName
		{
			get
			{
				return "Common/CommonHelpTip";
			}
		}

		private SystemHelpTable _systemHelpReader = null;

		private string m_title;

		private string m_content;

		public void ShowHelp(string title, string content)
		{
			this.m_title = title;
			this.m_content = XSingleton<UiUtility>.singleton.ReplaceReturn(content);
			bool flag = !base.IsVisible();
			if (flag)
			{
				this.SetVisibleWithAnimation(true, null);
			}
		}

		public void ShowHelp(int sysID)
		{
			bool flag = this._systemHelpReader == null;
			if (flag)
			{
				this._systemHelpReader = new SystemHelpTable();
				XSingleton<XResourceLoaderMgr>.singleton.ReadFile("Table/SystemHelp", this._systemHelpReader);
			}
			SystemHelpTable.RowData bySystemID = this._systemHelpReader.GetBySystemID(sysID);
			bool flag2 = bySystemID != null;
			if (flag2)
			{
				bool flag3 = bySystemID.SystemHelp != null && bySystemID.SystemHelp.Length != 0;
				if (flag3)
				{
					this.m_title = bySystemID.SystemHelp[0];
				}
				bool flag4 = bySystemID.SystemHelp != null && bySystemID.SystemHelp.Length > 1;
				if (flag4)
				{
					this.m_content = XSingleton<UiUtility>.singleton.ReplaceReturn(bySystemID.SystemHelp[1]);
				}
			}
			bool flag5 = !base.IsVisible();
			if (flag5)
			{
				this.SetVisibleWithAnimation(true, null);
			}
		}

		public void ShowHelp(XSysDefine sys)
		{
			this.m_title = "";
			this.m_content = "";
			bool flag = this._systemHelpReader == null;
			if (flag)
			{
				this._systemHelpReader = new SystemHelpTable();
				XSingleton<XResourceLoaderMgr>.singleton.ReadFile("Table/SystemHelp", this._systemHelpReader);
			}
			int key = XFastEnumIntEqualityComparer<XSysDefine>.ToInt(sys);
			SystemHelpTable.RowData bySystemID = this._systemHelpReader.GetBySystemID(key);
			bool flag2 = bySystemID != null;
			if (flag2)
			{
				bool flag3 = bySystemID.SystemHelp != null && bySystemID.SystemHelp.Length != 0;
				if (flag3)
				{
					this.m_title = bySystemID.SystemHelp[0];
				}
				bool flag4 = bySystemID.SystemHelp != null && bySystemID.SystemHelp.Length > 1;
				if (flag4)
				{
					this.m_content = XSingleton<UiUtility>.singleton.ReplaceReturn(bySystemID.SystemHelp[1]);
				}
			}
			bool flag5 = !base.IsVisible();
			if (flag5)
			{
				this.SetVisibleWithAnimation(true, null);
			}
		}

		protected override void OnShow()
		{
			base.OnShow();
			base.uiBehaviour.m_Title.SetText(this.m_title);
			base.uiBehaviour.m_Content.SetText(this.m_content);
			base.uiBehaviour.m_ScrollView.ResetPosition();
		}

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

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