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

namespace XMainClient
{
	internal class InGameADView : DlgBase<InGameADView, InGameADBehaviour>
	{
		private uint npcID
		{
			get
			{
				return uint.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("InGameADNPCID"));
			}
		}

		private string tex
		{
			get
			{
				return XSingleton<XGlobalConfig>.singleton.GetValue("InGameADTex");
			}
		}

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

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

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

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

		public override void RegisterEvent()
		{
			base.uiBehaviour.m_Close.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseClicked));
			base.uiBehaviour.m_BtnGo.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnGoClick));
		}

		public bool OnCloseClicked(IXUIButton btn)
		{
			this.SetVisibleWithAnimation(false, null);
			return true;
		}

		public void OnGoClick(IXUISprite btn)
		{
			XSingleton<XInput>.singleton.LastNpc = XSingleton<XEntityMgr>.singleton.GetNpc(this.npcID);
			this.SetVisibleWithAnimation(false, null);
		}

		protected override void OnShow()
		{
			base.OnShow();
			base.uiBehaviour.m_Tex.SetTexturePath(this.tex);
		}

		protected override void OnHide()
		{
			base.uiBehaviour.m_Tex.SetTexturePath("");
			base.OnHide();
		}

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