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
|
using System;
using System.Collections.Generic;
using KKSG;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient.UI
{
internal class GVGBattleMemberBase : IGVGBattleMember
{
private Transform transform;
private IXUIWrapContent m_WrapContent;
private IXUIScrollView m_ScrollView;
private IXUILabelSymbol m_GuildName;
private XGuildArenaBattleDocument _Doc;
private XGuildDocument _GuildDoc;
private List<GmfRole> mRoles;
private int mIndex = 1;
private bool isSelfGuild = false;
private ulong needRemoveID;
public void Setup(GameObject sv, int index)
{
this.mIndex = index;
this._Doc = XDocuments.GetSpecificDocument<XGuildArenaBattleDocument>(XGuildArenaBattleDocument.uuID);
this._GuildDoc = XDocuments.GetSpecificDocument<XGuildDocument>(XGuildDocument.uuID);
this.transform = sv.transform;
this.m_GuildName = (this.transform.Find("Title/Title1").GetComponent("XUILabelSymbol") as IXUILabelSymbol);
this.m_ScrollView = (this.transform.Find("MemberScrollView").GetComponent("XUIScrollView") as IXUIScrollView);
this.m_WrapContent = (this.transform.Find("MemberScrollView/MemberList").GetComponent("XUIWrapContent") as IXUIWrapContent);
this.m_WrapContent.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.WrapItemUpdateEventHandler));
}
private void FormatRole(ref List<GmfRole> roles)
{
bool flag = roles == null;
if (flag)
{
roles = new List<GmfRole>();
}
int battleSignNumber = this._Doc.GetBattleSignNumber();
bool flag2 = roles.Count < battleSignNumber;
if (flag2)
{
int count = roles.Count;
for (int i = count; i < battleSignNumber; i++)
{
GmfRole gmfRole = new GmfRole();
gmfRole.rolename = XSingleton<XStringTable>.singleton.GetString("GUILD_ARENA_TAB_PERSON");
gmfRole.index = i;
gmfRole.roleID = 0UL;
gmfRole.profession = 0;
roles.Add(gmfRole);
}
}
}
public void ReFreshData(GVGBattleInfo battleInfo)
{
bool flag = battleInfo.Base == null || battleInfo.Group == null;
if (!flag)
{
bool flag2 = this.mRoles == null;
if (flag2)
{
this.mRoles = new List<GmfRole>();
}
this.mRoles.Clear();
this.mRoles.AddRange(battleInfo.Group);
this.FormatRole(ref this.mRoles);
this.isSelfGuild = (this._GuildDoc.bInGuild && this._GuildDoc.BasicData.uid == battleInfo.Base.guildid);
this.m_WrapContent.SetContentCount(this.mRoles.Count, false);
this.m_ScrollView.ResetPosition();
bool flag3 = this._Doc.IsGCF();
if (flag3)
{
this.m_GuildName.InputText = XStringDefineProxy.GetString("CROSS_GVG_GUILDNAME", new object[]
{
battleInfo.Base.serverid,
battleInfo.Base.guildname
});
}
else
{
this.m_GuildName.InputText = battleInfo.Base.guildname;
}
}
}
private void WrapItemUpdateEventHandler(Transform t, int index)
{
bool flag = index < 0 || index >= this.mRoles.Count;
if (!flag)
{
GmfRole gmfRole = this.mRoles[index];
bool flag2 = gmfRole == null;
if (flag2)
{
XSingleton<XDebug>.singleton.AddErrorLog("XMainClient.UI.GuildArenaBattleMemberPanel.WrapItemUpdateEventHandler is null ", null, null, null, null, null);
}
else
{
IXUILabel ixuilabel = t.Find("Status/Num").GetComponent("XUILabel") as IXUILabel;
IXUISprite ixuisprite = t.Find("Status/Battle").GetComponent("XUISprite") as IXUISprite;
IXUILabel ixuilabel2 = t.Find("Fight").GetComponent("XUILabel") as IXUILabel;
IXUILabel ixuilabel3 = t.Find("Name").GetComponent("XUILabel") as IXUILabel;
IXUISprite ixuisprite2 = t.Find("kick").GetComponent("XUISprite") as IXUISprite;
IXUISprite ixuisprite3 = t.Find("job").GetComponent("XUISprite") as IXUISprite;
GameObject gameObject = t.Find("icon").gameObject;
ixuilabel.SetText((index + 1).ToString());
ixuilabel3.SetText(gmfRole.rolename);
ixuisprite3.SetAlpha(1f);
ixuisprite3.SetSprite(XSingleton<XProfessionSkillMgr>.singleton.GetProfIcon(gmfRole.profession));
ixuisprite2.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnRemove));
ixuisprite2.ID = gmfRole.roleID;
bool flag3 = gmfRole.roleID == 0UL;
if (flag3)
{
ixuisprite.gameObject.SetActive(false);
ixuilabel2.gameObject.SetActive(false);
ixuisprite2.gameObject.SetActive(false);
gameObject.SetActive(false);
ixuilabel.SetVisible(true);
ixuilabel.SetColor(Color.white);
ixuilabel3.SetColor(Color.white);
ixuilabel2.SetColor(Color.white);
bool flag4 = ixuisprite3 != null;
if (flag4)
{
ixuisprite3.SetAlpha(0f);
}
}
else
{
ixuisprite.gameObject.SetActive(true);
ixuilabel2.gameObject.SetActive(true);
ixuisprite2.gameObject.SetActive(true);
gameObject.SetActive(true);
this.SetupOtherMemberInfo(t, gmfRole);
bool flag5 = this.isSelfGuild;
XGuildArenaBattleDocument.GuildArenaSection mArenaSection = this._Doc.mArenaSection;
if (mArenaSection != XGuildArenaBattleDocument.GuildArenaSection.Prepare)
{
if (mArenaSection == XGuildArenaBattleDocument.GuildArenaSection.Battle)
{
flag5 &= this.SetMatchFightState(gmfRole, ixuisprite, ixuilabel, ixuilabel3, ixuilabel2);
}
}
else
{
flag5 &= this.SetPrepareFightState(gmfRole, ixuisprite, ixuilabel, ixuilabel3);
}
bool flag6 = this._GuildDoc.Position != GuildPosition.GPOS_LEADER && this._GuildDoc.Position != GuildPosition.GPOS_VICELEADER;
if (flag6)
{
flag5 = false;
}
else
{
bool flag7 = this._GuildDoc.Position == GuildPosition.GPOS_VICELEADER;
if (flag7)
{
bool flag8 = gmfRole.guildpos == 0 || gmfRole.guildpos == 1;
if (flag8)
{
flag5 = false;
}
}
}
bool flag9 = gmfRole.roleID == XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
if (flag9)
{
flag5 = false;
}
bool flag10 = this._Doc.MyReadyType == XGuildArenaBattleDocument.ReadyType.Observer;
if (flag10)
{
flag5 = false;
}
ixuisprite2.gameObject.SetActive(flag5);
}
}
}
}
protected virtual void SetupOtherMemberInfo(Transform t, GmfRole role)
{
}
private void OnRemove(IXUISprite button)
{
this.needRemoveID = button.ID;
XSingleton<UiUtility>.singleton.ShowModalDialog(XStringDefineProxy.GetString("GUILD_ARENA_KICK"), XStringDefineProxy.GetString(XStringDefine.COMMON_OK), XStringDefineProxy.GetString("COMMON_CANCEL"), new ButtonClickEventHandler(this.OnRemoveQuery));
}
private bool OnRemoveQuery(IXUIButton btn)
{
DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(false, true);
bool flag = this.needRemoveID > 0UL;
if (flag)
{
this._Doc.ReadyReq(this.needRemoveID, GMFReadyType.GMF_READY_KICK);
}
this.needRemoveID = 0UL;
return true;
}
private bool SetPrepareFightState(GmfRole roleInfo, IXUISprite sprite, IXUILabel rank, IXUILabel name)
{
rank.gameObject.SetActive(true);
sprite.gameObject.SetActive(false);
Color color = Color.white;
bool flag = roleInfo.roleID == XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
if (flag)
{
color = Color.green;
}
name.SetColor(color);
return true;
}
private bool SetMatchFightState(GmfRole roleInfo, IXUISprite sprite, IXUILabel rank, IXUILabel name, IXUILabel fight)
{
bool result = true;
Color color = Color.white;
bool flag = roleInfo.roleID == XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
if (flag)
{
color = Color.green;
}
switch (roleInfo.state)
{
case GuildMatchFightState.GUILD_MF_WAITING:
{
sprite.gameObject.SetActive(false);
rank.gameObject.SetActive(true);
bool flag2 = this._GuildDoc.Position != GuildPosition.GPOS_LEADER && this._GuildDoc.Position != GuildPosition.GPOS_VICELEADER;
result = !flag2;
break;
}
case GuildMatchFightState.GUILD_MF_FIGHTING:
{
sprite.gameObject.SetActive(true);
rank.gameObject.SetActive(false);
bool flag3 = this.mIndex == 2;
string sprite2;
if (flag3)
{
sprite2 = "guildpvp_icon_4";
color = new Color(0.92f, 0.23f, 0.23f);
}
else
{
sprite2 = "guildpvp_icon_3";
color= new Color(0f, 0.658f, 1f);
}
sprite.SetSprite(sprite2);
result = false;
break;
}
case GuildMatchFightState.GUILD_MF_FAILED:
{
sprite.gameObject.SetActive(true);
rank.gameObject.SetActive(false);
string sprite2 = "guildpvp_icon_0";
sprite.SetSprite(sprite2);
color = Color.white;
result = false;
break;
}
}
rank.SetColor(color);
name.SetColor(color);
fight.SetColor(color);
return result;
}
public void OnUpdate()
{
}
public void SetActive(bool active)
{
bool flag = this.transform != null;
if (flag)
{
this.transform.gameObject.SetActive(active);
}
}
public bool IsActive()
{
return this.transform != null && this.transform.gameObject.activeSelf;
}
public void Recycle()
{
bool flag = this.mRoles != null;
if (flag)
{
this.mRoles.Clear();
this.mRoles = null;
}
}
}
}
|