Наследование: global::ProtoBuf.IExtensible
Пример #1
0
        private void HandleQuitRoom(NodeMessage msg, int handle, uint seq)
        {
            GameFrameworkMessage.NodeMessageWithGuid headerMsg = msg.m_NodeHeader as GameFrameworkMessage.NodeMessageWithGuid;
            if (null != headerMsg)
            {
                GameFrameworkMessage.QuitRoom protoMsg = msg.m_ProtoData as GameFrameworkMessage.QuitRoom;
                if (null != protoMsg)
                {
                    ulong  guid            = headerMsg.m_Guid;
                    bool   is_quit_room    = protoMsg.m_IsQuitRoom;
                    byte[] originalMsgData = msg.m_OriginalMsgData;

                    UserInfo user = UserServer.Instance.UserProcessScheduler.GetUserInfo(guid);
                    if (user != null)
                    {
                        if (user.CurrentState == UserState.Room)
                        {
                            UserServer.Instance.ForwardToBigworld(user, originalMsgData);
                        }
                        else
                        {
                            user.CurrentState = UserState.Online;
                        }
                        LogSys.Log(LOG_TYPE.INFO, "QuitRoom Guid {0} state {1}", guid, user.CurrentState);
                    }
                }
            }
        }
Пример #2
0
        //------------------------------------------------------------------------------------------------------
        private bool FilterMessage(NodeMessage msg, int handle, uint seq)
        {
            bool isContinue = true;

            if (handle > 0)
            {
                if (msg.m_ID == 0)
                {
                    //这几个消息不进行数量统计
                }
                else
                {
                    GameFrameworkMessage.NodeMessageWithGuid msgWithGuid = msg.m_NodeHeader as GameFrameworkMessage.NodeMessageWithGuid;
                    if (null != msgWithGuid)
                    {
                        ulong guid = msgWithGuid.m_Guid;
                        isContinue = OperationMeasure.Instance.CheckOperation(msgWithGuid.m_Guid);
                        if (!isContinue)
                        {
                            NodeMessage retMsg = new NodeMessage(LobbyMessageDefine.TooManyOperations, guid);
                            NodeMessageDispatcher.SendNodeMessage(handle, retMsg);
                        }
                    }
                }
            }
            return(isContinue);
        }
Пример #3
0
        private void HandleRequestSceneRoomList(NodeMessage msg, int handle, uint seq)
        {
            GameFrameworkMessage.NodeMessageWithGuid headerMsg = msg.m_NodeHeader as GameFrameworkMessage.NodeMessageWithGuid;
            if (null != headerMsg)
            {
                ulong guid = headerMsg.m_Guid;

                RoomProcessThread roomProcess = LobbyServer.Instance.RoomProcessThread;
                roomProcess.QueueAction(roomProcess.RequestSceneRoomList, guid);
            }
        }
Пример #4
0
 private void HandleQuitRoom(NodeMessage msg, int handle, uint seq)
 {
     GameFrameworkMessage.NodeMessageWithGuid quitClientMsg = msg.m_NodeHeader as GameFrameworkMessage.NodeMessageWithGuid;
     if (null != quitClientMsg)
     {
         GameFrameworkMessage.QuitRoom protoData = msg.m_ProtoData as GameFrameworkMessage.QuitRoom;
         if (null != protoData)
         {
             m_RoomProcessThread.QueueAction(m_RoomProcessThread.QuitRoom, quitClientMsg.m_Guid, protoData.m_IsQuitRoom, handle);
         }
     }
 }
Пример #5
0
 private void HandleChangeName(NodeMessage msg, int handle, uint seq)
 {
     GameFrameworkMessage.NodeMessageWithGuid nameMsg = msg.m_NodeHeader as GameFrameworkMessage.NodeMessageWithGuid;
     if (null != nameMsg)
     {
         GameFrameworkMessage.ChangeName protoData = msg.m_ProtoData as GameFrameworkMessage.ChangeName;
         if (null != protoData)
         {
             m_UserProcessScheduler.DefaultUserThread.QueueAction(m_UserProcessScheduler.DoChangeName, nameMsg.m_Guid, protoData.m_Nickname);
         }
     }
 }
