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
|
using System;
using System.Collections.Generic;
using KKSG;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XMainClient.Utility;
using XUtliPoolLib;
namespace XMainClient.UI
{
internal class GuildArenaCombatHandle : DlgHandlerBase
{
protected override string FileName
{
get
{
return "Guild/GuildArena/CombatFrame";
}
}
private Transform m_CombatPanel;
private Transform m_NaPanel;
private XUITabControl m_tabControl = new XUITabControl();
private List<GuildArenaCombatInfo> m_GuildCombat = new List<GuildArenaCombatInfo>();
private GuildArenaGuildInfo m_GuildCup;
private IXUILabel m_combatTips;
private XGuildArenaDocument _Doc = null;
private IXUISprite m_honorSprite;
private IXUILabel m_naLabel;
private IXUIButton m_enterBattle;
private IXUIButton m_showRank;
private IXUILabel m_RegistrationCount;
public override void RefreshData()
{
base.RefreshData();
bool bInArenaTime = this._Doc.bInArenaTime;
if (bInArenaTime)
{
this.m_RegistrationCount.SetVisible(true);
this.m_CombatPanel.gameObject.SetActive(true);
this.m_NaPanel.gameObject.SetActive(false);
this.RefreshMessage();
this.RefreshCombatHandle();
}
else
{
this.m_RegistrationCount.SetVisible(false);
this.m_CombatPanel.gameObject.SetActive(false);
this.m_NaPanel.gameObject.SetActive(true);
}
bool flag = this._Doc.bHasAvailableJion && this._Doc.VisibleEnterBattle;
if (flag)
{
this.m_enterBattle.SetVisible(true);
uint canEnterBattle = this._Doc.CanEnterBattle;
if (canEnterBattle - 1u > 1u)
{
if (canEnterBattle != 3u)
{
this.m_enterBattle.SetGrey(false);
}
else
{
this.m_enterBattle.SetGrey(false);
}
}
else
{
this.m_enterBattle.SetGrey(true);
}
}
else
{
this.m_enterBattle.SetVisible(false);
}
}
protected override void Init()
{
base.Init();
this._Doc = XDocuments.GetSpecificDocument<XGuildArenaDocument>(XGuildArenaDocument.uuID);
this.m_CombatPanel = base.PanelObject.transform.Find("Combat");
this.m_NaPanel = base.PanelObject.transform.Find("NA");
this.m_naLabel = (base.PanelObject.transform.Find("NA/tip").GetComponent("XUILabel") as IXUILabel);
this.m_naLabel.SetText(XStringDefineProxy.GetString("GUILD_ARENA_COMBAT_NA"));
Transform tabTpl = base.PanelObject.transform.Find("Combat/Tabs/TabTpl");
this.m_tabControl.SetTabTpl(tabTpl);
this.m_GuildCup = DlgHandlerBase.EnsureCreate<GuildArenaGuildInfo>(ref this.m_GuildCup, base.PanelObject.transform.Find("Combat/Cup").gameObject, null, true);
this.m_combatTips = (base.PanelObject.transform.Find("Combat/txt_TimeLabel").GetComponent("XUILabel") as IXUILabel);
this.m_honorSprite = (base.PanelObject.transform.Find("Combat/honor").GetComponent("XUISprite") as IXUISprite);
this.m_enterBattle = (base.PanelObject.transform.Find("Combat/LetMeDie").GetComponent("XUIButton") as IXUIButton);
this.m_enterBattle.SetVisible(false);
this.m_showRank = (base.PanelObject.transform.Find("TopRankBtn").GetComponent("XUIButton") as IXUIButton);
this.m_RegistrationCount = (base.PanelObject.transform.Find("Title/Period").GetComponent("XUILabel") as IXUILabel);
this.m_RegistrationCount.SetVisible(false);
this.InitCombatHandle();
}
public override void RegisterEvent()
{
base.RegisterEvent();
this.m_enterBattle.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnEnterBattleClick));
this.m_showRank.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnShowRankClick));
}
private bool OnShowRankClick(IXUIButton btn)
{
DlgBase<GuildArenaRankDlg, GuildArenaRankBehaviour>.singleton.SetVisibleWithAnimation(true, null);
return true;
}
private bool OnEnterBattleClick(IXUIButton btn)
{
bool flag = this._Doc.CanEnterBattle != 1u && this._Doc.CanEnterBattle != 2u;
bool result;
if (flag)
{
XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("GUILD_ARENA_OUTTIME"), "fece00");
result = false;
}
else
{
this._Doc.SendGuildArenaJoinBattle();
result = false;
}
return result;
}
protected override void OnShow()
{
base.OnShow();
this.RefreshData();
this.m_RegistrationCount.SetText(XStringDefineProxy.GetString("CROSS_GVG_Registration", new object[]
{
this._Doc.RegistrationCount
}));
this._Doc.SendGuildArenaInfo();
}
public override void OnUnload()
{
this.UnLoadCombatHandle(ref this.m_GuildCombat);
DlgHandlerBase.EnsureUnload<GuildArenaGuildInfo>(ref this.m_GuildCup);
bool flag = this.m_tabControl != null;
if (flag)
{
this.m_tabControl = null;
}
base.OnUnload();
}
private void InitCombatHandle()
{
this.CreateCombatHandle(0, 4);
this.CreateCombatHandle(1, 2);
this.CreateCombatHandle(2, 1);
}
private void UnLoadCombatHandle(ref List<GuildArenaCombatInfo> guildCombats)
{
bool flag = guildCombats == null;
if (!flag)
{
int i = 0;
int count = guildCombats.Count;
while (i < count)
{
bool flag2 = guildCombats[i] != null;
if (flag2)
{
guildCombats[i].OnUnload();
guildCombats[i] = null;
}
i++;
}
guildCombats.Clear();
guildCombats = null;
}
}
private void CreateCombatHandle(int combat, int size)
{
for (int i = 0; i < size; i++)
{
string text = string.Format("Combat/Battle/Battle_{0}_{1}", combat, i);
GuildArenaCombatInfo guildArenaCombatInfo = null;
guildArenaCombatInfo = DlgHandlerBase.EnsureCreate<GuildArenaCombatInfo>(ref guildArenaCombatInfo, base.PanelObject.transform.Find(text).gameObject, null, true);
guildArenaCombatInfo.Set(combat, i);
this.m_GuildCombat.Add(guildArenaCombatInfo);
}
}
private void RefreshCombatHandle()
{
this.RefreshTitleHandle();
int i = 0;
int count = this.m_GuildCombat.Count;
while (i < count)
{
this.m_GuildCombat[i].SetCombatGroup((uint)this._Doc.SelectWarIndex);
i++;
}
uint battleID = 7u;
ulong arenaWinnerGuildID = this._Doc.GetArenaWinnerGuildID((uint)this._Doc.SelectWarIndex, battleID);
this.m_GuildCup.SetGuildMember(arenaWinnerGuildID, arenaWinnerGuildID, true);
}
private void RefreshTitleHandle()
{
string sprite = string.Empty;
switch (this._Doc.SelectWarIndex)
{
case 1:
sprite = "guildpvp_honor_0";
break;
case 2:
sprite = "guildpvp_honor_1";
break;
case 3:
sprite = "guildpvp_honor_2";
break;
}
this.m_honorSprite.SetSprite(sprite);
this.m_honorSprite.MakePixelPerfect();
}
private void RefreshMessage()
{
GuildArenaState timeState = this._Doc.TimeState;
string text = string.Empty;
switch (timeState)
{
case GuildArenaState.GUILD_ARENA_NOT_BEGIN:
case GuildArenaState.GUILD_ARENA_BEGIN:
case GuildArenaState.GUILD_ARENA_BATTLE_ONE:
text = XStringDefineProxy.GetString("GUILD_ARENA_MESSAGE1");
break;
case GuildArenaState.GUILD_ARENA_BATTLE_TWO:
text = XStringDefineProxy.GetString("GUILD_ARENA_MESSAGE2");
break;
case GuildArenaState.GUILD_ARENA_BATTLE_FINAL:
text = XStringDefineProxy.GetString("GUILD_ARENA_MESSAGE3");
break;
default:
text = string.Empty;
break;
}
this.m_combatTips.SetText(text);
}
}
}
|