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
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
|
using System;
using System.Collections.Generic;
using KKSG;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUpdater;
using XUtliPoolLib;
namespace XMainClient
{
internal class XFriendsDocument : XDocComponent
{
public override uint ID
{
get
{
return XFriendsDocument.uuID;
}
}
public static XFriendsDocument Doc
{
get
{
return XDocuments.GetSpecificDocument<XFriendsDocument>(XFriendsDocument.uuID);
}
}
public List<PlatFriendRankInfo2Client> PlatFriendsRankList
{
get
{
return this.m_listPlatFriendsRank;
}
}
public PlatFriendRankInfo2Client SelfPlatRankInfo
{
get
{
return this.m_selfPlatRank;
}
}
public Dictionary<string, QQVipType> FriendsVipInfo
{
get
{
return this._FriendsVipInfo;
}
}
public static int FriendsTabCount
{
get
{
return XFriendsDocument._FriendSysTable.Table.Length;
}
}
public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("XFriendsDocument");
public static XTableAsyncLoader AsyncLoader = new XTableAsyncLoader();
private static FriendTable _FriendTable = new FriendTable();
private static FriendSysConfigTable _FriendSysTable = new FriendSysConfigTable();
private List<PlatFriendRankInfo2Client> m_listPlatFriendsRank = null;
private PlatFriendRankInfo2Client m_selfPlatRank = null;
private Dictionary<string, QQVipType> _FriendsVipInfo = new Dictionary<string, QQVipType>();
private bool syncFriendsData = false;
private int entertimer = 0;
public static FriendSysConfigTable.RowData GetFriendsTabItemByID(int id)
{
return XFriendsDocument._FriendSysTable.GetByTabID(id);
}
public static FriendSysConfigTable.RowData GetFriendsTabItemByIndex(int index)
{
return XFriendsDocument._FriendSysTable.Table[index];
}
public override void OnAttachToHost(XObject host)
{
base.OnAttachToHost(host);
this.syncFriendsData = false;
XSingleton<XFriendsStaticData>.singleton.Init();
}
public static void Execute(OnLoadedCallback callback = null)
{
XFriendsDocument.AsyncLoader.AddTask("Table/Friend", XFriendsDocument._FriendTable, false);
XFriendsDocument.AsyncLoader.AddTask("Table/FriendSystemConfig", XFriendsDocument._FriendSysTable, false);
XFriendsDocument.AsyncLoader.Execute(callback);
}
public FriendTable.RowData[] GetFriendLevelDatas()
{
return XFriendsDocument._FriendTable.Table;
}
public FriendTable.RowData GetFriendLevelData(uint level)
{
for (int i = 0; i < XFriendsDocument._FriendTable.Table.Length; i++)
{
bool flag = XFriendsDocument._FriendTable.Table[i].level == level;
if (flag)
{
return XFriendsDocument._FriendTable.Table[i];
}
}
return null;
}
protected override void OnReconnected(XReconnectedEventArgs arg)
{
this.ReqFriendsInfo();
}
public override void OnDetachFromHost()
{
base.OnDetachFromHost();
this.entertimer = 0;
this._FriendsVipInfo.Clear();
}
public override void OnEnterSceneFinally()
{
base.OnEnterSceneFinally();
XSingleton<XFriendsStaticData>.singleton.Init();
this.ReqFriendsInfo();
this.entertimer++;
XChatDocument specificDocument = XDocuments.GetSpecificDocument<XChatDocument>(XChatDocument.uuID);
bool flag = specificDocument != null && XSingleton<XGame>.singleton.CurrentStage.Stage == EXStage.Hall;
if (flag)
{
specificDocument.SendOfflineMsg();
}
}
public void SDKQueryFriends()
{
XSingleton<XDebug>.singleton.AddLog("XFriendsDocument SDKQueryFriends", null, null, null, null, null, XDebugColor.XDebug_None);
XSingleton<XUpdater.XUpdater>.singleton.XPlatform.SendGameExData("QueryFriends", "");
}
public void ReqFriendsInfo()
{
PtcC2M_FriendQueryReportNew ptcC2M_FriendQueryReportNew = new PtcC2M_FriendQueryReportNew();
ptcC2M_FriendQueryReportNew.Data.op = FriendOpType.Friend_ApplyAll;
XSingleton<XClientNetwork>.singleton.Send(ptcC2M_FriendQueryReportNew);
PtcC2M_FriendQueryReportNew ptcC2M_FriendQueryReportNew2 = new PtcC2M_FriendQueryReportNew();
ptcC2M_FriendQueryReportNew2.Data.op = FriendOpType.Friend_FriendAll;
XSingleton<XClientNetwork>.singleton.Send(ptcC2M_FriendQueryReportNew2);
PtcC2M_BlackListReportNew proto = new PtcC2M_BlackListReportNew();
XSingleton<XClientNetwork>.singleton.Send(proto);
}
public void SyncPlatFriendsInfo()
{
bool flag = XSingleton<XGame>.singleton.CurrentStage.Stage != EXStage.Hall;
if (!flag)
{
bool flag2 = this.syncFriendsData;
if (!flag2)
{
XSingleton<XDebug>.singleton.AddLog("FriendsRank SyncPlatFriendsInfo", null, null, null, null, null, XDebugColor.XDebug_None);
PtcC2M_SyncPlatFriend2MS ptcC2M_SyncPlatFriend2MS = new PtcC2M_SyncPlatFriend2MS();
bool flag3 = XSingleton<PDatabase>.singleton.friendsInfo != null;
if (flag3)
{
XSingleton<XDebug>.singleton.AddLog("FriendsRank friendsCount = " + XSingleton<PDatabase>.singleton.friendsInfo.data.Length, null, null, null, null, null, XDebugColor.XDebug_None);
int @int = XSingleton<XGlobalConfig>.singleton.GetInt("SyncPlatFriendsCount");
XSingleton<XDebug>.singleton.AddLog("FriendsRank SyncPlatFriendsCount = " + @int, null, null, null, null, null, XDebugColor.XDebug_None);
for (int i = 0; i < XSingleton<PDatabase>.singleton.friendsInfo.data.Length; i++)
{
bool flag4 = i < @int;
if (!flag4)
{
break;
}
FriendInfo.Data data = XSingleton<PDatabase>.singleton.friendsInfo.data[i];
PlatFriend platFriend = new PlatFriend();
platFriend.openid = data.openId;
platFriend.nickname = data.nickName;
platFriend.bigpic = data.pictureLarge;
platFriend.midpic = "";
platFriend.smallpic = "";
ptcC2M_SyncPlatFriend2MS.Data.friendInfo.Add(platFriend);
}
XSingleton<XDebug>.singleton.AddLog("FriendsRank SendCount = " + ptcC2M_SyncPlatFriend2MS.Data.friendInfo.Count, null, null, null, null, null, XDebugColor.XDebug_None);
}
bool flag5 = XSingleton<PDatabase>.singleton.playerInfo != null;
if (flag5)
{
PlatFriend platFriend2 = new PlatFriend();
platFriend2.openid = XSingleton<XLoginDocument>.singleton.OpenID;
platFriend2.nickname = XSingleton<PDatabase>.singleton.playerInfo.data.nickName;
platFriend2.bigpic = XSingleton<PDatabase>.singleton.playerInfo.data.pictureLarge;
platFriend2.midpic = XSingleton<PDatabase>.singleton.playerInfo.data.pictureMiddle;
platFriend2.smallpic = XSingleton<PDatabase>.singleton.playerInfo.data.pictureSmall;
ptcC2M_SyncPlatFriend2MS.Data.selfInfo = platFriend2;
XSingleton<XDebug>.singleton.AddLog("FriendsRank SyncPlatFriendsInfo self openid = " + platFriend2.openid, null, null, null, null, null, XDebugColor.XDebug_None);
}
this.syncFriendsData = true;
XSingleton<XClientNetwork>.singleton.Send(ptcC2M_SyncPlatFriend2MS);
}
}
}
public bool IsQQFriend(string openID)
{
bool flag = XSingleton<PDatabase>.singleton.friendsInfo != null;
if (flag)
{
for (int i = 0; i < XSingleton<PDatabase>.singleton.friendsInfo.data.Length; i++)
{
bool flag2 = XSingleton<PDatabase>.singleton.friendsInfo.data[i].openId == openID;
if (flag2)
{
return true;
}
}
}
return false;
}
public void ReqPlatFriendsRank()
{
XSingleton<XDebug>.singleton.AddLog("FriendsRank ReqPlatFriendsRank", null, null, null, null, null, XDebugColor.XDebug_None);
RpcC2M_ReqPlatFriendRankList rpc = new RpcC2M_ReqPlatFriendRankList();
XSingleton<XClientNetwork>.singleton.Send(rpc);
}
public void SendGift2PlatFriend(string openID)
{
XSingleton<XDebug>.singleton.AddLog("FriendsRank SendGift2PlatFriend openid = " + openID, null, null, null, null, null, XDebugColor.XDebug_None);
RpcC2M_SendGift2PlatFriend rpcC2M_SendGift2PlatFriend = new RpcC2M_SendGift2PlatFriend();
rpcC2M_SendGift2PlatFriend.oArg.openid = openID;
XSingleton<XClientNetwork>.singleton.Send(rpcC2M_SendGift2PlatFriend);
}
public void SendPk2PlatFriend(string openID)
{
XSingleton<XDebug>.singleton.AddLog("FriendsRank SendPk2PlatFriend openid = " + openID, null, null, null, null, null, XDebugColor.XDebug_None);
RpcC2M_InvFightReqAll rpcC2M_InvFightReqAll = new RpcC2M_InvFightReqAll();
rpcC2M_InvFightReqAll.oArg.reqtype = InvFightReqType.IFRT_INV_ONE;
rpcC2M_InvFightReqAll.oArg.iscross = true;
rpcC2M_InvFightReqAll.oArg.account = openID;
XSingleton<XClientNetwork>.singleton.Send(rpcC2M_InvFightReqAll);
}
public void OnSendGift2PlatFriend(SendGift2PlatFriendArg oArg, SendGift2PlatFriendRes oRes)
{
XSingleton<XDebug>.singleton.AddLog("FriendsRank OnSendGift2PlatFriend", null, null, null, null, null, XDebugColor.XDebug_None);
bool flag = oRes.error > ErrorCode.ERR_SUCCESS;
if (flag)
{
XSingleton<UiUtility>.singleton.ShowErrorCode(oRes.error);
}
else
{
string[] andSeparateValue = XSingleton<XGlobalConfig>.singleton.GetAndSeparateValue("SendPlatFriendGift", XGlobalConfig.SequenceSeparator);
bool flag2 = andSeparateValue.Length == 2;
if (flag2)
{
string text = XSingleton<UiUtility>.singleton.ChooseProfString(XBagDocument.GetItemConf(int.Parse(andSeparateValue[0])).ItemName, 0u);
XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("FRIEND_SEND_PLAT_FRIEND", new object[]
{
andSeparateValue[1],
text
}), "fece00");
}
for (int i = 0; i < this.m_listPlatFriendsRank.Count; i++)
{
bool flag3 = this.m_listPlatFriendsRank[i].platfriendBaseInfo.openid == oArg.openid;
if (flag3)
{
this.m_listPlatFriendsRank[i].hasGiveGift = true;
DlgBase<XFriendsView, XFriendsBehaviour>.singleton.OnRefreshSendGiftState(this.m_listPlatFriendsRank[i]);
break;
}
}
bool flag4 = XSingleton<XLoginDocument>.singleton.Channel != XAuthorizationChannel.XAuthorization_Guest && XSingleton<XGameSysMgr>.singleton.IsSystemOpened(XSysDefine.XSys_Friends_Gift_Share);
if (flag4)
{
DlgBase<XFriendsView, XFriendsBehaviour>.singleton.NoticeFriend(oArg.openid);
}
}
}
public void OnReqPlatFriendsRank(ReqPlatFriendRankListArg oArg, ReqPlatFriendRankListRes oRes)
{
XSingleton<XDebug>.singleton.AddLog("FriendsRank OnReqPlatFriendsRank", null, null, null, null, null, XDebugColor.XDebug_None);
bool flag = oRes.error > ErrorCode.ERR_SUCCESS;
if (flag)
{
XSingleton<UiUtility>.singleton.ShowErrorCode(oRes.error);
}
else
{
XTeamInviteDocument specificDocument = XDocuments.GetSpecificDocument<XTeamInviteDocument>(XTeamInviteDocument.uuID);
bool flag2 = specificDocument.OnGetInvitePlatList(oRes);
if (!flag2)
{
this.m_listPlatFriendsRank = oRes.platFriends;
this.m_selfPlatRank = oRes.selfInfo;
XSingleton<XDebug>.singleton.AddLog("OnReqPlatFriendsRank count= " + oRes.platFriends.Count, null, null, null, null, null, XDebugColor.XDebug_None);
bool flag3 = XSingleton<XLoginDocument>.singleton.Channel == XAuthorizationChannel.XAuthorization_QQ && XSingleton<XGameSysMgr>.singleton.IsSystemOpened(XSysDefine.XSys_QQVIP);
if (flag3)
{
this.ReqQQFriendsVipInfo(oRes.platFriends);
}
else
{
DlgBase<XFriendsView, XFriendsBehaviour>.singleton.OnRefreshPlatFriendsRank();
}
}
}
}
public void ReqQQFriendsVipInfo(List<PlatFriendRankInfo2Client> platFriendList)
{
RpcC2G_QueryQQFriendsVipInfo rpcC2G_QueryQQFriendsVipInfo = new RpcC2G_QueryQQFriendsVipInfo();
rpcC2G_QueryQQFriendsVipInfo.oArg.token = XSingleton<XLoginDocument>.singleton.TokenCache;
rpcC2G_QueryQQFriendsVipInfo.oArg.friendopenids.Clear();
List<string> list = new List<string>();
for (int i = 0; i < platFriendList.Count; i++)
{
rpcC2G_QueryQQFriendsVipInfo.oArg.friendopenids.Add(platFriendList[i].platfriendBaseInfo.openid);
}
XSingleton<XClientNetwork>.singleton.Send(rpcC2G_QueryQQFriendsVipInfo);
}
public void OnGetQQFriendsVipInfo(QueryQQFriendsVipInfoArg oArg, QueryQQFriendsVipInfoRes oRes)
{
bool flag = oRes.result > ErrorCode.ERR_SUCCESS;
if (flag)
{
XSingleton<UiUtility>.singleton.ShowSystemTip(oRes.result, "fece00");
}
else
{
this._FriendsVipInfo.Clear();
for (int i = 0; i < oRes.info.Count; i++)
{
QQVipType value = QQVipType.None;
string openid = oRes.info[i].openid;
bool is_svip = oRes.info[i].is_svip;
if (is_svip)
{
value = QQVipType.SVip;
}
else
{
bool is_vip = oRes.info[i].is_vip;
if (is_vip)
{
value = QQVipType.Vip;
}
}
this._FriendsVipInfo[openid] = value;
}
DlgBase<XFriendsView, XFriendsBehaviour>.singleton.OnRefreshPlatFriendsRank();
}
}
public void OnFriendGiftOp(FriendGiftOpArg oArg, FriendGiftOpRes oRes)
{
DlgBase<XFriendsView, XFriendsBehaviour>.singleton.OnFriendGiftOp(oArg, oRes);
}
public void OnApply(DoAddFriendArg oArg, DoAddFriendRes oRes)
{
DlgBase<XFriendsView, XFriendsBehaviour>.singleton.OnApply(oArg, oRes);
}
public void AddFriendRes(ErrorCode code, ulong uid)
{
DlgBase<XFriendsView, XFriendsBehaviour>.singleton.AddFriendRes(code, uid);
}
public void OnFriendOpNotify(PtcM2C_FriendOpNtfNew roPtc)
{
DlgBase<XFriendsView, XFriendsBehaviour>.singleton.OnFriendOpNotify(roPtc);
XFriendInfoChange @event = XEventPool<XFriendInfoChange>.GetEvent();
@event.opType = roPtc.Data.op;
@event.Firer = XSingleton<XGame>.singleton.Doc;
XSingleton<XEventMgr>.singleton.FireEvent(@event);
}
public void RemoveFriendRes(ErrorCode code, ulong roleid)
{
DlgBase<XFriendsView, XFriendsBehaviour>.singleton.RemoveFriendRes(code, roleid);
}
public void UpdateFriendInfo(ulong uid, uint daydegree, uint alldegree)
{
DlgBase<XFriendsView, XFriendsBehaviour>.singleton.UpdateFriendInfo(uid, daydegree, alldegree);
}
public void QueryRoleStateRes(RoleStateNtf rolestate)
{
DlgBase<XFriendsView, XFriendsBehaviour>.singleton.QueryRoleStateRes(rolestate);
}
public void RandomFriendRes(RandomFriendWaitListRes waitList)
{
DlgBase<XFriendsView, XFriendsBehaviour>.singleton.RandomFriendRes(waitList);
}
public void AddBlockFriendRes(Friend2Client black)
{
DlgBase<XFriendsView, XFriendsBehaviour>.singleton.AddBlockFriendRes(black);
}
public void RefreshBlockFriendData(BlackListNtf blacklist)
{
DlgBase<XFriendsView, XFriendsBehaviour>.singleton.RefreshBlockFriendData(blacklist);
}
public void RemoveBlockFriendRes(ErrorCode code, ulong roleid)
{
DlgBase<XFriendsView, XFriendsBehaviour>.singleton.RemoveBlockFriendRes(code, roleid);
}
}
}
|