コード例 #1
0
        internal void AddFriend(ulong guid, Msg_CL_AddFriend msg)
        {
            UserInfo userInfo = GetUserInfo(guid);

            if (null != userInfo)
            {
                ulong    friendGuid     = UserServer.Instance.UserProcessScheduler.FindUserGuidByNickname(msg.m_FriendNickname);
                UserInfo friendUserInfo = GetUserInfo(friendGuid);
                if (null != friendUserInfo)
                {
                    FriendInfo friendInfo = userInfo.FriendInfos.Find(fi => fi.FriendNickname == msg.m_FriendNickname);
                    if (null == friendInfo)
                    {
                        friendInfo      = new FriendInfo();
                        friendInfo.Guid = UserServer.Instance.GlobalProcessThread.GenerateFriendGuid();
                        userInfo.FriendInfos.Add(friendInfo);
                    }
                    friendInfo.FriendNickname = msg.m_FriendNickname;
                    friendInfo.FriendGuid     = friendGuid;
                    friendInfo.UserGuid       = guid;

                    FriendInfoForMessage msgInfo = new FriendInfoForMessage();
                    msgInfo.FriendGuid     = friendInfo.FriendGuid;
                    msgInfo.FriendNickname = friendInfo.FriendNickname;
                    msgInfo.IsBlack        = friendInfo.IsBlack;

                    Msg_LC_AddFriend retMsg = new Msg_LC_AddFriend();
                    retMsg.m_FriendInfo = msgInfo;
                    NotifyUser(guid, LobbyMessageDefine.Msg_LC_AddFriend, retMsg);
                }
            }
        }
コード例 #2
0
        internal void MarkBlack(ulong guid, Msg_CL_MarkBlack msg)
        {
            UserInfo userInfo = GetUserInfo(guid);

            if (null != userInfo)
            {
                FriendInfo friendInfo = userInfo.FriendInfos.Find(fi => fi.FriendGuid == msg.m_FriendGuid);
                if (null != friendInfo)
                {
                    friendInfo.IsBlack = true;

                    Msg_LC_MarkBlack retMsg = new Msg_LC_MarkBlack();
                    retMsg.m_FriendGuid = msg.m_FriendGuid;
                    NotifyUser(guid, LobbyMessageDefine.Msg_LC_MarkBlack, retMsg);
                }
            }
        }
コード例 #3
0
        internal void RemoveFriend(ulong guid, Msg_CL_RemoveFriend msg)
        {
            UserInfo userInfo = GetUserInfo(guid);

            if (null != userInfo)
            {
                FriendInfo friendInfo = userInfo.FriendInfos.Find(fi => fi.FriendGuid == msg.m_FriendGuid);
                if (null != friendInfo)
                {
                    friendInfo.Deleted = true;

                    Msg_LC_RemoveFriend retMsg = new Msg_LC_RemoveFriend();
                    retMsg.m_FriendGuid = msg.m_FriendGuid;
                    NotifyUser(guid, LobbyMessageDefine.Msg_LC_RemoveFriend, retMsg);
                }
            }
        }
コード例 #4
0
        internal void AddFriend(ulong guid, Msg_CL_AddFriend msg)
        {
            UserInfo userInfo = GetUserInfo(guid);
            if (null != userInfo) {
                ulong friendGuid = UserServer.Instance.UserProcessScheduler.FindUserGuidByNickname(msg.m_FriendNickname);
                UserInfo friendUserInfo = GetUserInfo(friendGuid);
                if (null != friendUserInfo) {
                    FriendInfo friendInfo = userInfo.FriendInfos.Find(fi => fi.FriendNickname == msg.m_FriendNickname);
                    if (null == friendInfo) {
                        friendInfo = new FriendInfo();
                        friendInfo.Guid = UserServer.Instance.GlobalProcessThread.GenerateFriendGuid();
                        userInfo.FriendInfos.Add(friendInfo);
                    }
                    friendInfo.FriendNickname = msg.m_FriendNickname;
                    friendInfo.FriendGuid = friendGuid;
                    friendInfo.UserGuid = guid;

                    FriendInfoForMessage msgInfo = new FriendInfoForMessage();
                    msgInfo.FriendGuid = friendInfo.FriendGuid;
                    msgInfo.FriendNickname = friendInfo.FriendNickname;
                    msgInfo.IsBlack = friendInfo.IsBlack;

                    Msg_LC_AddFriend retMsg = new Msg_LC_AddFriend();
                    retMsg.m_FriendInfo = msgInfo;
                    NotifyUser(guid, LobbyMessageDefine.Msg_LC_AddFriend, retMsg);
                }
            }
        }