Пример #6
0
 private void HandleDeleteMail(NodeMessage msg, int handle, uint seq)
 {
     GameFrameworkMessage.NodeMessageWithGuid deleteMailMsg = msg.m_NodeHeader as GameFrameworkMessage.NodeMessageWithGuid;
     if (null != deleteMailMsg)
     {
         GameFrameworkMessage.Msg_CL_DeleteMail protoData = msg.m_ProtoData as GameFrameworkMessage.Msg_CL_DeleteMail;
         if (null != protoData)
         {
             m_GlobalProcessThread.QueueAction(m_GlobalProcessThread.DeleteMail, deleteMailMsg.m_Guid, protoData.m_MailGuid);
         }
     }
 }
Пример #7
0
 private void HandleChangeSceneRoom(NodeMessage msg, int handle, uint seq)
 {
     GameFrameworkMessage.NodeMessageWithGuid changeSceneMsg = msg.m_NodeHeader as GameFrameworkMessage.NodeMessageWithGuid;
     if (null != changeSceneMsg)
     {
         GameFrameworkMessage.ChangeSceneRoom protoData = msg.m_ProtoData as GameFrameworkMessage.ChangeSceneRoom;
         if (null != protoData)
         {
             m_RoomProcessThread.QueueAction(m_RoomProcessThread.RequestChangeSceneRoom, changeSceneMsg.m_Guid, protoData.m_SceneId, protoData.m_RoomId);
         }
     }
 }
Пример #8
0
 //==========================================================================================================================
 private void HandleEnterScene(NodeMessage msg, int handle, uint seq)
 {
     GameFrameworkMessage.NodeMessageWithGuid startGameMsg = msg.m_NodeHeader as GameFrameworkMessage.NodeMessageWithGuid;
     if (startGameMsg != null)
     {
         GameFrameworkMessage.Msg_LB_RequestEnterScene msgData = msg.m_ProtoData as GameFrameworkMessage.Msg_LB_RequestEnterScene;
         if (null != msgData)
         {
             m_RoomProcessThread.QueueAction(m_RoomProcessThread.RequestEnterScene, startGameMsg.m_Guid, msgData.SceneId, msgData.WantRoomId, msgData.FromSceneId);
         }
     }
 }
Пример #9
0
        private void HandleGetMailList(NodeMessage msg, int handle, uint seq)
        {
            GameFrameworkMessage.NodeMessageWithGuid getMailListMsg = msg.m_NodeHeader as GameFrameworkMessage.NodeMessageWithGuid;
            if (null != getMailListMsg)
            {
                if (m_GlobalProcessThread.CurActionNum > m_MaxGlobalActionNum)
                {
                    NodeMessage retMsg = new NodeMessage(LobbyMessageDefine.TooManyOperations, getMailListMsg.m_Guid);

                    NodeMessageDispatcher.SendNodeMessage(handle, retMsg);
                    return;
                }
                m_GlobalProcessThread.QueueAction(m_GlobalProcessThread.GetMailList, getMailListMsg.m_Guid);
            }
        }
Пример #10
0
        private void HandleRequestSceneRoomList(NodeMessage msg, int handle, uint seq)
        {
            GameFrameworkMessage.NodeMessageWithGuid headerMsg = msg.m_NodeHeader as GameFrameworkMessage.NodeMessageWithGuid;
            if (null != headerMsg)
            {
                ulong  guid            = headerMsg.m_Guid;
                byte[] originalMsgData = msg.m_OriginalMsgData;

                UserInfo info = UserServer.Instance.UserProcessScheduler.GetUserInfo(guid);
                if (null != info)
                {
                    UserServer.Instance.ForwardToBigworld(info, originalMsgData);
                }
            }
        }
Пример #11
0
 private void HandleDiscardItem(NodeMessage msg, int handle, uint seq)
 {
     GameFrameworkMessage.NodeMessageWithGuid nodeMsg = msg.m_NodeHeader as GameFrameworkMessage.NodeMessageWithGuid;
     if (null != nodeMsg)
     {
         GameFrameworkMessage.Msg_CL_DiscardItem protoData = msg.m_ProtoData as GameFrameworkMessage.Msg_CL_DiscardItem;
         if (null != protoData)
         {
             UserThread userThread = m_UserProcessScheduler.GetUserThread(nodeMsg.m_Guid);
             if (null != userThread)
             {
                 userThread.QueueAction(userThread.DiscardItem, nodeMsg.m_Guid, protoData);
             }
         }
     }
 }
