summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/XSystemTipDocument.cs
blob: 0042edce9f1402dafff11430d1bd61ad7d52803d (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
using System;
using System.Collections.Generic;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient
{
	internal class XSystemTipDocument : XDocComponent
	{
		public override uint ID
		{
			get
			{
				return XSystemTipDocument.uuID;
			}
		}

		public int LeftCount
		{
			get
			{
				return this.m_StrQueue.Count;
			}
		}

		public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("SystemTipDocument");

		private Queue<string> m_StrQueue = new Queue<string>();

		public void ShowTip(string text, string rgb)
		{
			this.m_StrQueue.Enqueue(string.Format("[{0}]{1}", rgb, text));
			bool flag = !DlgBase<XSystemTipView, XSystemTipBehaviour>.singleton.IsVisible();
			if (flag)
			{
				bool flag2 = DlgBase<XSystemTipView, XSystemTipBehaviour>.singleton.IsVisible();
				if (flag2)
				{
					DlgBase<XSystemTipView, XSystemTipBehaviour>.singleton.SetAlpha(1f);
				}
				DlgBase<XSystemTipView, XSystemTipBehaviour>.singleton.SetVisible(true, true);
			}
		}

		public bool TryGetTip(ref string s)
		{
			bool flag = this.m_StrQueue.Count == 0;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				s = this.m_StrQueue.Dequeue();
				result = true;
			}
			return result;
		}

		public override void OnLeaveScene()
		{
			base.OnLeaveScene();
			this.m_StrQueue.Clear();
		}

		protected override void OnReconnected(XReconnectedEventArgs arg)
		{
		}
	}
}