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
|
using System;
using System.Collections.Generic;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient
{
internal class XTeamFriendDegreeHandler : DlgHandlerBase
{
private IXUILabel m_FriendLevel;
private IXUILabel m_FriendTitle;
private IXUISprite m_BtnAdd;
private IXUISprite m_BtnBuff;
private GameObject m_InfoPanel;
private IXUISprite m_InfoClose;
private IXUISprite m_InfoMiddleFrame;
private IXUILabel m_InfoTopFrameFriendLevel;
private GameObject m_InfoTopFrameMe;
private IXUILabel m_InfoBottomFrameFriend;
private GameObject m_InfoBottomFrameMe;
private XUIPool m_AttrPool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
private XFriendsView _FriendsView;
private XFriendsDocument _FriendsDoc;
private XTeamDocument _TeamDoc;
private int m_TeamMemberIndex = 0;
private ulong m_CurrentUID = 0UL;
private struct XPercentAttr
{
public uint AttrID;
public double Scale;
public static XTeamFriendDegreeHandler.XPercentAttr CreateFromTableData(float data0, float data1)
{
XTeamFriendDegreeHandler.XPercentAttr result;
result.AttrID = (uint)data0;
result.Scale = (double)data1;
return result;
}
}
protected override void Init()
{
base.Init();
this.m_FriendLevel = (base.PanelObject.transform.Find("FriendLevel").GetComponent("XUILabel") as IXUILabel);
this.m_FriendTitle = (base.PanelObject.transform.Find("FriendTitle").GetComponent("XUILabel") as IXUILabel);
this.m_BtnAdd = (base.PanelObject.transform.Find("BtnAdd").GetComponent("XUISprite") as IXUISprite);
this.m_BtnBuff = (base.PanelObject.transform.Find("BtnBuff").GetComponent("XUISprite") as IXUISprite);
this.m_InfoPanel = base.PanelObject.transform.Find("InfoPanel").gameObject;
this.m_InfoClose = (this.m_InfoPanel.transform.Find("Close").GetComponent("XUISprite") as IXUISprite);
this.m_InfoMiddleFrame = (this.m_InfoPanel.transform.Find("MiddleFrame").GetComponent("XUISprite") as IXUISprite);
Transform transform = this.m_InfoMiddleFrame.gameObject.transform.Find("Attr");
this.m_AttrPool.SetupPool(transform.parent.gameObject, transform.gameObject, 2u, false);
transform = this.m_InfoPanel.transform.Find("TopFrame");
this.m_InfoTopFrameFriendLevel = (transform.Find("FriendLevel").GetComponent("XUILabel") as IXUILabel);
this.m_InfoTopFrameMe = transform.Find("Me").gameObject;
transform = this.m_InfoPanel.transform.Find("BottomFrame");
this.m_InfoBottomFrameMe = transform.Find("Me").gameObject;
this.m_InfoBottomFrameFriend = (transform.Find("Friend").GetComponent("XUILabel") as IXUILabel);
this._FriendsView = DlgBase<XFriendsView, XFriendsBehaviour>.singleton;
this._TeamDoc = XDocuments.GetSpecificDocument<XTeamDocument>(XTeamDocument.uuID);
this._FriendsDoc = XDocuments.GetSpecificDocument<XFriendsDocument>(XFriendsDocument.uuID);
}
public override void RegisterEvent()
{
base.RegisterEvent();
this.m_InfoClose.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnCloseClicked));
this.m_BtnBuff.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnBuffClicked));
this.m_BtnAdd.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnAddFriendClicked));
}
private void _OnCloseClicked(IXUISprite iSp)
{
this.m_InfoPanel.SetActive(false);
}
private void _OnBuffClicked(IXUISprite iSp)
{
this.m_InfoPanel.SetActive(true);
XPlayer player = XSingleton<XEntityMgr>.singleton.Player;
bool flag = player.ID == this.m_CurrentUID;
bool flag2 = flag;
if (flag2)
{
this._RefreshMyInfoPanel(this.m_CurrentUID);
}
else
{
XFriendData friendDataById = this._FriendsView.GetFriendDataById(this.m_CurrentUID);
bool flag3 = friendDataById == null;
if (flag3)
{
this.m_InfoPanel.SetActive(false);
}
else
{
FriendTable.RowData friendLevelData = this._FriendsDoc.GetFriendLevelData(friendDataById.degreeAll);
this._RefreshFriendInfoPanel(friendDataById, friendLevelData);
}
}
}
private void _OnAddFriendClicked(IXUISprite iSp)
{
DlgBase<XFriendsView, XFriendsBehaviour>.singleton.AddFriendById(this.m_CurrentUID);
}
public void Refresh(XTeamMember data, bool bActive, int teamMemberIndex)
{
bool flag = data != null && bActive;
if (flag)
{
base.SetVisible(true);
this.m_TeamMemberIndex = teamMemberIndex;
bool flag2 = this.m_CurrentUID != data.uid;
if (flag2)
{
this.m_InfoPanel.SetActive(false);
this.m_CurrentUID = data.uid;
}
XPlayer player = XSingleton<XEntityMgr>.singleton.Player;
bool flag3 = player.ID == data.uid;
bool flag4 = flag3;
if (flag4)
{
this.m_BtnAdd.SetVisible(false);
this.m_BtnBuff.SetVisible(true);
this.m_FriendLevel.SetVisible(false);
this.m_FriendTitle.SetVisible(false);
bool activeSelf = this.m_InfoPanel.activeSelf;
if (activeSelf)
{
this._RefreshMyInfoPanel(data.uid);
}
}
else
{
XFriendData friendDataById = this._FriendsView.GetFriendDataById(data.uid);
bool flag5 = friendDataById != null;
this.m_BtnAdd.SetVisible(!flag5 && !data.bIsRobot);
this.m_BtnBuff.SetVisible(flag5);
this.m_FriendLevel.SetVisible(flag5);
this.m_FriendTitle.SetVisible(flag5);
bool flag6 = !flag5;
if (flag6)
{
this.m_InfoPanel.SetActive(false);
}
else
{
this.m_FriendLevel.SetText(friendDataById.degreeAll.ToString());
FriendTable.RowData friendLevelData = this._FriendsDoc.GetFriendLevelData(friendDataById.degreeAll);
bool flag7 = friendLevelData != null;
if (flag7)
{
this.m_FriendTitle.SetText(friendLevelData.teamname);
}
else
{
this.m_FriendTitle.SetText("");
}
bool activeSelf2 = this.m_InfoPanel.activeSelf;
if (activeSelf2)
{
this._RefreshFriendInfoPanel(friendDataById, friendLevelData);
}
}
}
}
else
{
base.SetVisible(false);
}
}
private void _AppendAttr(List<XTeamFriendDegreeHandler.XPercentAttr> attrs, XTeamFriendDegreeHandler.XPercentAttr newAttr)
{
int i;
for (i = 0; i < attrs.Count; i++)
{
bool flag = attrs[i].AttrID == newAttr.AttrID;
if (flag)
{
newAttr.Scale += attrs[i].Scale;
attrs[i] = newAttr;
break;
}
}
bool flag2 = i == attrs.Count;
if (flag2)
{
attrs.Add(newAttr);
}
}
private void _SetAttr(XTeamFriendDegreeHandler.XPercentAttr attr, GameObject go)
{
IXUILabel ixuilabel = go.transform.Find("Name").GetComponent("XUILabel") as IXUILabel;
IXUILabel ixuilabel2 = go.transform.Find("Value").GetComponent("XUILabel") as IXUILabel;
bool flag = attr.AttrID == 0u;
if (flag)
{
ixuilabel.SetText(XStringDefineProxy.GetString("NONE"));
ixuilabel2.SetText("");
}
else
{
XAttributeDefine attrID = (XAttributeDefine)attr.AttrID;
ixuilabel.SetText(XStringDefineProxy.GetString(attrID.ToString()));
ixuilabel2.SetText(XAttributeCommon.GetAttrValueStr((int)attr.AttrID, (float)attr.Scale));
}
}
private void _RefreshMyInfoPanel(ulong myUID)
{
this.m_InfoBottomFrameMe.SetActive(true);
this.m_InfoBottomFrameFriend.SetVisible(false);
this.m_InfoTopFrameMe.SetActive(true);
this.m_InfoTopFrameFriendLevel.SetVisible(false);
List<XTeamFriendDegreeHandler.XPercentAttr> list = new List<XTeamFriendDegreeHandler.XPercentAttr>();
bool flag = this._TeamDoc.MyTeam != null;
if (flag)
{
List<XTeamMember> members = this._TeamDoc.MyTeam.members;
for (int i = 0; i < members.Count; i++)
{
bool flag2 = members[i].uid == myUID;
if (!flag2)
{
XFriendData friendDataById = this._FriendsView.GetFriendDataById(members[i].uid);
bool flag3 = friendDataById == null;
if (!flag3)
{
FriendTable.RowData friendLevelData = this._FriendsDoc.GetFriendLevelData(friendDataById.degreeAll);
bool flag4 = friendLevelData == null;
if (!flag4)
{
BuffTable.RowData buffData = XSingleton<XBuffTemplateManager>.singleton.GetBuffData((int)friendLevelData.buf[0], (int)friendLevelData.buf[1]);
bool flag5 = buffData == null;
if (flag5)
{
XSingleton<XDebug>.singleton.AddErrorLog("buffData == null", null, null, null, null, null);
}
else
{
for (int j = 0; j < buffData.BuffChangeAttribute.Count; j++)
{
XTeamFriendDegreeHandler.XPercentAttr newAttr = XTeamFriendDegreeHandler.XPercentAttr.CreateFromTableData(buffData.BuffChangeAttribute[j, 0], buffData.BuffChangeAttribute[j, 1]);
this._AppendAttr(list, newAttr);
}
}
}
}
}
}
}
this.m_AttrPool.FakeReturnAll();
bool flag6 = list.Count == 0;
if (flag6)
{
XTeamFriendDegreeHandler.XPercentAttr attr = default(XTeamFriendDegreeHandler.XPercentAttr);
GameObject gameObject = this.m_AttrPool.FetchGameObject(false);
gameObject.transform.localPosition = this.m_AttrPool.TplPos;
this._SetAttr(attr, gameObject);
this.m_InfoMiddleFrame.spriteHeight = this.m_AttrPool.TplHeight;
}
else
{
for (int k = 0; k < list.Count; k++)
{
XTeamFriendDegreeHandler.XPercentAttr attr2 = list[list.Count - k - 1];
GameObject gameObject2 = this.m_AttrPool.FetchGameObject(false);
gameObject2.transform.localPosition = new Vector3(this.m_AttrPool.TplPos.x, this.m_AttrPool.TplPos.y + (float)(this.m_AttrPool.TplHeight * k), this.m_AttrPool.TplPos.z);
this._SetAttr(attr2, gameObject2);
}
this.m_InfoMiddleFrame.spriteHeight = list.Count * this.m_AttrPool.TplHeight;
}
this.m_AttrPool.ActualReturnAll(false);
}
private void _RefreshFriendInfoPanel(XFriendData friendData, FriendTable.RowData rowData)
{
this.m_InfoBottomFrameMe.SetActive(false);
this.m_InfoBottomFrameFriend.SetVisible(true);
this.m_InfoTopFrameMe.SetActive(false);
this.m_InfoTopFrameFriendLevel.SetVisible(true);
bool flag = friendData == null;
if (flag)
{
XSingleton<XDebug>.singleton.AddErrorLog("friendData == null", null, null, null, null, null);
}
else
{
uint degreeAll = friendData.degreeAll;
this.m_AttrPool.FakeReturnAll();
bool flag2 = rowData == null;
if (flag2)
{
XTeamFriendDegreeHandler.XPercentAttr attr = default(XTeamFriendDegreeHandler.XPercentAttr);
GameObject gameObject = this.m_AttrPool.FetchGameObject(false);
gameObject.transform.localPosition = this.m_AttrPool.TplPos;
this._SetAttr(attr, gameObject);
this.m_InfoMiddleFrame.spriteHeight = this.m_AttrPool.TplHeight;
}
else
{
BuffTable.RowData buffData = XSingleton<XBuffTemplateManager>.singleton.GetBuffData((int)rowData.buf[0], (int)rowData.buf[1]);
bool flag3 = buffData == null;
if (flag3)
{
XSingleton<XDebug>.singleton.AddErrorLog("buffData == null", null, null, null, null, null);
return;
}
int i = 0;
int count = buffData.BuffChangeAttribute.Count;
while (i < count)
{
int index = count - i - 1;
XTeamFriendDegreeHandler.XPercentAttr attr2 = XTeamFriendDegreeHandler.XPercentAttr.CreateFromTableData(buffData.BuffChangeAttribute[index, 0], buffData.BuffChangeAttribute[index, 1]);
GameObject gameObject2 = this.m_AttrPool.FetchGameObject(false);
gameObject2.transform.localPosition = new Vector3(this.m_AttrPool.TplPos.x, this.m_AttrPool.TplPos.y + (float)(this.m_AttrPool.TplHeight * i), this.m_AttrPool.TplPos.z);
this._SetAttr(attr2, gameObject2);
i++;
}
this.m_InfoMiddleFrame.spriteHeight = buffData.BuffChangeAttribute.Count * this.m_AttrPool.TplHeight;
}
this.m_AttrPool.ActualReturnAll(false);
this.m_InfoTopFrameFriendLevel.SetText(degreeAll.ToString());
this.m_InfoBottomFrameFriend.SetText("");
foreach (FriendTable.RowData rowData2 in this._FriendsDoc.GetFriendLevelDatas())
{
bool flag4 = rowData2.level > degreeAll && rowData2.dropid > 0u;
if (flag4)
{
this.m_InfoBottomFrameFriend.SetText(XStringDefineProxy.GetString("FRIEND_DEGREE_GIFT_FORENOTICE", new object[]
{
(rowData2.level - degreeAll).ToString(),
rowData2.level.ToString()
}));
break;
}
}
}
}
}
}
|