Пример #12
0
        private void HandleStoryMessage(NodeMessage msg, int handle, uint seq)
        {
            GameFrameworkMessage.NodeMessageWithGuid storyMsg = msg.m_NodeHeader as GameFrameworkMessage.NodeMessageWithGuid;
            if (null != storyMsg)
            {
                GameFrameworkMessage.Msg_CLC_StoryMessage protoData = msg.m_ProtoData as GameFrameworkMessage.Msg_CLC_StoryMessage;
                if (null != protoData)
                {
                    ulong      guid       = storyMsg.m_Guid;
                    UserThread userThread = m_UserProcessScheduler.GetUserThread(guid);
                    if (null != userThread)
                    {
                        //客户端发来的消息都加上前缀client,防止直接调用服务器端逻辑(服务器消息不能用client前缀!)
                        string    msgId = string.Format("client:{0}", protoData.m_MsgId);
                        ArrayList args  = new ArrayList();
                        args.Add(guid);
                        for (int i = 0; i < protoData.m_Args.Count; i++)
                        {
                            switch (protoData.m_Args[i].val_type)
                            {
                            case LobbyArgType.NULL:    //null
                                args.Add(null);
                                break;

                            case LobbyArgType.INT:    //int
                                args.Add(int.Parse(protoData.m_Args[i].str_val));
                                break;

                            case LobbyArgType.FLOAT:    //float
                                args.Add(float.Parse(protoData.m_Args[i].str_val));
                                break;

                            default:    //string
                                args.Add(protoData.m_Args[i].str_val);
                                break;
                            }
                        }
                        object[] objArgs = args.ToArray();
                        userThread.QueueAction(userThread.SendStoryMessage, msgId, objArgs);
                    }
                }
            }
        }
Пример #13
0
 //------------------------------------------------------------------------------------------------------
 private void HandleUserHeartbeat(NodeMessage msg, int handle, uint seq)
 {
     GameFrameworkMessage.NodeMessageWithGuid heartbeatMsg = msg.m_NodeHeader as GameFrameworkMessage.NodeMessageWithGuid;
     if (null != heartbeatMsg)
     {
         if (null == m_UserProcessScheduler.GetUserInfo(heartbeatMsg.m_Guid))
         {
             NodeMessage retMsg = new NodeMessage(LobbyMessageDefine.KickUser, heartbeatMsg.m_Guid);
             NodeMessageDispatcher.SendNodeMessage(handle, retMsg);
             LogSys.Log(LOG_TYPE.DEBUG, "HandleUserHeartbeat, guid:{0} can't found, kick.", heartbeatMsg.m_Guid);
         }
         else
         {
             //echo
             NodeMessageDispatcher.SendNodeMessage(handle, msg);
             //逻辑处理
             m_UserProcessScheduler.GetUserThread(heartbeatMsg.m_Guid).QueueAction(m_UserProcessScheduler.DoUserHeartbeat, heartbeatMsg.m_Guid);
         }
     }
 }
Пример #14
0
        private void HandleChangeSceneRoom(NodeMessage msg, int handle, uint seq)
        {
            GameFrameworkMessage.NodeMessageWithGuid headerMsg = msg.m_NodeHeader as GameFrameworkMessage.NodeMessageWithGuid;
            if (null != headerMsg)
            {
                GameFrameworkMessage.ChangeSceneRoom protoMsg = msg.m_ProtoData as GameFrameworkMessage.ChangeSceneRoom;
                if (null != protoMsg)
                {
                    ulong  guid            = headerMsg.m_Guid;
                    int    sceneId         = protoMsg.m_SceneId;
                    int    wantRoomId      = protoMsg.m_RoomId;
                    byte[] originalMsgData = msg.m_OriginalMsgData;

                    UserInfo info = UserServer.Instance.UserProcessScheduler.GetUserInfo(guid);
                    if (null != info)
                    {
                        UserServer.Instance.ForwardToBigworld(info, originalMsgData);
                    }
                }
            }
        }
