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
|
using System;
using System.Collections.Generic;
using KKSG;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient
{
internal class GiftClaimDlg : DlgBase<GiftClaimDlg, GiftClaimBehaviour>
{
public override bool isPopup
{
get
{
return true;
}
}
public override int layer
{
get
{
return 1;
}
}
public override int group
{
get
{
return 1;
}
}
public override bool autoload
{
get
{
return true;
}
}
public override bool fullscreenui
{
get
{
return true;
}
}
public override bool isHideChat
{
get
{
return false;
}
}
public override string fileName
{
get
{
return "GameSystem/GiftClaimDlg";
}
}
public XGameMallDocument doc
{
get
{
return XDocuments.GetSpecificDocument<XGameMallDocument>(XGameMallDocument.uuID);
}
}
public GiftClaimDlg.State state = GiftClaimDlg.State.Recv;
private XFx fx;
private List<GiftIbItem> mGiftList;
public enum State
{
Recv,
Open
}
protected override void Init()
{
base.Init();
}
protected override void OnShow()
{
base.OnShow();
this.RefreshUI();
bool flag = this.fx == null;
if (flag)
{
this.fx = XSingleton<XFxMgr>.singleton.CreateFx("Effects/FX_Particle/UIfx/UI_GiftClaimDlg_Clip01", null, true);
this.fx.Play(base.uiBehaviour.m_objTpl.transform, Vector3.zero, Vector3.one, 1f, true, false);
}
}
public override void RegisterEvent()
{
base.RegisterEvent();
base.uiBehaviour.m_btnOpen.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnOpenClick));
base.uiBehaviour.m_btnThanks.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnThankClick));
}
protected override void OnUnload()
{
bool flag = this.fx != null;
if (flag)
{
XSingleton<XFxMgr>.singleton.DestroyFx(this.fx, true);
this.fx = null;
}
base.OnUnload();
}
private void RefreshUI()
{
base.uiBehaviour.m_transOpen.gameObject.SetActive(this.state == GiftClaimDlg.State.Open);
base.uiBehaviour.m_transRcv.gameObject.SetActive(this.state == GiftClaimDlg.State.Recv);
bool flag = this.state == GiftClaimDlg.State.Recv;
if (flag)
{
bool flag2 = this.mGiftList != null && this.mGiftList.Count > 0;
if (flag2)
{
GiftIbItem giftIbItem = this.mGiftList[0];
base.uiBehaviour.m_lblName.SetText(giftIbItem.name);
}
}
else
{
bool flag3 = this.state == GiftClaimDlg.State.Open;
if (flag3)
{
bool flag4 = this.mGiftList != null && this.mGiftList.Count > 0;
if (flag4)
{
GiftIbItem giftIbItem2 = this.mGiftList[0];
XSingleton<XItemDrawerMgr>.singleton.normalItemDrawer.DrawItem(base.uiBehaviour.m_objTpl, (int)giftIbItem2.item.itemID, (int)giftIbItem2.item.itemCount, false);
base.uiBehaviour.m_lblDetail.SetText(giftIbItem2.text);
base.uiBehaviour.m_lblTitle.SetText(giftIbItem2.name);
}
}
}
}
public void HanderGift(List<GiftIbItem> gift)
{
this.mGiftList = gift;
bool flag = XSingleton<XGame>.singleton.CurrentStage.Stage == EXStage.Hall;
if (flag)
{
this.state = GiftClaimDlg.State.Recv;
this.SetVisible(true, true);
}
}
private bool OnOpenClick(IXUIButton btn)
{
this.state = GiftClaimDlg.State.Open;
this.RefreshUI();
return true;
}
private bool OnThankClick(IXUIButton btn)
{
bool flag = this.mGiftList == null;
if (flag)
{
this.SetVisible(false, true);
}
else
{
bool flag2 = this.mGiftList.Count > 0;
if (flag2)
{
GiftIbItem giftIbItem = this.mGiftList[0];
RpcC2M_GiftIbReqGoods rpcC2M_GiftIbReqGoods = new RpcC2M_GiftIbReqGoods();
rpcC2M_GiftIbReqGoods.oArg.orderid = giftIbItem.orderid;
XSingleton<XClientNetwork>.singleton.Send(rpcC2M_GiftIbReqGoods);
this.mGiftList.RemoveAt(0);
}
bool flag3 = this.mGiftList.Count > 0;
if (flag3)
{
this.state = GiftClaimDlg.State.Recv;
this.RefreshUI();
}
else
{
this.SetVisible(false, true);
}
}
return true;
}
}
}
|