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

namespace XMainClient.UI
{
	internal class TooltipDlgBehaviour : DlgBehaviourBase
	{
		public XUIPool m_PanelPool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);

		public XUIPool m_AttrPool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);

		public XUIPool m_AttrFramePool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);

		public Vector3 m_OriginPos;

		public Color m_OriginAttrNameColor;

		public Color m_OriginAttrValueColor;

		public GameObject m_Black;

		public IXUISprite m_TotalFrame;

		public IXUISprite m_ToolTipMain;

		public int m_TopFrameHeight;

		public float m_ScrollPanelSoftnessOffset;

		public float m_TooltipBorder;

		public float m_MaxTooltipHeight;

		public float m_MaxTooltipHeightWithJade;

		public Vector3[] m_ButtonsOriginPos = new Vector3[TooltipDlgBehaviour.MAX_BUTTON_COUNT];

		public string[,] m_ButtonsText = new string[TooltipDlgBehaviour.MAX_GROUP_COUNT, TooltipDlgBehaviour.MAX_BUTTON_COUNT];

		public bool[] m_ButtonsVisible = new bool[TooltipDlgBehaviour.MAX_BUTTON_COUNT];

		public static readonly int MAX_BUTTON_COUNT = 7;

		public static readonly int MAX_GROUP_COUNT = 4;

		protected virtual void Awake()
		{
			Transform transform = base.transform.Find("Black");
			bool flag = transform != null;
			if (flag)
			{
				this.m_Black = transform.gameObject;
			}
			GameObject gameObject = base.transform.Find("Bg/Bg").gameObject;
			this.m_TotalFrame = (gameObject.GetComponent("XUISprite") as IXUISprite);
			this.m_OriginPos = this.m_TotalFrame.gameObject.transform.localPosition;
			transform = base.transform.Find("Bg/Bg/ToolTip/TopFrame");
			this.m_TooltipBorder = -transform.localPosition.y;
			this.m_TopFrameHeight = (transform.GetComponent("XUISprite") as IXUISprite).spriteHeight;
			transform = base.transform.Find("Bg/Bg/ToolTip/ScrollPanel/BasicAttr/Attr1");
			bool flag2 = transform != null;
			if (flag2)
			{
				this.m_AttrPool.SetupPool(gameObject, transform.gameObject, 2u, false);
			}
			transform = base.transform.Find("Bg/Bg/ToolTip/ScrollPanel/BasicAttr");
			bool flag3 = transform != null;
			if (flag3)
			{
				this.m_AttrFramePool.SetupPool(gameObject, transform.gameObject, 2u, false);
			}
			transform = base.transform.Find("Bg/Bg/ToolTip/ScrollPanel");
			IXUIPanel ixuipanel = transform.GetComponent("XUIPanel") as IXUIPanel;
			IXUISprite ixuisprite = base.transform.Find("Bg/Bg/ToolTip").GetComponent("XUISprite") as IXUISprite;
			this.m_ScrollPanelSoftnessOffset = ixuipanel.softness.y;
			this.m_MaxTooltipHeightWithJade = (float)ixuisprite.spriteHeight - this.m_TooltipBorder;
			this.m_MaxTooltipHeight = (float)(this.m_TopFrameHeight + (int)ixuipanel.GetBaseRect().w) + this.m_ScrollPanelSoftnessOffset + this.m_TooltipBorder;
			transform = base.transform.Find("Bg/Bg/ToolTip/ScrollPanel/PlaceHolder");
			bool flag4 = transform != null;
			if (flag4)
			{
				transform.transform.localPosition = new Vector3(0f, (float)(-(float)this.m_TopFrameHeight) - this.m_ScrollPanelSoftnessOffset - this.m_TooltipBorder);
			}
			transform = base.transform.Find("Bg/Bg/ToolTip/FuncFrame/ButtonTpl");
			XUIPool xuipool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
			xuipool.SetupPool(transform.parent.gameObject, transform.gameObject, (uint)TooltipDlgBehaviour.MAX_BUTTON_COUNT, false);
			for (int i = 0; i < TooltipDlgBehaviour.MAX_BUTTON_COUNT; i++)
			{
				transform = xuipool.FetchGameObject(false).transform;
				transform.name = "Button" + (i + 1);
				transform.localPosition = new Vector3(xuipool.TplPos.x, xuipool.TplPos.y + (float)(xuipool.TplHeight * i));
				bool flag5 = transform != null;
				if (flag5)
				{
					this.m_ButtonsOriginPos[i] = transform.localPosition;
				}
				this.m_ButtonsVisible[i] = false;
			}
			transform = base.transform.Find("Bg/Bg/ToolTip");
			this.m_ToolTipMain = (transform.gameObject.GetComponent("XUISprite") as IXUISprite);
			this.m_PanelPool.SetupPool(transform.parent.gameObject, transform.gameObject, 2u, false);
			bool flag6 = this.m_AttrPool._tpl != null;
			if (flag6)
			{
				this.m_OriginAttrNameColor = (this.m_AttrPool._tpl.transform.Find("Text").GetComponent("XUILabel") as IXUILabel).GetColor();
				this.m_OriginAttrValueColor = (this.m_AttrPool._tpl.transform.Find("Value").GetComponent("XUILabel") as IXUILabel).GetColor();
			}
		}

		public void DelayShow(IXUIDlg dlg)
		{
			base.StartCoroutine(this.InnerShow(dlg));
		}

		private IEnumerator InnerShow(IXUIDlg dlg)
		{
			IXUIPanel panel = base.gameObject.transform.Find("Bg").gameObject.GetComponent("XUIPanel") as IXUIPanel;
			panel.SetAlpha(0f);
			yield return null;
			panel.SetAlpha(1f);
			yield break;
		}
	}
}