private async ETTask RunAsync(Player player, C2L_RefreshStranger message, Action <L2C_RefreshStranger> reply) { L2C_RefreshStranger response = new L2C_RefreshStranger(); try { long uid = player.uid; Tuple <List <RelationshipSimpleInfo>, long> tuple = await RelationshipDataHelper.GetStrangers(uid, message.Skip, message.Limit); List <RelationshipSimpleInfo> relationships = tuple.Item1; long totalCount = tuple.Item2; RepeatedField <RelationshipSimpleInfo> list = new RepeatedField <RelationshipSimpleInfo>(); foreach (var info in relationships) { list.Add(info); } response.TotalCount = totalCount; response.RelationshipList = list; response.Error = ErrorCode.ERR_Success; reply(response); } catch (Exception e) { ReplyError(response, e, reply); } }
private async ETTask RunAsync(Player player, C2L_GetRelationshipList message, Action <L2C_GetRelationshipList> reply) { L2C_GetRelationshipList response = new L2C_GetRelationshipList(); try { long uid = player.uid; if (uid == 0) { //未被Gate授權的帳戶 response.Error = ErrorCode.ERR_ConnectGateKeyError; } else { List <RelationshipSimpleInfo> relations = await RelationshipDataHelper.GetUserRelationshipSimpleInfoList(uid); Tuple <List <RelationshipSimpleInfo>, long> tuple = await RelationshipDataHelper.GetStrangers(uid); List <RelationshipSimpleInfo> stranger = tuple.Item1; long totalCount = tuple.Item2; RepeatedField <RelationshipSimpleInfo> list = new RepeatedField <RelationshipSimpleInfo>(); var linq = Enumerable.Union(relations, stranger); foreach (var info in linq) { list.Add(info); } response.TotalCount = totalCount; response.RelationshipList = list; } response.Error = ErrorCode.ERR_Success; reply(response); } catch (Exception e) { ReplyError(response, e, reply); } }