Пример #15
0
 //------------------------------------------------------------------------------------------------------
 private void ObserveEnterSceneResult(NodeMessage msg, int handle, uint seq)
 {
     if (handle != 0)
     {
         return;
     }
     GameFrameworkMessage.NodeMessageWithGuid headerMsg = msg.m_NodeHeader as GameFrameworkMessage.NodeMessageWithGuid;
     if (null != headerMsg)
     {
         GameFrameworkMessage.EnterSceneResult protoMsg = msg.m_ProtoData as GameFrameworkMessage.EnterSceneResult;
         if (null != protoMsg)
         {
             UserProcessScheduler dataProcess = UserServer.Instance.UserProcessScheduler;
             UserInfo             user        = dataProcess.GetUserInfo(headerMsg.m_Guid);
             if (user != null && protoMsg.result == 0)
             {
                 user.CurrentState = UserState.Room;
                 user.SceneId      = protoMsg.scene_type;
             }
         }
     }
 }
Пример #16
0
        private void HandleEnterScene(NodeMessage msg, int handle, uint seq)
        {
            GameFrameworkMessage.NodeMessageWithGuid headerMsg = msg.m_NodeHeader as GameFrameworkMessage.NodeMessageWithGuid;
            if (null != headerMsg)
            {
                GameFrameworkMessage.EnterScene protoMsg = msg.m_ProtoData as GameFrameworkMessage.EnterScene;
                if (null != protoMsg)
                {
                    ulong guid       = headerMsg.m_Guid;
                    int   sceneId    = protoMsg.m_SceneId;
                    int   wantRoomId = protoMsg.m_RoomId;

                    UserProcessScheduler dataProcess = UserServer.Instance.UserProcessScheduler;
                    UserInfo             user        = dataProcess.GetUserInfo(guid);
                    if (user != null)
                    {
                        Msg_LB_RequestEnterScene    builder         = new Msg_LB_RequestEnterScene();
                        Msg_LB_BigworldUserBaseInfo baseInfoBuilder = new Msg_LB_BigworldUserBaseInfo();

                        baseInfoBuilder.AccountId       = user.AccountId;
                        baseInfoBuilder.NodeName        = user.NodeName;
                        baseInfoBuilder.WorldId         = UserServerConfig.WorldId;
                        baseInfoBuilder.ClientInfo      = user.ClientInfo;
                        baseInfoBuilder.StartServerTime = UserServerConfig.StartServerTime;
                        baseInfoBuilder.SceneId         = user.SceneId;

                        builder.BaseInfo    = baseInfoBuilder;
                        builder.User        = UserThread.BuildRoomUserInfo(user, 0, 0);
                        builder.SceneId     = sceneId;
                        builder.WantRoomId  = wantRoomId;
                        builder.FromSceneId = user.SceneId;
                        UserServer.Instance.BigworldChannel.Send(builder);
                    }
                }
            }
        }
 internal void SetHeaderWithGuid(ulong guid)
 {
     NodeMessageWithGuid header = m_NodeHeader as NodeMessageWithGuid;
     if (null == header) {
         header = new NodeMessageWithGuid();
         m_NodeHeader = header;
     }
     header.m_Guid = guid;
 }
Пример #18
0
 internal void SendWholeMail(MailInfo wholeMail, int validityPeriod)
 {
     wholeMail.m_MailGuid = GenMailGuid();
     wholeMail.m_SendTime = DateTime.Now;
     wholeMail.m_ExpiryDate = wholeMail.m_SendTime.AddDays(validityPeriod);
     m_WholeMails.Add(wholeMail);
     NodeMessage newMailMsg = new NodeMessage(LobbyMessageDefine.Msg_LC_NotifyNewMail);
     NodeMessageWithGuid headerData = new NodeMessageWithGuid();
     newMailMsg.m_NodeHeader = headerData;
     UserProcessScheduler dataProcess = UserServer.Instance.UserProcessScheduler;
     dataProcess.VisitUsers((UserInfo userInfo) => {
         headerData.m_Guid = userInfo.Guid;
         NodeMessageDispatcher.SendNodeMessage(userInfo.NodeName, newMailMsg);
     });
 }