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

namespace XMainClient.UI
{
	internal class PressTipsDlg : DlgBase<PressTipsDlg, PressTipsBehaviour>
	{
		public override string fileName
		{
			get
			{
				return "Common/PressTipDlg";
			}
		}

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

		private string _contentKey;

		private Vector3 _offset;

		private Vector3 _pos;

		public void Setup(bool show, string key, Vector3 pos, Vector3 offset)
		{
			if (show)
			{
				this._contentKey = key;
				this._offset = offset;
				this._pos = pos;
				bool flag = !base.IsVisible();
				if (flag)
				{
					this._Show();
				}
				else
				{
					this.RefreshData();
				}
			}
			else
			{
				bool flag2 = base.IsVisible();
				if (flag2)
				{
					this._Close();
				}
			}
		}

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

		private void RefreshData()
		{
			bool flag = string.IsNullOrEmpty(this._contentKey);
			if (flag)
			{
				this._Close();
			}
			else
			{
				base.uiBehaviour.transform.position = this._pos;
				base.uiBehaviour.transform.localPosition += this._offset;
				base.uiBehaviour._ContentValue.SetText(XSingleton<UiUtility>.singleton.ReplaceReturn(XStringDefineProxy.GetString(this._contentKey)));
			}
		}

		private void _Close()
		{
			this.SetVisibleWithAnimation(false, null);
		}

		private void _Show()
		{
			this.SetVisibleWithAnimation(true, null);
		}
	}
}