Inheritance: global::ProtoBuf.IExtensible
        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);
                }
            }
        }
 internal void AddFriend(string nickname)
 {
     try {
         NodeMessage msg = new NodeMessage(LobbyMessageDefine.Msg_CL_AddFriend);
         msg.SetHeaderWithGuid(m_Guid);
         Msg_CL_AddFriend protoData = new Msg_CL_AddFriend();
         protoData.m_FriendNickname = nickname;
         msg.m_ProtoData = protoData;
         SendMessage(msg);
     } catch (Exception ex) {
         LogSystem.Error("Exception:{0}\n{1}", ex.Message, ex.StackTrace);
     }
 }
Esempio n. 3
0
 private void HandleAddFriend(NodeMessage msg, int handle, uint seq)
 {
     GameFrameworkMessage.NodeMessageWithGuid nodeMsg = msg.m_NodeHeader as GameFrameworkMessage.NodeMessageWithGuid;
     if (null != nodeMsg)
     {
         GameFrameworkMessage.Msg_CL_AddFriend protoData = msg.m_ProtoData as GameFrameworkMessage.Msg_CL_AddFriend;
         if (null != protoData)
         {
             UserThread userThread = m_UserProcessScheduler.GetUserThread(nodeMsg.m_Guid);
             if (null != userThread)
             {
                 userThread.QueueAction(userThread.AddFriend, nodeMsg.m_Guid, protoData);
             }
         }
     }
 }