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
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
|
using System;
using System.Collections.Generic;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient.UI
{
internal class HomeFishingDlg : DlgBase<HomeFishingDlg, HomeFishingBehaviour>
{
public override string fileName
{
get
{
return "Home/FishingDlg";
}
}
public override int layer
{
get
{
return 1;
}
}
public override bool autoload
{
get
{
return true;
}
}
private XHomeFishingDocument _doc = null;
private XCharacterItemDocument _itemDoc = null;
private XSweepDocument _sweepDoc = null;
private XWelfareDocument _welfareDoc = null;
public XYuyinView _yuyinHandler;
private uint _timeToken;
protected override void Init()
{
base.Init();
this._doc = XDocuments.GetSpecificDocument<XHomeFishingDocument>(XHomeFishingDocument.uuID);
this._itemDoc = XDocuments.GetSpecificDocument<XCharacterItemDocument>(XCharacterItemDocument.uuID);
this._sweepDoc = XDocuments.GetSpecificDocument<XSweepDocument>(XSweepDocument.uuID);
this._welfareDoc = XDocuments.GetSpecificDocument<XWelfareDocument>(XWelfareDocument.uuID);
base.uiBehaviour.m_FishLevelFrame.SetActive(false);
base.uiBehaviour.m_HighQualityFx.SetActive(false);
base.uiBehaviour.m_LowQualityFx.SetActive(false);
}
protected override void OnLoad()
{
DlgHandlerBase.EnsureCreate<XYuyinView>(ref this._yuyinHandler, base.uiBehaviour.transform, true, this);
this._yuyinHandler.SetVisible(false);
}
public override void RegisterEvent()
{
base.RegisterEvent();
base.uiBehaviour.m_Close.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseBtnClick));
base.uiBehaviour.m_StartFishingBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnStartFishingBtnClick));
base.uiBehaviour.m_SweepBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnSweepButtonClicked));
base.uiBehaviour.m_HomeMainBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnHomeMainBtnClick));
base.uiBehaviour.m_HomeShopBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnHomeShopBtnClick));
base.uiBehaviour.m_HomeCookingBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnHomeCookingBtnClick));
base.uiBehaviour.m_FishLevelBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnFishLevelBtnClick));
base.uiBehaviour.m_LevelFrameCloseBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnFishLevelFrameCloseBtnClick));
}
protected override void OnShow()
{
base.OnShow();
base.uiBehaviour.m_FishingTips.SetActive(false);
bool flag = this._yuyinHandler != null;
if (flag)
{
this._yuyinHandler.Show(YuyinIconType.HOME, 2);
this._yuyinHandler.Refresh(YuyinIconType.HOME);
}
}
protected override void OnHide()
{
bool isFishing = this._doc.IsFishing;
if (isFishing)
{
this._doc.LeaveFishing();
XSingleton<XInput>.singleton.Freezed = false;
}
this._itemDoc.ToggleBlock(false);
bool flag = DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.IsLoaded();
if (flag)
{
DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.SetVisible(true, true);
}
XSingleton<XTimerMgr>.singleton.KillTimer(this._timeToken);
base.uiBehaviour.m_HighQualityFx.SetActive(false);
base.uiBehaviour.m_LowQualityFx.SetActive(false);
base.OnHide();
}
protected override void OnUnload()
{
bool isFishing = this._doc.IsFishing;
if (isFishing)
{
this._doc.LeaveFishing();
}
XSingleton<XInput>.singleton.Freezed = false;
this._itemDoc.ToggleBlock(false);
XSingleton<XTimerMgr>.singleton.KillTimer(this._timeToken);
DlgHandlerBase.EnsureUnload<XYuyinView>(ref this._yuyinHandler);
base.OnUnload();
}
public void Refresh(bool showFishResult = false)
{
this._itemDoc.ToggleBlock(false);
bool flag = showFishResult && !this._doc.LastFishingHasFish;
if (flag)
{
XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("HomeFishingFail"), "fece00");
}
bool lastLevelUp = this._doc.LastLevelUp;
if (lastLevelUp)
{
XSingleton<XFxMgr>.singleton.CreateAndPlay(XHomeFishingDocument.LEVELUPFX, XSingleton<XEntityMgr>.singleton.Player.EngineObject, Vector3.zero, Vector3.one, 1f, false, 2f, true);
this._doc.LastLevelUp = false;
}
base.uiBehaviour.m_FishLevelNum.SetText(this._doc.FishingLevel.ToString());
GardenFishConfig.RowData byFishLeve = this._doc._HomeFishTable.GetByFishLeve(this._doc.FishingLevel);
base.uiBehaviour.m_FishExpValue.value = ((byFishLeve.Experience == 0u) ? 1f : (this._doc.CurrentExp * 1f / byFishLeve.Experience));
ulong itemCount = XBagDocument.BagDoc.GetItemCount(XHomeFishingDocument.stoshID);
base.uiBehaviour.m_StoshNum.SetText(itemCount.ToString());
base.uiBehaviour.m_NoStosh.SetActive(itemCount == 0UL);
base.uiBehaviour.m_NoFishTips.SetActive(this._doc.FishList.Count == 0);
base.uiBehaviour.m_ItemScrollView.SetPosition(0f);
base.uiBehaviour.m_FishPool.ReturnAll(false);
Vector3 tplPos = base.uiBehaviour.m_FishPool.TplPos;
for (int i = this._doc.FishList.Count - 1; i >= 0; i--)
{
GameObject gameObject = base.uiBehaviour.m_FishPool.FetchGameObject(false);
gameObject.transform.localPosition = new Vector3(tplPos.x + (float)((this._doc.FishList.Count - 1 - i) * base.uiBehaviour.m_FishPool.TplWidth), tplPos.y);
ItemList.RowData itemConf = XBagDocument.GetItemConf((int)this._doc.FishList[i].itemID);
XSingleton<XItemDrawerMgr>.singleton.normalItemDrawer.DrawItem(gameObject, itemConf, (int)this._doc.FishList[i].itemCount, true);
IXUISprite ixuisprite = gameObject.transform.Find("Icon").GetComponent("XUISprite") as IXUISprite;
ixuisprite.ID = (ulong)this._doc.FishList[i].itemID;
bool flag2 = !itemConf.CanTrade;
if (flag2)
{
ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(XSingleton<UiUtility>.singleton.OnBindItemClick));
}
else
{
ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(XSingleton<UiUtility>.singleton.OnItemClick));
}
}
bool activeInHierarchy = base.uiBehaviour.m_FishLevelFrame.activeInHierarchy;
if (activeInHierarchy)
{
base.uiBehaviour.m_LevelFrameLevel.SetText(this._doc.FishingLevel.ToString());
bool flag3 = byFishLeve.Experience == 0u;
if (flag3)
{
base.uiBehaviour.m_LevelFrameExp.SetText(XStringDefineProxy.GetString("FishingLevelMax"));
base.uiBehaviour.m_LevelFrameExpBar.value = 1f;
}
else
{
base.uiBehaviour.m_LevelFrameExp.SetText(string.Format("{0}/{1}", this._doc.CurrentExp, byFishLeve.Experience));
base.uiBehaviour.m_LevelFrameExpBar.value = this._doc.CurrentExp * 1f / byFishLeve.Experience;
}
}
}
private void ShowFishLevelFrame()
{
uint fishingLevel = this._doc.FishingLevel;
int num = this._doc._HomeFishTable.Table.Length;
uint num2 = 0u;
base.uiBehaviour.m_FishLevelFrame.SetActive(true);
base.uiBehaviour.m_LevelFrameLevel.SetText(this._doc.FishingLevel.ToString());
base.uiBehaviour.m_FishLevelPool.ReturnAll(false);
base.uiBehaviour.m_LevelItemPool.ReturnAll(false);
List<GameObject> list = new List<GameObject>();
HashSet<int> hashSet = new HashSet<int>();
for (int i = 0; i < this._doc.FishInfoTable.Table.Length; i++)
{
bool flag = !this._doc.FishInfoTable.Table[i].ShowInLevel;
if (flag)
{
hashSet.Add((int)this._doc.FishInfoTable.Table[i].FishID);
}
}
IXUIPanel ixuipanel = base.uiBehaviour.m_FishLevelPool._tpl.transform.parent.GetComponent("XUIPanel") as IXUIPanel;
int num3 = (int)(fishingLevel - 1u);
int num4 = num3;
bool flag2 = false;
bool flag3 = (float)(base.uiBehaviour.m_FishLevelPool.TplHeight * (num - num3)) < ixuipanel.ClipRange.w;
if (flag3)
{
num4 = 0;
flag2 = true;
}
Vector3 tplPos = base.uiBehaviour.m_FishLevelPool.TplPos;
Vector3 tplPos2 = base.uiBehaviour.m_LevelItemPool.TplPos;
for (int j = 0; j < num; j++)
{
GardenFishConfig.RowData rowData = this._doc._HomeFishTable.Table[j];
GameObject gameObject = base.uiBehaviour.m_FishLevelPool.FetchGameObject(false);
IXUILabel ixuilabel = gameObject.transform.Find("Level").GetComponent("XUILabel") as IXUILabel;
ixuilabel.SetText(string.Format("{0}{1}", rowData.FishLeve, XStringDefineProxy.GetString("LevelName")));
IXUILabel ixuilabel2 = gameObject.transform.Find("Rate").GetComponent("XUILabel") as IXUILabel;
ixuilabel2.SetText(string.Format("{0}%", rowData.SuccessRate));
IXUILabel ixuilabel3 = gameObject.transform.Find("Exp").GetComponent("XUILabel") as IXUILabel;
ixuilabel3.SetText(num2.ToString());
num2 = rowData.Experience;
bool flag4 = j == num3;
if (flag4)
{
base.uiBehaviour.m_LevelFrameExp.SetText(string.Format("{0}/{1}", this._doc.CurrentExp, num2));
base.uiBehaviour.m_LevelFrameExpBar.value = this._doc.CurrentExp * 1f / num2;
}
int num5 = 0;
for (int k = 0; k < rowData.FishWeight.Count; k++)
{
bool flag5 = !hashSet.Contains(rowData.FishWeight[k, 0]);
if (flag5)
{
hashSet.Add(rowData.FishWeight[k, 0]);
GameObject gameObject2 = base.uiBehaviour.m_LevelItemPool.FetchGameObject(false);
gameObject2.transform.parent = gameObject.transform;
gameObject2.transform.localPosition = new Vector3(tplPos2.x + (float)(num5 * base.uiBehaviour.m_LevelItemPool.TplWidth), 0f);
ItemList.RowData itemConf = XBagDocument.GetItemConf(rowData.FishWeight[k, 0]);
XSingleton<XItemDrawerMgr>.singleton.normalItemDrawer.DrawItem(gameObject2, itemConf, 0, false);
XSingleton<XItemDrawerMgr>.singleton.normalItemDrawer.OpenClickShowTooltipEvent(gameObject2, rowData.FishWeight[k, 0]);
num5++;
}
}
gameObject.transform.localPosition = new Vector3(tplPos.x, tplPos.y - (float)(base.uiBehaviour.m_FishLevelPool.TplHeight * (j - num4)), 0f);
bool flag6 = !flag2 && j < num3;
if (flag6)
{
gameObject.SetActive(false);
list.Add(gameObject);
}
}
base.uiBehaviour.m_FishLevelScrollView.ResetPosition();
bool flag7 = flag2;
if (flag7)
{
base.uiBehaviour.m_FishLevelScrollView.SetPosition(1f);
}
else
{
for (int l = 0; l < list.Count; l++)
{
list[l].SetActive(true);
}
}
}
private bool OnFishLevelBtnClick(IXUIButton btn)
{
this.ShowFishLevelFrame();
return true;
}
private bool OnFishLevelFrameCloseBtnClick(IXUIButton btn)
{
base.uiBehaviour.m_FishLevelFrame.SetActive(false);
return true;
}
private bool OnSweepButtonClicked(IXUIButton button)
{
bool flag = DlgBase<XWelfareView, XWelfareBehaviour>.singleton.CheckActiveMemberPrivilege(MemberPrivilege.KingdomPrivilege_Adventurer);
if (flag)
{
bool flag2 = XBagDocument.BagDoc.GetItemCount(XHomeFishingDocument.stoshID) == 0UL;
if (flag2)
{
XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("FishingStoshLess"), "fece00");
return true;
}
bool flag3 = !XOutlookHelper.CanPlaySpecifiedAnimation(XSingleton<XEntityMgr>.singleton.Player);
if (flag3)
{
return true;
}
bool flag4 = DlgBase<ScreenShotShareView, ScreenShotShareBehaviour>.singleton.IsLoaded() && DlgBase<ScreenShotShareView, ScreenShotShareBehaviour>.singleton.IsVisible();
if (flag4)
{
DlgBase<ScreenShotShareView, ScreenShotShareBehaviour>.singleton.SetVisible(false, true);
}
this._doc.isSweep = true;
this._yuyinHandler.SetVisible(true);
this._doc.SendLevelExpQuery();
this._doc.FishList.Clear();
base.uiBehaviour.m_NoFishTips.SetActive(true);
this.Refresh(false);
base.uiBehaviour.m_InFishingFrame.SetActive(true);
base.uiBehaviour.m_NotFishingFrame.SetActive(false);
DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.SetVisible(false, true);
DlgBase<XChatSmallView, XChatSmallBehaviour>.singleton.SetForceShow(true);
XSingleton<XInput>.singleton.Freezed = true;
this._doc.StartFishing();
}
return true;
}
private bool OnStartFishingBtnClick(IXUIButton btn)
{
bool flag = XBagDocument.BagDoc.GetItemCount(XHomeFishingDocument.stoshID) == 0UL;
bool result;
if (flag)
{
XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("FishingStoshLess"), "fece00");
result = true;
}
else
{
bool flag2 = !XOutlookHelper.CanPlaySpecifiedAnimation(XSingleton<XEntityMgr>.singleton.Player);
if (flag2)
{
result = true;
}
else
{
bool flag3 = DlgBase<ScreenShotShareView, ScreenShotShareBehaviour>.singleton.IsLoaded() && DlgBase<ScreenShotShareView, ScreenShotShareBehaviour>.singleton.IsVisible();
if (flag3)
{
DlgBase<ScreenShotShareView, ScreenShotShareBehaviour>.singleton.SetVisible(false, true);
}
this._doc.isSweep = false;
this._yuyinHandler.SetVisible(true);
this._doc.SendLevelExpQuery();
this._doc.FishList.Clear();
base.uiBehaviour.m_NoFishTips.SetActive(true);
this.Refresh(false);
base.uiBehaviour.m_InFishingFrame.SetActive(true);
base.uiBehaviour.m_NotFishingFrame.SetActive(false);
DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.SetVisible(false, true);
DlgBase<XChatSmallView, XChatSmallBehaviour>.singleton.SetForceShow(true);
XSingleton<XInput>.singleton.Freezed = true;
this._doc.StartFishing();
result = true;
}
}
return result;
}
private bool OnHomeMainBtnClick(IXUIButton btn)
{
DlgBase<HomeMainDlg, TabDlgBehaviour>.singleton.ShowWorkGameSystem(XSysDefine.XSys_Home);
return true;
}
private bool OnHomeCookingBtnClick(IXUIButton btn)
{
DlgBase<HomeMainDlg, TabDlgBehaviour>.singleton.ShowWorkGameSystem(XSysDefine.XSys_Home_Cooking);
return true;
}
public bool OnCloseBtnClick(IXUIButton btn)
{
this._yuyinHandler.SetVisible(false);
this._doc.LeaveFishing();
DlgBase<XChatSmallView, XChatSmallBehaviour>.singleton.SetForceShow(false);
DlgBase<XChatSmallView, XChatSmallBehaviour>.singleton.SetFakeHide(false);
XSingleton<XTimerMgr>.singleton.KillTimer(this._timeToken);
base.uiBehaviour.m_InFishingFrame.SetActive(false);
base.uiBehaviour.m_HighQualityFx.SetActive(false);
base.uiBehaviour.m_LowQualityFx.SetActive(false);
base.uiBehaviour.m_NotFishingFrame.SetActive(true);
DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.SetVisible(true, true);
XSingleton<XInput>.singleton.Freezed = false;
this._itemDoc.ToggleBlock(false);
bool flag = this._doc.FishList.Count != 0;
if (flag)
{
DlgBase<RewdAnimDlg, RewdAnimBehaviour>.singleton.ShowByTitle(this._doc.FishList, XStringDefineProxy.GetString("FishRewardTitle"), null);
}
return true;
}
public void SetFishingTipsState(bool state)
{
base.uiBehaviour.m_FishingTips.SetActive(state);
}
private bool OnHomeShopBtnClick(IXUIButton btn)
{
DlgBase<MallSystemDlg, MallSystemBehaviour>.singleton.ShowShopSystem(XSysDefine.XSys_Mall_Home, 0UL);
return true;
}
public void SetUIState(bool state)
{
if (state)
{
this.SetVisibleWithAnimation(true, null);
base.uiBehaviour.m_InFishingFrame.SetActive(false);
base.uiBehaviour.m_NotFishingFrame.SetActive(true);
}
else
{
this.SetVisible(false, true);
}
}
public void PlayGetFishFx(bool high)
{
base.uiBehaviour.m_HighQualityFx.SetActive(false);
base.uiBehaviour.m_LowQualityFx.SetActive(false);
if (high)
{
base.uiBehaviour.m_HighQualityFx.SetActive(true);
}
else
{
base.uiBehaviour.m_LowQualityFx.SetActive(true);
}
}
public void DelayShowFish()
{
this._timeToken = XSingleton<XTimerMgr>.singleton.SetTimer(2f, new XTimerMgr.ElapsedEventHandler(this.ShowGetFish), null);
}
private void ShowGetFish(object o = null)
{
this.Refresh(true);
}
}
}
|