示例#1
0
        public async static Task AddFriend(LobbyServerConnection connection, FriendUpdateRequest request)
        {
            LobbyServerConnection friend = LobbyServer.GetPlayerByHandle(request.FriendHandle);
            var friendRequest            = new FriendUpdateRequest()
            {
                //FriendHandle = connection.PlayerInfo.GetHandle(),
                //FriendAccountId = connection.PlayerInfo.GetAccountId(),
                FriendOperation = FriendOperation.Add,
                RequestId       = 0,
                ResponseId      = 0
            };
            await friend.SendMessage(friendRequest);

            // Send a "RequestSent" status to the person that wants to add a new friend
            await connection.SendMessage(new FriendStatusNotification()
            {
                FriendList = new Framework.Network.Static.FriendList()
                {
                    Friends = new Dictionary <long, Framework.Network.Static.FriendInfo>()
                    {
                        {
                            0,
                            new Framework.Network.Static.FriendInfo()
                            {
                                FriendHandle    = request.FriendHandle,
                                FriendAccountId = request.FriendAccountId,
                                FriendStatus    = Framework.Constants.Enums.FriendStatus.RequestSent,
                            }
                        }
                    },
                    IsDelta = true// set this to true to the request to tell the client to not overwrite current friend list
                }
            });

            // Send a "RequestReceived" status to the person
            await connection.SendMessage(new FriendStatusNotification()
            {
                FriendList = new Framework.Network.Static.FriendList()
                {
                    Friends = new Dictionary <long, Framework.Network.Static.FriendInfo>()
                    {
                        {
                            0,
                            new Framework.Network.Static.FriendInfo()
                            {
                                //FriendHandle = connection.PlayerInfo.GetHandle(),
                                //FriendAccountId = connection.PlayerInfo.GetAccountId(),
                                FriendStatus = Framework.Constants.Enums.FriendStatus.RequestReceived,
                            }
                        }
                    },
                    IsDelta = true // set that this request doesnt have to overwrite friendlist
                }
            });

            // TODO: SEND FRIENDSTATUSNOTIFICATION WITH STATUS REQUESTSENT
        }
示例#2
0
 public static void RejectFriend(LobbyServerConnection connection, FriendUpdateRequest request)
 {
 }
示例#3
0
 public static void RejectFriend(ClientConnection connection, FriendUpdateRequest request)
 {
 }
示例#4
0
 public static void UnblockFriend(ClientConnection connection, FriendUpdateRequest request)
 {
 }