blob: 5f2bfd07653585a4c9f9eec259f65a8f07e45d7f (
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
using System;
using UILib;
using UnityEngine;
using XUtliPoolLib;
namespace XMainClient
{
internal class XItemSelector
{
public GameObject Effects
{
get
{
return this.m_Selecter;
}
}
private GameObject m_Selecter = null;
private IUIDummy m_UIDummy = null;
public int DeltaDepth = 50;
private bool m_bLoadFromUI;
private Transform m_Parent = XSingleton<XGameUI>.singleton.UIRoot;
private uint m_DefaultWidth = 0u;
public XItemSelector(uint defaltWidth = 0u)
{
this.m_DefaultWidth = defaltWidth;
}
public void Load(string prefabName)
{
this._Load("UI/Common/" + prefabName);
}
private void _Load(string prefab)
{
this._Destroy();
this.m_Selecter = (XSingleton<XResourceLoaderMgr>.singleton.CreateFromPrefab(prefab, true, false) as GameObject);
this.m_UIDummy = (this.m_Selecter.GetComponent("UIDummy") as IUIDummy);
this.m_bLoadFromUI = false;
this.m_Parent = XSingleton<XGameUI>.singleton.UIRoot;
}
public void LoadFromUI(GameObject go, Transform parent)
{
this._Destroy();
this.m_Selecter = go;
this.m_UIDummy = (this.m_Selecter.GetComponent("UIDummy") as IUIDummy);
this.m_bLoadFromUI = true;
bool flag = parent != null;
if (flag)
{
this.m_Parent = parent;
}
this.Hide();
}
private void _Destroy()
{
bool flag = this.m_Selecter != null;
if (flag)
{
bool flag2 = !this.m_bLoadFromUI;
if (flag2)
{
XResourceLoaderMgr.SafeDestroy(ref this.m_Selecter, true);
}
else
{
this.m_Selecter.transform.parent = this.m_Parent;
}
this.m_Selecter = null;
this.m_UIDummy = null;
}
}
public void Unload()
{
this._Destroy();
}
public void Select(GameObject bg)
{
bool flag = bg == null;
if (!flag)
{
IXUISprite bg2 = bg.GetComponent("XUISprite") as IXUISprite;
this.Select(bg2);
}
}
public void Select(IXUISprite bg)
{
bool flag = bg == null;
if (!flag)
{
bool flag2 = this.m_Selecter == null;
if (flag2)
{
this.Load("ItemSelector");
}
bool flag3 = this.m_Selecter == null;
if (!flag3)
{
this.m_Selecter.SetActive(true);
this.m_Selecter.transform.parent = bg.gameObject.transform;
this.m_Selecter.transform.localPosition = Vector3.zero;
bool flag4 = this.m_DefaultWidth > 0u;
if (flag4)
{
float num = (float)bg.spriteWidth / this.m_DefaultWidth;
this.m_Selecter.transform.localScale = new Vector3(num, num, num);
}
else
{
this.m_Selecter.transform.localScale = Vector3.one;
}
XSingleton<XGameUI>.singleton.m_uiTool.MarkParentAsChanged(this.m_Selecter);
bool flag5 = !this.m_bLoadFromUI;
if (flag5)
{
bool flag6 = this.m_UIDummy != null;
if (flag6)
{
this.m_UIDummy.depth = bg.spriteDepth + this.DeltaDepth;
}
}
}
}
}
public void Hide()
{
bool flag = this.m_Selecter == null;
if (!flag)
{
this.m_Selecter.transform.parent = this.m_Parent;
this.m_Selecter.SetActive(false);
}
}
}
}
|