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
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
|
using System;
using System.Collections.Generic;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient.UI
{
internal class HeroBattleSkillHandler : DlgHandlerBase
{
protected override string FileName
{
get
{
return "GameSystem/HeroBattleSkill";
}
}
private XHeroBattleSkillDocument _doc = null;
private XHeroBattleDocument _heroDoc = null;
public GameObject m_ShowFrame;
public IXUIButton m_BuyBtn;
private IXUIButton m_OKBtn;
private IXUISprite m_PlayBtn;
private IXUIButton m_CloseBtn;
public IXUILabel m_HeroName;
private IXUILabel m_SkillName;
private IXUILabel m_SkillDesc;
private GameObject m_Back;
private XUIPool m_TabPool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
private XUIPool m_SkillPool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
private IXUIPanel m_Panel;
private bool _isBattleScene;
public RenderTexture skillPreView;
public IXUITexture m_Snapshot;
public IXUISprite LastSelectSprite;
private uint _currSkill;
private bool _OnCountDown;
private float _CountDownTime;
private IXUILabel m_CountDown;
private IXUILabel m_CountDownTips;
private bool _showRefresh;
private bool _battleFirstClick;
private IXUISprite m_BoxC;
private Transform _FxTs;
private XFx _Fx;
public IXUIButton OtherViewBuyBtn = null;
public int HandlerType;
public HeroBattleTeamHandler m_HeroBattleTeamHandler;
protected override void Init()
{
base.Init();
this._doc = XDocuments.GetSpecificDocument<XHeroBattleSkillDocument>(XHeroBattleSkillDocument.uuID);
this._heroDoc = XDocuments.GetSpecificDocument<XHeroBattleDocument>(XHeroBattleDocument.uuID);
this._doc.m_HeroBattleSkillHandler = this;
this._doc.CreateSkillBlackHouse();
this._isBattleScene = (XSingleton<XGame>.singleton.CurrentStage.Stage != EXStage.Hall);
this.m_CountDown = (base.PanelObject.transform.Find("LeftTime").GetComponent("XUILabel") as IXUILabel);
this.m_CountDownTips = (this.m_CountDown.gameObject.transform.Find("T").GetComponent("XUILabel") as IXUILabel);
this.m_Back = base.PanelObject.transform.Find("Back").gameObject;
Transform transform = base.PanelObject.transform.Find("ShowFrame");
this.m_ShowFrame = transform.gameObject;
this.m_BuyBtn = (transform.Find("BuyBtn").GetComponent("XUIButton") as IXUIButton);
this.m_OKBtn = (transform.Find("OKBtn").GetComponent("XUIButton") as IXUIButton);
this.m_PlayBtn = (transform.Find("PlayTs/Play").GetComponent("XUISprite") as IXUISprite);
this.m_CloseBtn = (transform.Find("Close").GetComponent("XUIButton") as IXUIButton);
this.m_Snapshot = (transform.Find("Snapshot").GetComponent("XUITexture") as IXUITexture);
transform = base.PanelObject.transform.Find("ShowFrame");
this.m_HeroName = (transform.Find("Name").GetComponent("XUILabel") as IXUILabel);
this.m_SkillName = (transform.Find("SkillDesc/SkillName").GetComponent("XUILabel") as IXUILabel);
this.m_SkillDesc = (transform.Find("SkillDesc/SkillDesc").GetComponent("XUILabel") as IXUILabel);
this.m_Panel = (base.PanelObject.transform.Find("ScrollView").GetComponent("XUIPanel") as IXUIPanel);
this._FxTs = base.PanelObject.transform.Find("FxTs");
transform = base.PanelObject.transform.Find("ScrollView/Tpl");
IXUISprite ixuisprite = transform.GetComponent("XUISprite") as IXUISprite;
bool flag = this._isBattleScene && ixuisprite.spriteHeight * ((this._heroDoc.OverWatchReader.Table.Length + 1) / 2) > 640;
if (flag)
{
transform.gameObject.transform.localPosition = new Vector3(transform.gameObject.transform.localPosition.x, transform.gameObject.transform.localPosition.y + 64f);
}
this.m_TabPool.SetupPool(transform.parent.gameObject, transform.gameObject, 10u, false);
transform = base.PanelObject.transform.Find("ShowFrame/ShowSkill/Tpl");
this.m_SkillPool.SetupPool(transform.parent.gameObject, transform.gameObject, 5u, false);
this.SetupTabs();
this._showRefresh = false;
this._battleFirstClick = true;
this.m_BoxC = (base.PanelObject.transform.Find("Box").GetComponent("XUISprite") as IXUISprite);
bool isBattleScene = this._isBattleScene;
if (isBattleScene)
{
this.m_Panel.ClipRange = new Vector4(0f, 0f, 300f, 640f);
this.m_CountDown.SetVisible(true);
this._doc.IsPreViewShow = true;
this.m_ShowFrame.SetActive(false);
this.m_Back.SetActive(true);
this.m_BoxC.SetVisible(true);
this.m_HeroBattleTeamHandler = DlgHandlerBase.EnsureCreate<HeroBattleTeamHandler>(ref this.m_HeroBattleTeamHandler, base.PanelObject.transform.Find("TeamTs"), false, null);
}
else
{
this.SetSkillPreViewState(false, 0);
this.m_BuyBtn.SetVisible(false);
this.m_OKBtn.SetVisible(false);
this.m_CountDown.SetVisible(false);
this.m_Panel.ClipRange = new Vector4(0f, -32f, 300f, 586f);
this.m_Back.SetActive(false);
this.m_BoxC.SetVisible(false);
}
}
public override void RegisterEvent()
{
base.RegisterEvent();
this.m_CloseBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseBtnClick));
this.m_PlayBtn.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnPlayBtnClick));
this.m_OKBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnOKBtnClick));
this.m_BuyBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnBuyBtnClick));
}
protected override void OnShow()
{
base.OnShow();
bool flag = this.skillPreView == null;
if (flag)
{
this.skillPreView = new RenderTexture(600, 338, 1, 0, 0);
this.skillPreView.name = "SkillPreview";
this.skillPreView.autoGenerateMips = false;
this.skillPreView.Create();
}
this.m_Snapshot.SetRuntimeTex(this.skillPreView, true);
this._doc.SetSkillPreviewTexture(this.skillPreView);
this.SetUVRectangle();
bool flag2 = this._showRefresh && this.LastSelectSprite != null;
if (flag2)
{
this._showRefresh = false;
this.OnTabClick(this.LastSelectSprite);
}
bool flag3 = this.m_HeroBattleTeamHandler != null;
if (flag3)
{
this.m_HeroBattleTeamHandler.SetVisible(true);
}
}
protected override void OnHide()
{
base.OnHide();
this._doc.DelDummy();
bool flag = this._doc.BlackHouseCamera != null;
if (flag)
{
this._doc.BlackHouseCamera.enabled = false;
}
this._doc.SetSkillPreviewTexture(null);
bool flag2 = this._Fx != null;
if (flag2)
{
XSingleton<XFxMgr>.singleton.DestroyFx(this._Fx, true);
}
bool flag3 = this.skillPreView != null;
if (flag3)
{
this.m_Snapshot.SetRuntimeTex(null, true);
this.skillPreView.Release();
this.skillPreView = null;
}
bool isBattleScene = this._isBattleScene;
if (isBattleScene)
{
this._showRefresh = true;
}
bool flag4 = this.m_HeroBattleTeamHandler != null;
if (flag4)
{
this.m_HeroBattleTeamHandler.SetVisible(false);
}
}
public override void OnUnload()
{
this.LastSelectSprite = null;
this._doc.m_HeroBattleSkillHandler = null;
DlgHandlerBase.EnsureUnload<HeroBattleTeamHandler>(ref this.m_HeroBattleTeamHandler);
this._doc.DelDummy();
bool flag = this._doc.BlackHouseCamera != null;
if (flag)
{
this._doc.BlackHouseCamera.enabled = false;
}
this._doc.SetSkillPreviewTexture(null);
bool flag2 = this.skillPreView != null;
if (flag2)
{
this.skillPreView.Release();
this.skillPreView = null;
}
bool flag3 = this._Fx != null;
if (flag3)
{
XSingleton<XFxMgr>.singleton.DestroyFx(this._Fx, true);
this._Fx = null;
}
base.OnUnload();
}
public void SetFx()
{
bool isBattleScene = this._isBattleScene;
if (!isBattleScene)
{
bool flag = this._Fx != null;
if (flag)
{
XSingleton<XFxMgr>.singleton.DestroyFx(this._Fx, true);
}
this._Fx = XSingleton<XFxMgr>.singleton.CreateFx("Effects/FX_Particle/UIfx/UI_yh", null, true);
this._Fx.Play(this._FxTs, Vector3.zero, Vector3.one, 1f, true, false);
}
}
private bool OnCloseBtnClick(IXUIButton btn)
{
bool isBattleScene = this._isBattleScene;
if (isBattleScene)
{
bool flag = !this._doc.AlSelectHero;
if (flag)
{
return false;
}
base.SetVisible(false);
}
else
{
this.SetSkillPreViewState(false, 0);
}
return true;
}
private void OnPlayBtnClick(IXUISprite iSp)
{
this.SetPlayBtnState(false);
XSingleton<XSkillPreViewMgr>.singleton.ShowSkill(this._doc.Dummy, this._currSkill, this._doc.CurrentEntityStatisticsID[this.HandlerType]);
}
private bool OnOKBtnClick(IXUIButton btn)
{
this._doc.QuerySelectBattleHero();
return true;
}
public bool OnSureUseExperienceTicket(IXUIButton btn)
{
DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(false, true);
this._doc.QueryUseExperienceTicket();
return true;
}
public void OnExperienceClick(IXUISprite iSp)
{
bool flag = !this._doc.CSSH && this._doc.TAS.Contains((uint)iSp.ID);
if (flag)
{
XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("HeroBattleSameHeroTips"), "fece00");
}
bool flag2 = this._doc.AlreadyGetList.Contains((uint)iSp.ID) || this._doc.WeekFreeList.Contains((uint)iSp.ID) || this._doc.ExperienceList.Contains((uint)iSp.ID);
if (!flag2)
{
uint experienceTicketID = this._heroDoc.GetExperienceTicketID((uint)iSp.ID);
bool flag3 = experienceTicketID > 0u;
if (flag3)
{
HeroBattleExperienceHero.RowData byItemID = this._heroDoc.HeroExperienceReader.GetByItemID(experienceTicketID);
OverWatchTable.RowData byHeroID = this._heroDoc.OverWatchReader.GetByHeroID((uint)iSp.ID);
bool flag4 = byItemID == null || byHeroID == null;
if (flag4)
{
XSingleton<XDebug>.singleton.AddErrorLog("UseExperienceTicket error. itemid = ", experienceTicketID.ToString(), null, null, null, null);
}
else
{
this._doc.CurrentSelectExperienceTicketID = experienceTicketID;
string text = XSingleton<UiUtility>.singleton.ReplaceReturn(XStringDefineProxy.GetString("HeroBattleExperienceQues"));
text = string.Format(text, byHeroID.Name, byItemID.ShowTime);
string @string = XStringDefineProxy.GetString("COMMON_OK");
string string2 = XStringDefineProxy.GetString("COMMON_CANCEL");
XSingleton<UiUtility>.singleton.ShowModalDialog(text, @string, string2, new ButtonClickEventHandler(this.OnSureUseExperienceTicket));
}
}
}
}
public void OnTabClick(IXUISprite iSp)
{
bool flag = this._isBattleScene && this._battleFirstClick;
if (flag)
{
this._battleFirstClick = false;
this.m_ShowFrame.SetActive(true);
}
bool flag2 = this.LastSelectSprite != null;
GameObject gameObject;
if (flag2)
{
gameObject = this.LastSelectSprite.gameObject.transform.Find("select").gameObject;
gameObject.SetActive(false);
}
this.LastSelectSprite = iSp;
this._doc.CurrentSelect = (uint)iSp.ID;
gameObject = iSp.gameObject.transform.Find("select").gameObject;
gameObject.SetActive(true);
bool isBattleScene = this._isBattleScene;
if (isBattleScene)
{
bool flag3 = this._doc.AlreadyGetList.Contains(this._doc.CurrentSelect) || this._doc.WeekFreeList.Contains(this._doc.CurrentSelect) || this._doc.ExperienceList.Contains(this._doc.CurrentSelect);
if (flag3)
{
this.m_OKBtn.SetVisible(true);
bool flag4 = !this._doc.CSSH && this._doc.TAS.Contains(this._doc.CurrentSelect);
this.m_OKBtn.SetGrey(!flag4);
this.m_BuyBtn.SetVisible(false);
}
else
{
this.m_OKBtn.SetVisible(false);
this.m_BuyBtn.SetVisible(true);
this.SetBuyBtnPrice(this.m_BuyBtn);
}
}
else
{
bool flag5 = this._doc.IsPreViewShow && !this._doc.AlreadyGetList.Contains(this._doc.CurrentSelect);
this.m_BuyBtn.SetVisible(flag5);
bool flag6 = flag5;
if (flag6)
{
this.SetBuyBtnPrice(this.m_BuyBtn);
}
}
bool flag7 = !this._isBattleScene && DlgBase<HeroBattleDlg, HeroBattleBehaviour>.singleton.IsVisible();
if (flag7)
{
DlgBase<HeroBattleDlg, HeroBattleBehaviour>.singleton.RefreshSelectMsg();
}
bool flag8 = !this._isBattleScene && DlgBase<MobaEntranceView, MobaEntranceBehaviour>.singleton.IsVisible();
if (flag8)
{
DlgBase<MobaEntranceView, MobaEntranceBehaviour>.singleton.RefreshSelectMsg();
}
bool activeInHierarchy = this.m_ShowFrame.activeInHierarchy;
if (activeInHierarchy)
{
this.SetupPreViewInfo(0);
XSingleton<XSkillPreViewMgr>.singleton.SkillShowEnd(this._doc.Dummy);
XSingleton<XSkillPreViewMgr>.singleton.SkillShowBegin(this._doc.Dummy, this._doc.BlackHouseCamera);
}
}
private int Compare(uint x, uint y)
{
bool flag = x == y;
int result;
if (flag)
{
result = 0;
}
else
{
bool flag2 = this._doc.ExperienceList.Contains(x) != this._doc.ExperienceList.Contains(y);
if (flag2)
{
result = (this._doc.ExperienceList.Contains(x) ? -1 : 1);
}
else
{
bool flag3 = this._doc.WeekFreeList.Contains(x) != this._doc.WeekFreeList.Contains(y);
if (flag3)
{
bool flag4 = this._doc.ExperienceList.Contains(x) && this._doc.ExperienceList.Contains(y);
if (flag4)
{
result = (this._doc.WeekFreeList.Contains(x) ? 1 : -1);
}
else
{
result = (this._doc.WeekFreeList.Contains(x) ? -1 : 1);
}
}
else
{
bool flag5 = this._doc.AlreadyGetList.Contains(x) != this._doc.AlreadyGetList.Contains(y);
if (flag5)
{
bool flag6 = this._doc.ExperienceList.Contains(x) && this._doc.ExperienceList.Contains(y);
if (flag6)
{
result = (this._doc.AlreadyGetList.Contains(x) ? 1 : -1);
}
else
{
result = (this._doc.AlreadyGetList.Contains(x) ? -1 : 1);
}
}
else
{
result = this._heroDoc.OverWatchReader.GetByHeroID(x).SortID - this._heroDoc.OverWatchReader.GetByHeroID(y).SortID;
}
}
}
}
return result;
}
public void SetupTabs()
{
this.LastSelectSprite = null;
this._doc.SetUnSelect();
this.m_TabPool.ReturnAll(false);
List<uint> list = new List<uint>();
for (int i = 0; i < this._heroDoc.OverWatchReader.Table.Length; i++)
{
list.Add(this._heroDoc.OverWatchReader.Table[i].HeroID);
}
list.Sort(new Comparison<uint>(this.Compare));
SpriteClickEventHandler spriteClickEventHandler = new SpriteClickEventHandler(this.OnTabClick);
spriteClickEventHandler = (SpriteClickEventHandler)Delegate.Combine(spriteClickEventHandler, new SpriteClickEventHandler(this.OnExperienceClick));
Vector3 tplPos = this.m_TabPool.TplPos;
for (int j = 0; j < list.Count; j++)
{
OverWatchTable.RowData byHeroID = this._heroDoc.OverWatchReader.GetByHeroID(list[j]);
GameObject gameObject = this.m_TabPool.FetchGameObject(false);
gameObject.transform.localPosition = new Vector3(tplPos.x + (float)((j & 1) * this.m_TabPool.TplWidth), tplPos.y - (float)(j / 2 * this.m_TabPool.TplHeight));
IXUISprite ixuisprite = gameObject.GetComponent("XUISprite") as IXUISprite;
ixuisprite.ID = (ulong)byHeroID.HeroID;
ixuisprite.RegisterSpriteClickEventHandler(spriteClickEventHandler);
IXUISprite ixuisprite2 = gameObject.transform.Find("Bg/Icon").GetComponent("XUISprite") as IXUISprite;
ixuisprite2.SetSprite(byHeroID.Icon, byHeroID.IconAtlas, false);
GameObject gameObject2 = gameObject.transform.Find("select").gameObject;
gameObject2.SetActive(false);
this.RefreshSingleTab(byHeroID, gameObject);
bool flag = !this._isBattleScene && this._doc.CurrentSelect == this._doc.UNSELECT;
if (flag)
{
this.OnTabClick(ixuisprite);
}
}
}
public void RefreshTab()
{
List<GameObject> list = ListPool<GameObject>.Get();
this.m_TabPool.GetActiveList(list);
for (int i = 0; i < list.Count; i++)
{
GameObject gameObject = list[i];
IXUISprite ixuisprite = gameObject.GetComponent("XUISprite") as IXUISprite;
OverWatchTable.RowData byHeroID = this._heroDoc.OverWatchReader.GetByHeroID((uint)ixuisprite.ID);
this.RefreshSingleTab(byHeroID, gameObject);
}
ListPool<GameObject>.Release(list);
bool flag = this.LastSelectSprite != null;
if (flag)
{
this.OnTabClick(this.LastSelectSprite);
}
}
private void RefreshSingleTab(OverWatchTable.RowData data, GameObject go)
{
GameObject gameObject = go.transform.Find("Bg/Have").gameObject;
gameObject.SetActive(this._doc.AlreadyGetList.Contains(data.HeroID));
GameObject gameObject2 = go.transform.Find("Bg/xm").gameObject;
gameObject2.SetActive(this._doc.WeekFreeList.Contains(data.HeroID));
IXUISprite ixuisprite = go.transform.Find("Bg/Icon").GetComponent("XUISprite") as IXUISprite;
bool flag = this._doc.WeekFreeList.Contains(data.HeroID) || this._doc.AlreadyGetList.Contains(data.HeroID) || this._doc.ExperienceList.Contains(data.HeroID);
bool flag2 = !this._doc.CSSH;
if (flag2)
{
flag = (flag && !this._doc.TAS.Contains(data.HeroID));
}
ixuisprite.SetGrey(flag);
bool flag3 = !flag;
if (flag3)
{
ixuisprite.SetAlpha(1f);
}
GameObject gameObject3 = go.transform.Find("Bg/Experience").gameObject;
gameObject3.SetActive(!this._doc.AlreadyGetList.Contains(data.HeroID) && !this._doc.WeekFreeList.Contains(data.HeroID) && this._doc.ExperienceList.Contains(data.HeroID));
GameObject gameObject4 = go.transform.Find("Bg/UseExperience").gameObject;
gameObject4.SetActive(!this._doc.WeekFreeList.Contains(data.HeroID) && !this._doc.AlreadyGetList.Contains(data.HeroID) && !this._doc.ExperienceList.Contains(data.HeroID) && this._heroDoc.GetExperienceTicketID(data.HeroID) > 0u);
GameObject gameObject5 = go.transform.Find("Bg/TeammateChoose").gameObject;
gameObject5.SetActive(this._isBattleScene && !this._doc.CSSH && this._doc.TAS.Contains(data.HeroID));
}
private void SetupPreViewInfo(int index = 0)
{
this._doc.ReplaceDummy(this.HandlerType);
OverWatchTable.RowData byHeroID = this._heroDoc.OverWatchReader.GetByHeroID(this._doc.CurrentSelect);
this.m_HeroName.SetText(byHeroID.Name);
List<uint> list = new List<uint>();
uint presentID = XSingleton<XEntityMgr>.singleton.EntityStatistics.GetByID(this._doc.CurrentEntityStatisticsID[this.HandlerType]).PresentID;
XEntityPresentation.RowData byPresentID = XSingleton<XEntityMgr>.singleton.EntityInfo.GetByPresentID(presentID);
int num = (this.HandlerType == 2) ? 4 : 5;
int num2 = 0;
while (list.Count < num && num2 < byPresentID.OtherSkills.Length)
{
bool flag = string.IsNullOrEmpty(byPresentID.OtherSkills[num2]) || byPresentID.OtherSkills[num2] == "E";
if (!flag)
{
list.Add(XSingleton<XSkillEffectMgr>.singleton.GetSkillID(byPresentID.OtherSkills[num2], this._doc.CurrentEntityStatisticsID[this.HandlerType]));
}
num2++;
}
this.m_SkillPool.ReturnAll(false);
Vector3 tplPos = this.m_SkillPool.TplPos;
IXUICheckBox ixuicheckBox = null;
for (int i = 0; i < list.Count; i++)
{
SkillList.RowData skillConfig = XSingleton<XSkillEffectMgr>.singleton.GetSkillConfig(list[i], 0u, this._doc.CurrentEntityStatisticsID[this.HandlerType]);
GameObject gameObject = this.m_SkillPool.FetchGameObject(false);
gameObject.name = list[i].ToString();
gameObject.transform.localPosition = new Vector3(tplPos.x, tplPos.y - (float)(i * this.m_SkillPool.TplHeight));
IXUISprite ixuisprite = gameObject.transform.Find("Bg").GetComponent("XUISprite") as IXUISprite;
bool flag2 = skillConfig.SkillType == 2;
if (flag2)
{
ixuisprite.SetSprite("JN_dk_0");
}
else
{
ixuisprite.SetSprite("JN_dk");
}
IXUISprite ixuisprite2 = gameObject.transform.Find("Icon").GetComponent("XUISprite") as IXUISprite;
ixuisprite2.SetSprite(skillConfig.Icon, skillConfig.Atlas, false);
IXUICheckBox ixuicheckBox2 = gameObject.GetComponent("XUICheckBox") as IXUICheckBox;
ixuicheckBox2.ID = (ulong)list[i];
ixuicheckBox2.RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this.OnSkillPreViewClick));
ixuicheckBox2.bChecked = false;
bool flag3 = i == index;
if (flag3)
{
this._currSkill = list[i];
ixuicheckBox = ixuicheckBox2;
this.SetupSkillInfo();
}
}
ixuicheckBox.bChecked = true;
}
public List<uint> SkillInfo()
{
List<uint> list = new List<uint>();
uint presentID = XSingleton<XEntityMgr>.singleton.EntityStatistics.GetByID(this._doc.CurrentEntityStatisticsID[this.HandlerType]).PresentID;
XEntityPresentation.RowData byPresentID = XSingleton<XEntityMgr>.singleton.EntityInfo.GetByPresentID(presentID);
for (int i = 0; i < byPresentID.OtherSkills.Length; i++)
{
bool flag = string.IsNullOrEmpty(byPresentID.OtherSkills[i]) || byPresentID.OtherSkills[i] == "E";
if (!flag)
{
list.Add(XSingleton<XSkillEffectMgr>.singleton.GetSkillID(byPresentID.OtherSkills[i], this._doc.CurrentEntityStatisticsID[this.HandlerType]));
}
}
return list;
}
private bool OnSkillPreViewClick(IXUICheckBox icb)
{
bool flag = !icb.bChecked;
bool result;
if (flag)
{
result = true;
}
else
{
this._currSkill = (uint)icb.ID;
this.SetupSkillInfo();
result = true;
}
return result;
}
private bool OnBuyBtnClick(IXUIButton btn)
{
this._doc.QueryBuyHero(this._doc.CurrentSelect);
return true;
}
private void SetupSkillInfo()
{
SkillList.RowData skillConfig = XSingleton<XSkillEffectMgr>.singleton.GetSkillConfig(this._currSkill, 0u, this._doc.CurrentEntityStatisticsID[this.HandlerType]);
this.m_SkillName.SetText(skillConfig.ScriptName);
this.m_SkillDesc.SetText(skillConfig.CurrentLevelDescription);
this.SetPlayBtnState(true);
XSingleton<XSkillPreViewMgr>.singleton.SkillShowEnd(this._doc.Dummy);
XSingleton<XSkillPreViewMgr>.singleton.SkillShowBegin(this._doc.Dummy, this._doc.BlackHouseCamera);
}
public void SetSkillPreViewState(bool state, int index = 0)
{
this._doc.IsPreViewShow = state;
this.m_ShowFrame.SetActive(state);
bool flag = !this._isBattleScene;
if (flag)
{
this.m_Back.SetActive(state);
}
if (state)
{
this.SetupPreViewInfo(index);
if (state)
{
bool flag2 = this._doc.IsPreViewShow && !this._doc.AlreadyGetList.Contains(this._doc.CurrentSelect);
this.m_BuyBtn.SetVisible(flag2);
bool flag3 = flag2;
if (flag3)
{
this.SetBuyBtnPrice(this.m_BuyBtn);
}
}
}
bool flag4 = !this._isBattleScene && this.OtherViewBuyBtn != null;
if (flag4)
{
bool flag5 = !this._doc.IsPreViewShow && !this._doc.AlreadyGetList.Contains(this._doc.CurrentSelect);
this.OtherViewBuyBtn.SetVisible(flag5);
bool flag6 = flag5;
if (flag6)
{
this.SetBuyBtnPrice(this.OtherViewBuyBtn);
}
}
}
private void SetBuyBtnPrice(IXUIButton btn)
{
OverWatchTable.RowData byHeroID = this._heroDoc.OverWatchReader.GetByHeroID(this._doc.CurrentSelect);
ItemList.RowData itemConf = XBagDocument.GetItemConf((int)byHeroID.Price[0]);
IXUISprite ixuisprite = btn.gameObject.transform.Find("Icon").GetComponent("XUISprite") as IXUISprite;
ixuisprite.spriteName = itemConf.ItemIcon1[0];
IXUILabel ixuilabel = btn.gameObject.transform.Find("Cost").GetComponent("XUILabel") as IXUILabel;
ixuilabel.SetText(byHeroID.Price[1].ToString());
}
public void SetUVRectangle()
{
Rect rect = this._doc.BlackHouseCamera.rect;
rect.y = (rect.y * 338f + 1f) / 338f;
rect.height = (rect.height * 338f - 2f) / 338f;
this.m_Snapshot.SetUVRect(rect);
}
public void SetPlayBtnState(bool state)
{
this.m_PlayBtn.transform.localPosition = (state ? Vector3.zero : XGameUI.Far_Far_Away);
}
public void SetCountDown(float time, bool isChooseHero)
{
this.m_CountDownTips.SetText(XStringDefineProxy.GetString(isChooseHero ? "HeroBattleSelectHeroTips" : "HeroBattleChangeHeroTips"));
this._OnCountDown = true;
this._CountDownTime = Time.realtimeSinceStartup + time;
}
public override void OnUpdate()
{
bool onCountDown = this._OnCountDown;
if (onCountDown)
{
int num = 0;
bool flag = this._CountDownTime < Time.realtimeSinceStartup;
if (flag)
{
this._OnCountDown = false;
}
else
{
num = (int)(this._CountDownTime - Time.realtimeSinceStartup);
}
this.m_CountDown.SetText(num.ToString());
}
}
}
}
|