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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
using System;
using UILib;
using UnityEngine;
using XUtliPoolLib;
namespace XMainClient
{
internal class XChest
{
public Vector3 Position
{
get
{
return this.m_ChestGo.transform.localPosition;
}
set
{
this.m_ChestGo.transform.localPosition = value;
}
}
public bool Opened
{
set
{
this.m_bOpened = value;
bool bOpened = this.m_bOpened;
if (bOpened)
{
this.m_Chest.SetSprite(this.OPENED_SPRITE);
}
else
{
this.m_Chest.SetSprite(this.NOT_OPEN_SPRITE);
}
}
}
private GameObject m_ChestGo;
public IXUISprite m_Chest;
private XFx m_OpenFx;
private XFx m_ActiveFx;
private IXUILabel m_Exp;
private XNumberTween m_ExpTween;
private GameObject m_RedPoint;
public uint m_RequiredExp;
private bool m_isActivityChest;
private bool m_bOpened;
private string NOT_OPEN_SPRITE = "bx3";
private string OPENING_SPRITE = "bx3_1";
private string OPENED_SPRITE = "bx3_2";
public XChest(GameObject chest, string chestName = null)
{
bool flag = chestName != null;
if (flag)
{
this.m_isActivityChest = true;
this.NOT_OPEN_SPRITE = chestName;
this.OPENING_SPRITE = chestName + "_1";
this.OPENED_SPRITE = chestName + "_2";
}
else
{
this.m_isActivityChest = false;
}
this.m_ChestGo = chest;
this.m_Chest = (chest.GetComponent("XUISprite") as IXUISprite);
Transform transform = chest.transform.Find("Exp");
bool flag2 = transform != null;
if (flag2)
{
this.m_Exp = (transform.GetComponent("XUILabel") as IXUILabel);
this.m_ExpTween = XNumberTween.Create(this.m_Exp);
}
transform = chest.transform.Find("RedPoint");
bool flag3 = transform != null;
if (flag3)
{
this.m_RedPoint = transform.gameObject;
}
}
public void SetExp(uint num)
{
this.m_RequiredExp = num;
bool flag = this.m_ExpTween != null;
if (flag)
{
this.m_ExpTween.SetNumberWithTween((ulong)num, "", false, true);
}
this.ResetState();
}
public void Update(uint exp)
{
bool flag = !this.m_isActivityChest;
if (flag)
{
this.m_Chest.SetGrey(this.m_RequiredExp <= exp);
}
bool flag2 = this.m_RequiredExp <= exp && !this.m_bOpened;
if (flag2)
{
bool flag3 = this.m_ActiveFx == null;
if (flag3)
{
this.m_ActiveFx = XSingleton<XFxMgr>.singleton.CreateFx("Effects/FX_Particle/UIfx/UI_hyd", null, true);
this.m_ActiveFx.Play(this.m_ChestGo.transform, Vector3.zero, Vector3.one, 1f, true, false);
}
}
else
{
bool flag4 = this.m_ActiveFx != null;
if (flag4)
{
XSingleton<XFxMgr>.singleton.DestroyFx(this.m_ActiveFx, true);
this.m_ActiveFx = null;
}
}
bool flag5 = this.m_RedPoint != null;
if (flag5)
{
this.m_RedPoint.SetActive(this.m_RequiredExp <= exp && !this.m_bOpened);
}
}
public void ResetState()
{
bool flag = this.m_ActiveFx != null;
if (flag)
{
XSingleton<XFxMgr>.singleton.DestroyFx(this.m_ActiveFx, true);
}
bool flag2 = this.m_OpenFx != null;
if (flag2)
{
XSingleton<XFxMgr>.singleton.DestroyFx(this.m_OpenFx, true);
}
bool flag3 = this.m_RedPoint != null;
if (flag3)
{
this.m_RedPoint.SetActive(false);
}
}
private void DestroyOpenFx(object e)
{
bool flag = this.m_OpenFx != null;
if (flag)
{
XSingleton<XFxMgr>.singleton.DestroyFx(this.m_OpenFx, true);
}
}
public void Open()
{
this.m_Chest.SetSprite(this.OPENING_SPRITE);
bool flag = this.m_OpenFx == null;
if (flag)
{
this.m_OpenFx = XSingleton<XFxMgr>.singleton.CreateFx("Effects/FX_Particle/UIfx/UI_hyd_01", null, true);
}
XSingleton<XTimerMgr>.singleton.SetTimer(1.2f, new XTimerMgr.ElapsedEventHandler(this.DestroyOpenFx), null);
this.m_OpenFx.Play(this.m_ChestGo.transform, Vector3.zero, Vector3.one, 1f, true, false);
this.m_bOpened = true;
this.Update(this.m_RequiredExp);
bool flag2 = this.m_RedPoint != null;
if (flag2)
{
this.m_RedPoint.SetActive(false);
}
}
}
}
|