blob: 71d0c4d9a4cc929cc242f638fe9b502ac69c1168 (
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
|
using System;
using System.Collections.Generic;
using UILib;
using UnityEngine;
using XUtliPoolLib;
namespace XMainClient
{
internal class Selector
{
public Transform transform
{
get
{
return this._transfrom;
}
}
public Transform parent
{
get
{
return this._parent;
}
}
public uint ID = 0u;
public string Label = "";
public bool Selected = false;
public List<Selector> selectors = null;
public uint SelectorLevel = 0u;
private Transform _transfrom;
private Transform _parent;
private SelectorInvoke _invoke;
private SelectorBind _bind;
public void Bind(Transform parent, SelectorBind sBind, SelectorInvoke sInvoke)
{
this._bind = sBind;
this._invoke = sInvoke;
this._parent = parent;
this.BindData();
}
public void UnBind()
{
bool flag = this.selectors != null;
if (flag)
{
int i = 0;
int count = this.selectors.Count;
while (i < count)
{
this.selectors[i].UnBind();
i++;
}
}
this._transfrom = null;
this._parent = null;
this._invoke = null;
this._bind = null;
}
public void Release()
{
bool flag = this.selectors != null;
if (flag)
{
int i = 0;
int count = this.selectors.Count;
while (i < count)
{
this.selectors[i].UnBind();
this.selectors[i] = null;
i++;
}
this.selectors.Clear();
this.selectors = null;
}
SelectorPool.Release(this);
}
private void BindData()
{
bool flag = this._bind == null || this._parent == null;
if (flag)
{
XSingleton<XDebug>.singleton.AddErrorLog("BindData._bind is Null Or BindData._parent is Null", null, null, null, null, null);
}
else
{
this._transfrom = this._bind(this.SelectorLevel);
IXUILabel ixuilabel = this._transfrom.Find("Label").GetComponent("XUILabel") as IXUILabel;
IXUILabel ixuilabel2 = this._transfrom.Find("Selected/Label").GetComponent("XUILabel") as IXUILabel;
IXUISprite ixuisprite = this._transfrom.GetComponent("XUISprite") as IXUISprite;
ixuisprite.ID = (ulong)this.ID;
ixuilabel.SetText(this.Label);
ixuilabel2.SetText(this.Label);
ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnClickSelector));
this._transfrom.parent = this._parent;
this._transfrom.localScale = Vector3.one;
this._transfrom.localPosition = new Vector3(0f, -((float)this._parent.childCount - 0.5f) * (float)ixuisprite.spriteHeight, 0f);
this.BindChildren();
}
}
private void BindChildren()
{
bool flag = this.selectors != null && this.selectors.Count > 0;
if (flag)
{
int i = 0;
int count = this.selectors.Count;
while (i < count)
{
this.selectors[i].Bind(this._transfrom, this._bind, this._invoke);
i++;
}
}
}
private void OnClickSelector(IXUISprite sprite)
{
bool flag = this._invoke != null;
if (flag)
{
this._invoke(this.ID);
}
}
}
}
|