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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
|
using System;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient.UI
{
internal class ArtifactInscriptionHandler : DlgHandlerBase
{
private string EffectPath
{
get
{
bool flag = string.IsNullOrEmpty(this.m_effectPath);
if (flag)
{
this.m_effectPath = XSingleton<XGlobalConfig>.singleton.GetValue("InscriptionEffectPath");
}
return this.m_effectPath;
}
}
protected override string FileName
{
get
{
return "ItemNew/ArtifactInscriptionHandler";
}
}
private ArtifactInscriptionDocument m_doc;
private GameObject m_itemGo1;
private GameObject m_itemGo2;
private Transform m_effectTra;
private IXUISprite m_boxSpr1;
private IXUISprite m_boxSpr2;
private IXUIButton m_inscriptionBtn;
private XFx m_fx;
private string m_effectPath = string.Empty;
protected override void Init()
{
base.Init();
this.m_doc = ArtifactInscriptionDocument.Doc;
this.m_doc.Handler = this;
Transform transform = base.PanelObject.transform.Find("Bg1");
this.m_itemGo1 = transform.Find("item0").gameObject;
this.m_itemGo2 = transform.Find("item1").gameObject;
this.m_boxSpr1 = (transform.Find("BgBox1").GetComponent("XUISprite") as IXUISprite);
this.m_boxSpr2 = (transform.Find("BgBox2").GetComponent("XUISprite") as IXUISprite);
this.m_inscriptionBtn = (transform.Find("Get").GetComponent("XUIButton") as IXUIButton);
this.m_effectTra = transform.Find("Effect");
}
public override void RegisterEvent()
{
base.RegisterEvent();
this.m_boxSpr1.ID = 1UL;
this.m_boxSpr1.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnClickBox));
this.m_boxSpr2.ID = 2UL;
this.m_boxSpr2.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnClickBox));
this.m_inscriptionBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickInscriptionBtn));
}
protected override void OnShow()
{
base.OnShow();
this.FillContent();
}
protected override void OnHide()
{
base.OnHide();
bool flag = this.m_fx != null;
if (flag)
{
this.m_fx.Stop();
}
}
public override void StackRefresh()
{
base.StackRefresh();
}
public override void OnUnload()
{
base.OnUnload();
this.m_doc.Handler = null;
bool flag = this.m_fx != null;
if (flag)
{
XSingleton<XFxMgr>.singleton.DestroyFx(this.m_fx, true);
this.m_fx = null;
}
}
public void RefreshUi()
{
this.FillContent();
}
private void FillContent()
{
XItem xitem = XBagDocument.BagDoc.GetItemByUID(this.m_doc.ArtifactUid);
bool flag = xitem == null;
if (flag)
{
XSingleton<XItemDrawerMgr>.singleton.DrawItem(this.m_itemGo1, null);
}
else
{
XSingleton<XItemDrawerMgr>.singleton.DrawItem(this.m_itemGo1, xitem);
IXUISprite ixuisprite = this.m_itemGo1.transform.Find("Icon").GetComponent("XUISprite") as IXUISprite;
ixuisprite.ID = this.m_doc.ArtifactUid;
ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnClickTips));
}
xitem = XBagDocument.BagDoc.GetBagItemByUID(this.m_doc.InscriptionUid);
bool flag2 = xitem == null;
if (flag2)
{
XSingleton<XItemDrawerMgr>.singleton.DrawItem(this.m_itemGo2, null);
}
else
{
XSingleton<XItemDrawerMgr>.singleton.DrawItem(this.m_itemGo2, xitem);
IXUISprite ixuisprite2 = this.m_itemGo2.transform.Find("Icon").GetComponent("XUISprite") as IXUISprite;
ixuisprite2.ID = this.m_doc.InscriptionUid;
ixuisprite2.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnClickTips));
}
bool flag3 = this.m_doc.ArtifactUid != 0UL && this.m_doc.InscriptionUid > 0UL;
if (flag3)
{
bool flag4 = this.m_fx == null;
if (flag4)
{
this.m_fx = XSingleton<XFxMgr>.singleton.CreateFx(this.EffectPath, null, true);
}
else
{
this.m_fx.SetActive(true);
}
this.m_fx.Play(this.m_effectTra, Vector3.zero, Vector3.one, 1f, true, false);
}
else
{
bool flag5 = this.m_fx != null;
if (flag5)
{
this.m_fx.SetActive(false);
}
}
}
private bool OnClickInscriptionBtn(IXUIButton btn)
{
bool flag = this.m_doc.ArtifactUid == 0UL || this.m_doc.InscriptionUid == 0UL;
bool result;
if (flag)
{
XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("InscriptionTips1"), "fece00");
result = false;
}
else
{
XOptionsDocument specificDocument = XDocuments.GetSpecificDocument<XOptionsDocument>(XOptionsDocument.uuID);
bool flag2 = specificDocument.GetValue(XOptionsDefine.OD_NO_INSCRIPTION_CONFIRM) == 1;
if (flag2)
{
this.m_doc.ReqInscription();
}
else
{
XSingleton<UiUtility>.singleton.ShowModalDialog(XSingleton<XStringTable>.singleton.GetString("InscriptionTips2"), XStringDefineProxy.GetString(XStringDefine.COMMON_OK), XStringDefineProxy.GetString(XStringDefine.COMMON_CANCEL), new ButtonClickEventHandler(this.DoOK), new ButtonClickEventHandler(this.DoCancel), false, XTempTipDefine.OD_INSCRIPTION_CONFIRM, 50);
}
result = true;
}
return result;
}
private bool DoOK(IXUIButton btn)
{
bool flag = DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.IsVisible();
if (flag)
{
XOptionsDocument specificDocument = XDocuments.GetSpecificDocument<XOptionsDocument>(XOptionsDocument.uuID);
specificDocument.SetValue(XOptionsDefine.OD_NO_INSCRIPTION_CONFIRM, DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.GetTempTip(XTempTipDefine.OD_INSCRIPTION_CONFIRM) ? 1 : 0, false);
}
XSingleton<UiUtility>.singleton.CloseModalDlg();
this.m_doc.ReqInscription();
return true;
}
private bool DoCancel(IXUIButton btn)
{
XOptionsDocument specificDocument = XDocuments.GetSpecificDocument<XOptionsDocument>(XOptionsDocument.uuID);
specificDocument.SetValue(XOptionsDefine.OD_NO_INSCRIPTION_CONFIRM, DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.GetTempTip(XTempTipDefine.OD_INSCRIPTION_CONFIRM) ? 1 : 0, false);
XSingleton<UiUtility>.singleton.CloseModalDlg();
return true;
}
private void OnClickBox(IXUISprite spr)
{
bool flag = spr.ID == 1UL;
if (flag)
{
XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("InscriptionPutInTips1"), "fece00");
}
else
{
XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("InscriptionPutInTips2"), "fece00");
}
}
private void OnClickTips(IXUISprite spr)
{
bool flag = spr.ID == 0UL;
if (!flag)
{
XItem xitem = XBagDocument.BagDoc.GetItemByUID(spr.ID);
bool flag2 = xitem == null;
if (flag2)
{
xitem = XBagDocument.MakeXItem((int)spr.ID, false);
}
XSingleton<UiUtility>.singleton.ShowTooltipDialog(xitem, null, spr, false, 0u);
}
}
}
}
|