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
|
using System;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient.UI.CustomBattle
{
internal class CustomBattleChestHandler : DlgHandlerBase
{
protected override string FileName
{
get
{
return "GameSystem/CustomBattle/ChestFrame";
}
}
private XCustomBattleDocument _doc = null;
private IXUISprite _close;
private XUIPool _item_pool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
private IXUIButton _fetch_btn;
private Transform _wait_open_frame;
private IXUIButton _open_now;
private IXUILabel _left_time;
private IXUILabelSymbol _cost;
private XLeftTimeCounter _boxCD;
private Transform _fx_point;
private XFx _fx = null;
protected override void Init()
{
base.Init();
this._doc = XDocuments.GetSpecificDocument<XCustomBattleDocument>(XCustomBattleDocument.uuID);
this._close = (base.transform.Find("Close").GetComponent("XUISprite") as IXUISprite);
Transform transform = base.transform.Find("List/Item");
this._item_pool.SetupPool(transform.parent.gameObject, transform.gameObject, 4u, false);
this._fetch_btn = (base.transform.Find("FetchBtn").GetComponent("XUIButton") as IXUIButton);
this._wait_open_frame = base.transform.Find("WaitFrame");
this._open_now = (base.transform.Find("WaitFrame/OpenBtn").GetComponent("XUIButton") as IXUIButton);
this._left_time = (base.transform.Find("WaitFrame/Time").GetComponent("XUILabel") as IXUILabel);
this._boxCD = new XLeftTimeCounter(this._left_time, false);
this._cost = (base.transform.Find("WaitFrame/OpenBtn/Cost").GetComponent("XUILabelSymbol") as IXUILabelSymbol);
this._fx_point = base.transform.Find("Title/Box/Fx");
}
public override void RegisterEvent()
{
base.RegisterEvent();
this._close.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnCloseClicked));
this._fetch_btn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnFetchButtonClicked));
this._open_now.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnOpenNowButtonClicked));
}
protected override void OnHide()
{
this._doc.DestoryFx(this._fx);
this._fx = null;
base.OnHide();
}
public override void OnUnload()
{
this._doc.DestoryFx(this._fx);
this._fx = null;
base.OnUnload();
}
private void OnCloseClicked(IXUISprite sp)
{
base.SetVisible(false);
}
private bool OnFetchButtonClicked(IXUIButton button)
{
bool flag = DlgBase<CustomBattleView, TabDlgBehaviour>.singleton._BountyModeDetailHandler != null && DlgBase<CustomBattleView, TabDlgBehaviour>.singleton._BountyModeDetailHandler.IsVisible();
if (flag)
{
this._doc.SendCustomBattleGetReward(this._doc.CurrentBountyData.gameID);
}
bool flag2 = DlgBase<CustomBattleView, TabDlgBehaviour>.singleton._CustomModeDetailHandler != null && DlgBase<CustomBattleView, TabDlgBehaviour>.singleton._CustomModeDetailHandler.IsVisible();
if (flag2)
{
this._doc.SendCustomBattleGetReward(this._doc.CurrentCustomData.gameID);
}
return true;
}
private bool OnOpenNowButtonClicked(IXUIButton button)
{
bool flag = DlgBase<CustomBattleView, TabDlgBehaviour>.singleton._BountyModeDetailHandler != null && DlgBase<CustomBattleView, TabDlgBehaviour>.singleton._BountyModeDetailHandler.IsVisible();
if (flag)
{
this._doc.SendCustomBattleClearCD(this._doc.CurrentBountyData.gameID);
}
bool flag2 = DlgBase<CustomBattleView, TabDlgBehaviour>.singleton._CustomModeDetailHandler != null && DlgBase<CustomBattleView, TabDlgBehaviour>.singleton._CustomModeDetailHandler.IsVisible();
if (flag2)
{
this._doc.SendCustomBattleClearCD(this._doc.CurrentCustomData.gameID);
}
return true;
}
protected override void OnShow()
{
base.OnShow();
this.RefreshData();
}
public override void RefreshData()
{
base.RefreshData();
bool flag = DlgBase<CustomBattleView, TabDlgBehaviour>.singleton._BountyModeDetailHandler != null && DlgBase<CustomBattleView, TabDlgBehaviour>.singleton._BountyModeDetailHandler.IsVisible();
if (flag)
{
this.RefreshBountyData();
}
bool flag2 = DlgBase<CustomBattleView, TabDlgBehaviour>.singleton._CustomModeDetailHandler != null && DlgBase<CustomBattleView, TabDlgBehaviour>.singleton._CustomModeDetailHandler.IsVisible();
if (flag2)
{
this.RefreshCustomData();
}
}
private void RefreshBountyData()
{
bool flag = this._doc.CurrentBountyData == null;
if (!flag)
{
this._item_pool.ReturnAll(false);
SeqListRef<uint> systemBattleReward = this._doc.GetSystemBattleReward((uint)this._doc.CurrentBountyData.gameID, this._doc.CurrentBountyData.winCount);
for (int i = 0; i < systemBattleReward.Count; i++)
{
GameObject gameObject = this._item_pool.FetchGameObject(false);
gameObject.transform.localPosition = this._item_pool.TplPos + new Vector3(((float)i - (float)(systemBattleReward.Count - 1) / 2f) * (float)this._item_pool.TplWidth, 0f);
XSingleton<XItemDrawerMgr>.singleton.normalItemDrawer.DrawItem(gameObject, (int)systemBattleReward[i, 0], (int)systemBattleReward[i, 1], false);
}
this._doc.DestoryFx(this._fx);
this._fx = null;
bool flag2 = this._doc.CurrentBountyData.boxLeftTime == 0u;
if (flag2)
{
this._fetch_btn.SetVisible(true);
this._wait_open_frame.gameObject.SetActive(false);
this._boxCD.SetLeftTime(0f, -1);
this._fx = XSingleton<XFxMgr>.singleton.CreateUIFx("Effects/FX_Particle/UIfx/UI_BountyModeListFrame_Clip01", this._fx_point, false);
}
else
{
this._fetch_btn.SetVisible(false);
this._wait_open_frame.gameObject.SetActive(true);
this._boxCD.SetLeftTime(this._doc.CurrentBountyData.boxLeftTime, -1);
SeqRef<uint> systemBattleQuickOpenCost = this._doc.GetSystemBattleQuickOpenCost((uint)this._doc.CurrentBountyData.gameID, this._doc.CurrentBountyData.winCount);
this._cost.InputText = XLabelSymbolHelper.FormatSmallIcon((int)systemBattleQuickOpenCost[0]) + " " + systemBattleQuickOpenCost[1].ToString();
}
}
}
private void RefreshCustomData()
{
bool flag = this._doc.CurrentCustomData == null;
if (!flag)
{
this._item_pool.ReturnAll(false);
SeqListRef<uint> customBattleRewardByRank = this._doc.GetCustomBattleRewardByRank(this._doc.CurrentCustomData.configID, this._doc.CurrentCustomData.selfRank);
for (int i = 0; i < customBattleRewardByRank.Count; i++)
{
GameObject gameObject = this._item_pool.FetchGameObject(false);
gameObject.transform.localPosition = this._item_pool.TplPos + new Vector3(((float)i - (float)(customBattleRewardByRank.Count - 1) / 2f) * (float)this._item_pool.TplWidth, 0f);
XSingleton<XItemDrawerMgr>.singleton.normalItemDrawer.DrawItem(gameObject, (int)customBattleRewardByRank[i, 0], (int)customBattleRewardByRank[i, 1], false);
}
this._doc.DestoryFx(this._fx);
this._fx = null;
bool flag2 = this._doc.CurrentCustomData.boxLeftTime == 0u;
if (flag2)
{
this._fetch_btn.SetVisible(true);
this._wait_open_frame.gameObject.SetActive(false);
this._boxCD.SetLeftTime(0f, -1);
this._fx = XSingleton<XFxMgr>.singleton.CreateUIFx("Effects/FX_Particle/UIfx/UI_BountyModeListFrame_Clip01", this._fx_point, false);
}
else
{
this._fetch_btn.SetVisible(false);
this._wait_open_frame.gameObject.SetActive(true);
this._boxCD.SetLeftTime(this._doc.CurrentCustomData.boxLeftTime, -1);
SeqRef<uint> customBattleQuickOpenCost = this._doc.GetCustomBattleQuickOpenCost(this._doc.CurrentCustomData.configID, this._doc.CurrentCustomData.selfRank);
this._cost.InputText = XLabelSymbolHelper.FormatSmallIcon((int)customBattleQuickOpenCost[0]) + " " + customBattleQuickOpenCost[1].ToString();
}
}
}
public override void OnUpdate()
{
base.OnUpdate();
bool activeInHierarchy = this._wait_open_frame.gameObject.activeInHierarchy;
if (activeInHierarchy)
{
this._boxCD.Update();
}
}
}
}
|