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
|
using System;
using KKSG;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient.UI
{
internal class XTeamLeagueBattlePrepareView : DlgBase<XTeamLeagueBattlePrepareView, XTeamLeagueBattlePrepareBehaviour>
{
public override string fileName
{
get
{
return "Battle/TeamLeagueBattleDlg";
}
}
public override int layer
{
get
{
return 1;
}
}
public override bool autoload
{
get
{
return true;
}
}
private XTeamLeagueBattleDocument _BattleDoc;
private XFreeTeamVersusLeagueDocument _BaseDoc;
public LevelRewardTeamLeagueSmallHandler SmallRewardHandler = null;
public LevelRewardTeamLeagueBigHandler BigRewardHandler = null;
protected override void Init()
{
base.Init();
this._BattleDoc = XDocuments.GetSpecificDocument<XTeamLeagueBattleDocument>(XTeamLeagueBattleDocument.uuID);
this._BaseDoc = XDocuments.GetSpecificDocument<XFreeTeamVersusLeagueDocument>(XFreeTeamVersusLeagueDocument.uuID);
}
public override void RegisterEvent()
{
base.RegisterEvent();
base.uiBehaviour.m_UpBtn.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnUp));
base.uiBehaviour.m_DownBtn.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnDown));
base.uiBehaviour.m_BlueViewSwitch.ID = 0UL;
base.uiBehaviour.m_BlueViewSwitch.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnLeftToogle));
base.uiBehaviour.m_RedViewSwitch.ID = 0UL;
base.uiBehaviour.m_RedViewSwitch.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnRightToogle));
}
private void OnUp(IXUISprite btn)
{
this._BattleDoc.ReqBattle(LeagueBattleReadyOper.LBReady_Up);
}
private void OnDown(IXUISprite btn)
{
this._BattleDoc.ReqBattle(LeagueBattleReadyOper.LBReady_Down);
}
private void OnLeftToogle(IXUISprite btn)
{
int num = (int)btn.ID;
base.uiBehaviour.m_BlueViewTween.SetTweenGroup(num);
base.uiBehaviour.m_BlueViewTween.PlayTween(true, -1f);
base.uiBehaviour.m_UpDownTween.SetTweenGroup(num);
base.uiBehaviour.m_UpDownTween.PlayTween(true, -1f);
btn.ID = (ulong)((num == 0) ? 1L : 0L);
}
private void OnRightToogle(IXUISprite btn)
{
int num = (int)btn.ID;
base.uiBehaviour.m_RedViewTween.SetTweenGroup(num);
base.uiBehaviour.m_RedViewTween.PlayTween(true, -1f);
btn.ID = (ulong)((num == 0) ? 1L : 0L);
}
protected override void OnShow()
{
base.OnShow();
this.RefreshTeamName();
}
private void RefreshTeamName()
{
bool flag = this._BattleDoc.LoadingInfoBlue != null;
if (flag)
{
IXUILabel ixuilabel = base.uiBehaviour.m_BlueView.Find("Title1").GetComponent("XUILabel") as IXUILabel;
ixuilabel.SetText(this._BattleDoc.LoadingInfoBlue.name);
}
bool flag2 = this._BattleDoc.LoadingInfoRed != null;
if (flag2)
{
IXUILabel ixuilabel2 = base.uiBehaviour.m_RedView.Find("Title1").GetComponent("XUILabel") as IXUILabel;
ixuilabel2.SetText(this._BattleDoc.LoadingInfoRed.name);
}
}
protected override void OnHide()
{
base.OnHide();
}
protected override void OnUnload()
{
DlgHandlerBase.EnsureUnload<LevelRewardTeamLeagueSmallHandler>(ref this.SmallRewardHandler);
DlgHandlerBase.EnsureUnload<LevelRewardTeamLeagueBigHandler>(ref this.BigRewardHandler);
base.OnUnload();
}
public void ResetCommonUI(bool show = true)
{
bool flag = DlgBase<BattleMain, BattleMainBehaviour>.singleton.IsLoaded() && DlgBase<BattleMain, BattleMainBehaviour>.singleton.IsVisible();
if (flag)
{
DlgBase<BattleMain, BattleMainBehaviour>.singleton.SkillHandler.SetVisible(show);
DlgBase<BattleMain, BattleMainBehaviour>.singleton.IndicateHandler.SetVisible(show);
DlgBase<BattleMain, BattleMainBehaviour>.singleton.LeftTimeLabel.SetVisible(show);
DlgBase<BattleMain, BattleMainBehaviour>.singleton.TeamMonitor.SetVisible(false);
}
bool bSpectator = XSingleton<XScene>.singleton.bSpectator;
if (bSpectator)
{
bool flag2 = DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IsLoaded();
if (flag2)
{
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.LeftTime.SetVisible(show);
}
}
}
private void RefreshKillInfo()
{
IXUILabel ixuilabel = base.uiBehaviour.m_BlueInfo.Find("Kill").GetComponent("XUILabel") as IXUILabel;
IXUILabel ixuilabel2 = base.uiBehaviour.m_RedInfo.Find("Kill").GetComponent("XUILabel") as IXUILabel;
IXUILabel ixuilabel3 = base.uiBehaviour.m_BlueInfo.Find("Damage").GetComponent("XUILabel") as IXUILabel;
IXUILabel ixuilabel4 = base.uiBehaviour.m_RedInfo.Find("Damage").GetComponent("XUILabel") as IXUILabel;
ixuilabel.SetText(this._BattleDoc.BlueCanBattleNum.ToString());
ixuilabel2.SetText(this._BattleDoc.RedCanBattleNum.ToString());
XEntity entity = XSingleton<XEntityMgr>.singleton.GetEntity(this._BattleDoc.BluePKingRoleID);
XEntity entity2 = XSingleton<XEntityMgr>.singleton.GetEntity(this._BattleDoc.RedPKingRoleID);
bool flag = entity != null;
if (flag)
{
double attr = entity.Attributes.GetAttr(XAttributeDefine.XAttr_MaxHP_Total);
double attr2 = entity.Attributes.GetAttr(XAttributeDefine.XAttr_CurrentHP_Basic);
double num = (attr == 0.0) ? 0.0 : (attr2 / attr);
ixuilabel3.SetText(string.Format("{0:N2}%", num * 100.0));
}
else
{
ixuilabel4.SetText("0%");
}
bool flag2 = entity2 != null;
if (flag2)
{
double attr3 = entity2.Attributes.GetAttr(XAttributeDefine.XAttr_MaxHP_Total);
double attr4 = entity2.Attributes.GetAttr(XAttributeDefine.XAttr_CurrentHP_Basic);
double num2 = (attr3 == 0.0) ? 0.0 : (attr4 / attr3);
ixuilabel4.SetText(string.Format("{0:N2}%", num2 * 100.0));
}
else
{
ixuilabel4.SetText("0%");
}
}
public void RefreshBattleBaseInfo()
{
bool flag = !base.IsVisible();
if (!flag)
{
this.SetBattleList(base.uiBehaviour.m_BlueView, this._BattleDoc.BattleBaseInfoBlue, 0);
this.SetBattleList(base.uiBehaviour.m_RedView, this._BattleDoc.BattleBaseInfoRed, 1);
this.RefreshKillInfo();
}
}
private void SetBattleList(Transform view, LeagueBattleOneTeam battleTeamBaseInfo, int index)
{
bool flag = battleTeamBaseInfo == null;
if (!flag)
{
IXUILabel ixuilabel = view.Find("Title1").GetComponent("XUILabel") as IXUILabel;
ixuilabel.SetText(battleTeamBaseInfo.name);
base.uiBehaviour.m_MemberPool[index].FakeReturnAll();
for (int i = 0; i < battleTeamBaseInfo.members.Count; i++)
{
GameObject gameObject = base.uiBehaviour.m_MemberPool[index].FetchGameObject(false);
gameObject.transform.parent = base.uiBehaviour.m_MemberList[index].gameObject.transform;
IXUILabel ixuilabel2 = gameObject.transform.Find("Name").GetComponent("XUILabel") as IXUILabel;
IXUILabel ixuilabel3 = gameObject.transform.Find("Num").GetComponent("XUILabel") as IXUILabel;
Transform transform = gameObject.transform.Find("Battle");
Transform transform2 = gameObject.transform.Find("Die");
ixuilabel2.SetText(battleTeamBaseInfo.members[i].basedata.name);
ixuilabel3.SetText(battleTeamBaseInfo.members[i].index.ToString());
transform.gameObject.SetActive(battleTeamBaseInfo.members[i].state == LeagueBattleRoleState.LBRoleState_Fighting);
transform2.gameObject.SetActive(battleTeamBaseInfo.members[i].state == LeagueBattleRoleState.LBRoleState_Failed);
ixuilabel3.gameObject.SetActive(battleTeamBaseInfo.members[i].state != LeagueBattleRoleState.LBRoleState_Failed && battleTeamBaseInfo.members[i].state != LeagueBattleRoleState.LBRoleState_Fighting);
ixuilabel2.SetColor(Color.white);
bool flag2 = battleTeamBaseInfo.members[i].basedata.roleid == XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
if (flag2)
{
ixuilabel2.SetText(string.Format("[{0}]{1}[-]", XSingleton<XGlobalConfig>.singleton.GetValue("PKSelfNameColor"), battleTeamBaseInfo.members[i].basedata.name));
}
bool flag3 = battleTeamBaseInfo.members[i].state == LeagueBattleRoleState.LBRoleState_Failed;
if (flag3)
{
ixuilabel2.SetColor(Color.gray);
}
}
base.uiBehaviour.m_MemberPool[index].ActualReturnAll(false);
base.uiBehaviour.m_MemberList[index].Refresh();
}
}
public void RefreshBattleState()
{
LeagueBattleFightState battleState = this._BattleDoc.BattleState;
if (battleState != LeagueBattleFightState.LBFight_Wait)
{
if (battleState == LeagueBattleFightState.LBFight_Fight)
{
base.uiBehaviour.m_Info.SetActive(true);
base.uiBehaviour.m_LeftTimeTip.gameObject.SetActive(false);
base.uiBehaviour.m_ListView.SetActive(this._BattleDoc.IsInTeamLeague);
bool flag = this._BattleDoc.IsInTeamLeague && this._BattleDoc.IsInBattleTeamLeague && this._BattleDoc.SelfBattleState == LeagueBattleRoleState.LBRoleState_Fighting;
if (flag)
{
base.uiBehaviour.m_BlueView.gameObject.SetActive(true);
base.uiBehaviour.m_RedView.gameObject.SetActive(false);
base.uiBehaviour.m_UpBtn.gameObject.SetActive(false);
base.uiBehaviour.m_DownBtn.gameObject.SetActive(false);
}
else
{
bool isInTeamLeague = this._BattleDoc.IsInTeamLeague;
if (isInTeamLeague)
{
base.uiBehaviour.m_BlueView.gameObject.SetActive(true);
base.uiBehaviour.m_RedView.gameObject.SetActive(false);
base.uiBehaviour.m_UpBtn.gameObject.SetActive(!this._BattleDoc.IsInBattleTeamLeague);
base.uiBehaviour.m_DownBtn.gameObject.SetActive(this._BattleDoc.IsInBattleTeamLeague);
}
else
{
base.uiBehaviour.m_BlueView.gameObject.SetActive(false);
base.uiBehaviour.m_RedView.gameObject.SetActive(false);
base.uiBehaviour.m_UpBtn.gameObject.SetActive(false);
base.uiBehaviour.m_DownBtn.gameObject.SetActive(false);
}
}
}
}
else
{
base.uiBehaviour.m_Info.SetActive(false);
base.uiBehaviour.m_LeftTimeTip.gameObject.SetActive(true);
base.uiBehaviour.m_LeftTimeTip.SetText(XSingleton<XStringTable>.singleton.GetString("GUILD_ARENA_READY"));
base.uiBehaviour.m_ListView.SetActive(this._BattleDoc.IsInTeamLeague);
base.uiBehaviour.m_BlueView.gameObject.SetActive(true);
base.uiBehaviour.m_RedView.gameObject.SetActive(false);
bool flag2 = this._BattleDoc.IsInTeamLeague && this._BattleDoc.IsInBattleTeamLeague;
if (flag2)
{
base.uiBehaviour.m_UpBtn.gameObject.SetActive(false);
base.uiBehaviour.m_DownBtn.gameObject.SetActive(true);
}
else
{
bool flag3 = this._BattleDoc.IsInTeamLeague && !this._BattleDoc.IsInBattleTeamLeague;
if (flag3)
{
base.uiBehaviour.m_UpBtn.gameObject.SetActive(true);
base.uiBehaviour.m_DownBtn.gameObject.SetActive(false);
}
else
{
base.uiBehaviour.m_UpBtn.gameObject.SetActive(false);
base.uiBehaviour.m_DownBtn.gameObject.SetActive(false);
}
}
}
}
public void RefreahCountTime(uint time)
{
bool flag = DlgBase<BattleMain, BattleMainBehaviour>.singleton.IsLoaded() && DlgBase<BattleMain, BattleMainBehaviour>.singleton.IsVisible();
if (flag)
{
DlgBase<BattleMain, BattleMainBehaviour>.singleton.SetLeftTime(time, -1);
}
bool flag2 = XSingleton<XScene>.singleton.bSpectator && DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IsLoaded();
if (flag2)
{
DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.SetLeftTime(time);
}
}
public override void OnUpdate()
{
this.RefreshKillInfo();
}
public void PlaySmallReward(LeagueBattleOneResultNtf data)
{
bool flag = this.SmallRewardHandler == null;
if (flag)
{
bool flag2 = DlgBase<BattleMain, BattleMainBehaviour>.singleton.IsLoaded();
if (flag2)
{
DlgHandlerBase.EnsureCreate<LevelRewardTeamLeagueSmallHandler>(ref this.SmallRewardHandler, DlgBase<BattleMain, BattleMainBehaviour>.singleton.uiBehaviour.m_canvas, true, this);
}
bool flag3 = DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IsLoaded();
if (flag3)
{
DlgHandlerBase.EnsureCreate<LevelRewardTeamLeagueSmallHandler>(ref this.SmallRewardHandler, DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.uiBehaviour.m_canvas, true, this);
}
}
bool flag4 = this.SmallRewardHandler != null;
if (flag4)
{
this.SmallRewardHandler.SetRewardData(data);
}
}
public void PlayBigReward(LeagueBattleResultNtf data)
{
this.CloseSmallReward();
bool flag = this.BigRewardHandler == null;
if (flag)
{
bool flag2 = DlgBase<BattleMain, BattleMainBehaviour>.singleton.IsLoaded();
if (flag2)
{
DlgHandlerBase.EnsureCreate<LevelRewardTeamLeagueBigHandler>(ref this.BigRewardHandler, DlgBase<BattleMain, BattleMainBehaviour>.singleton.uiBehaviour.m_canvas, true, this);
}
bool flag3 = DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IsLoaded();
if (flag3)
{
DlgHandlerBase.EnsureCreate<LevelRewardTeamLeagueBigHandler>(ref this.BigRewardHandler, DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.uiBehaviour.m_canvas, true, this);
}
}
bool flag4 = this.BigRewardHandler != null;
if (flag4)
{
this.BigRewardHandler.SetRewardData(data);
}
}
public void CloseSmallReward()
{
bool flag = this.SmallRewardHandler != null;
if (flag)
{
this.SmallRewardHandler.CloseTween();
}
}
}
}
|