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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
|
using System;
using KKSG;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient
{
internal class XReviveDocument : XDocComponent
{
public override uint ID
{
get
{
return XReviveDocument.uuID;
}
}
public bool CanVipRevive
{
get
{
return this._can_vip_revive;
}
}
public uint VipReviveCount
{
get
{
return this._vip_revive_count;
}
set
{
this._vip_revive_count = value;
}
}
public string LeaveSceneTip
{
get
{
return this._leave_scene_tip;
}
}
public string BuffStringTip
{
get
{
return this._buff_string_tip;
}
}
public uint NormalCostID
{
get
{
bool flag = this._normal_cost_list.Count == 0;
uint result;
if (flag)
{
result = 0u;
}
else
{
bool flag2 = this._revive_cost_time < this._normal_cost_list.Count;
if (flag2)
{
result = this._normal_cost_list[this._revive_cost_time, 0];
}
else
{
result = this._normal_cost_list[this._normal_cost_list.Count - 1, 0];
}
}
return result;
}
}
public uint NormalCostCount
{
get
{
bool flag = this._normal_cost_list.Count == 0;
uint result;
if (flag)
{
result = 0u;
}
else
{
bool flag2 = this._revive_cost_time < this._normal_cost_list.Count;
if (flag2)
{
result = this._normal_cost_list[this._revive_cost_time, 1];
}
else
{
result = this._normal_cost_list[this._normal_cost_list.Count - 1, 1];
}
}
return result;
}
}
public uint SpecialCostID
{
get
{
bool flag = this._special_cost_list.Count == 0;
uint result;
if (flag)
{
result = 0u;
}
else
{
bool flag2 = this._revive_cost_time < this._special_cost_list.Count;
if (flag2)
{
result = this._special_cost_list[this._revive_cost_time, 0];
}
else
{
result = this._special_cost_list[this._special_cost_list.Count - 1, 0];
}
}
return result;
}
}
public uint SpecialCostCount
{
get
{
bool flag = this._special_cost_list.Count == 0;
uint result;
if (flag)
{
result = 0u;
}
else
{
bool flag2 = this._revive_cost_time < this._special_cost_list.Count;
if (flag2)
{
result = this._special_cost_list[this._revive_cost_time, 1];
}
else
{
result = this._special_cost_list[this._special_cost_list.Count - 1, 1];
}
}
return result;
}
}
public int ReviveUsedTime
{
get
{
return this._revive_used_time;
}
}
public int ReviveMaxTime
{
get
{
return this._revive_max_time;
}
}
public int ReviveCostTime
{
get
{
return this._revive_cost_time;
}
}
public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("ReviveDocument");
private string _leave_scene_tip = "";
private string _buff_string_tip = "";
private SeqListRef<uint> _normal_cost_list;
private SeqListRef<uint> _special_cost_list;
private int _revive_used_time = 0;
private int _revive_max_time = 0;
private int _revive_cost_time = 0;
private ReviveType _sync_revive_type = ReviveType.ReviveNone;
private bool _can_vip_revive = false;
private uint _vip_revive_count = 0u;
private bool _auto_revive = false;
private bool _auto_revive_limit = false;
private float _auto_revive_time = 0f;
private uint _auto_revive_token = 0u;
public override void OnEnterSceneFinally()
{
base.OnEnterSceneFinally();
SceneTable.RowData sceneData = XSingleton<XSceneMgr>.singleton.GetSceneData(XSingleton<XScene>.singleton.SceneID);
this._leave_scene_tip = XSingleton<UiUtility>.singleton.ReplaceReturn(sceneData.LeaveSceneTip);
this._buff_string_tip = XSingleton<UiUtility>.singleton.ReplaceReturn(sceneData.ReviveBuffTip);
this._revive_max_time = (int)sceneData.ReviveNumb;
this._revive_used_time = 0;
this._revive_cost_time = 0;
this._normal_cost_list = sceneData.ReviveCost;
this._special_cost_list = sceneData.ReviveMoneyCost;
this._can_vip_revive = (sceneData.CanVIPRevive == 0);
this._vip_revive_count = (uint)sceneData.VipReviveLimit;
this.ResetAutoReviveData();
}
public void SetReviveData(int usedtime, int costtime, ReviveType type)
{
this._revive_used_time = usedtime;
this._revive_cost_time = costtime;
this._sync_revive_type = type;
}
public void SendReviveRpc(ReviveType type)
{
RpcC2G_Revive rpcC2G_Revive = new RpcC2G_Revive();
rpcC2G_Revive.oArg.type = type;
XSingleton<XClientNetwork>.singleton.Send(rpcC2G_Revive);
}
public void SendLeaveScene()
{
XSingleton<XLevelFinishMgr>.singleton.SendLevelFailData();
XSingleton<XScene>.singleton.ReqLeaveScene();
}
public void ResetAutoReviveData()
{
this._auto_revive = false;
this._auto_revive_limit = false;
this._auto_revive_time = 0f;
}
public void SetAutoReviveData(bool haslimit, float time = 2f)
{
this._auto_revive = true;
this._auto_revive_limit = haslimit;
this._auto_revive_time = time;
}
public void StartRevive()
{
bool syncMode = XSingleton<XGame>.singleton.SyncMode;
if (syncMode)
{
ReviveType sync_revive_type = this._sync_revive_type;
if (sync_revive_type - ReviveType.ReviveItem <= 1 || sync_revive_type == ReviveType.ReviveVIP)
{
DlgBase<ReviveDlg, ReviveDlgBehaviour>.singleton.SetVisible(true, true);
}
}
else
{
bool auto_revive = this._auto_revive;
if (auto_revive)
{
XSingleton<XTimerMgr>.singleton.KillTimer(this._auto_revive_token);
this._auto_revive_token = XSingleton<XTimerMgr>.singleton.SetTimer(this._auto_revive_time, new XTimerMgr.ElapsedEventHandler(this.SendAutoReviveRpc), null);
}
else
{
DlgBase<ReviveDlg, ReviveDlgBehaviour>.singleton.SetVisible(true, true);
}
}
}
private void SendAutoReviveRpc(object o)
{
RpcC2G_Revive rpcC2G_Revive = new RpcC2G_Revive();
rpcC2G_Revive.oArg.type = ReviveType.ReviveSprite;
rpcC2G_Revive.oArg.clientinfo = new ClientReviveInfo();
rpcC2G_Revive.oArg.clientinfo.islimit = this._auto_revive_limit;
XSingleton<XClientNetwork>.singleton.Send(rpcC2G_Revive);
}
public void ShowSpecialRevive()
{
bool flag = !DlgBase<ReviveDlg, ReviveDlgBehaviour>.singleton.IsVisible();
if (!flag)
{
DlgBase<ReviveDlg, ReviveDlgBehaviour>.singleton.ShowSpecialReviveFrame();
}
}
protected override void OnReconnected(XReconnectedEventArgs arg)
{
bool auto_revive = this._auto_revive;
if (auto_revive)
{
XSingleton<XTimerMgr>.singleton.KillTimer(this._auto_revive_token);
this.ShowSpecialRevive();
}
}
}
}
|