Наследование: global::ProtoBuf.IExtensible
Пример #1
0
 private void HandleAddFriend(NodeMessage lobbyMsg)
 {
     GameFrameworkMessage.Msg_LC_AddFriend protoMsg = lobbyMsg.m_ProtoData as GameFrameworkMessage.Msg_LC_AddFriend;
     if (null != protoMsg)
     {
         FriendInfoForMessage friendInfo = ClientInfo.Instance.RoleData.Friends.Find(fi => fi.FriendGuid == protoMsg.m_FriendInfo.FriendGuid);
         ClientInfo.Instance.RoleData.Friends.Remove(friendInfo);
         ClientInfo.Instance.RoleData.Friends.Add(protoMsg.m_FriendInfo);
     }
 }
Пример #2
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);
                }
            }
        }