Inheritance: global::ProtoBuf.IExtensible
コード例 #1
0
        //响应RoomServer玩家重新连接进入房间的反馈消息
        internal void OnReplyReconnectUser(ulong userGuid, int roomID, int result)
        {
            UserInfo user = LobbyServer.Instance.UserProcessScheduler.GetUserInfo(userGuid);

            if (user == null)
            {
                return;
            }
            switch (result)
            {
            case (int)Msg_RL_ReplyReconnectUser.ReconnectResultEnum.Drop: {
                user.CurrentState = UserState.Room;
                RoomInfo room = m_LobbyInfo.GetRoomByID(roomID);
                if (null != room)
                {
                    RoomServerInfo svrInfo;
                    if (m_LobbyInfo.RoomServerInfos.TryGetValue(room.RoomServerName, out svrInfo))
                    {
                        if (null != svrInfo)
                        {
                            NodeMessage startGameResultMsg = new NodeMessage(LobbyMessageDefine.EnterSceneResult, user.Guid);
                            GameFrameworkMessage.EnterSceneResult protoData = new GameFrameworkMessage.EnterSceneResult();
                            protoData.server_ip   = svrInfo.ServerIp;
                            protoData.server_port = svrInfo.ServerPort;
                            protoData.key         = user.Key;
                            protoData.camp_id     = user.CampId;
                            protoData.scene_type  = room.SceneType;
                            protoData.result      = (int)GeneralOperationResult.LC_Succeed;
                            protoData.prime       = Helper.Random.Next(2, 21);

                            startGameResultMsg.m_ProtoData = protoData;
                            LobbyServer.Instance.TransmitToWorld(user, startGameResultMsg);
                            //重新进入房间成功
                            LogSys.Log(LOG_TYPE.INFO, "user reconnected roomServer success, guid {0}", userGuid);
                        }
                    }
                }
            }
            break;

            case (int)Msg_RL_ReplyReconnectUser.ReconnectResultEnum.NotExist: {
                //不存在,执行进场景流程
                RequestEnterScene(userGuid, user.SceneId, roomID, 0);
                LogSys.Log(LOG_TYPE.INFO, "user reconnected roomserver, not exist, request enter scene ! guid {0}", userGuid);
            }
            break;

            case (int)Msg_RL_ReplyReconnectUser.ReconnectResultEnum.Online: {
                NodeMessage startGameResultMsg = new NodeMessage(LobbyMessageDefine.EnterSceneResult, user.Guid);
                GameFrameworkMessage.EnterSceneResult protoData = new GameFrameworkMessage.EnterSceneResult();
                protoData.result = (int)GeneralOperationResult.LC_Failed;

                startGameResultMsg.m_ProtoData = protoData;
                LobbyServer.Instance.TransmitToWorld(user, startGameResultMsg);
                //room上玩家还是连接与在线状态,重连失败
                LogSys.Log(LOG_TYPE.INFO, "user reconnected roomserver, user already online, guid {0}", userGuid);
            }
            break;
            }
        }
コード例 #2
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;
             }
         }
     }
 }
コード例 #3
0
 private void HandleEnterSceneResult(NodeMessage lobbyMsg)
 {
     GameFrameworkMessage.EnterSceneResult protoData = lobbyMsg.m_ProtoData as GameFrameworkMessage.EnterSceneResult;
     if (null != protoData)
     {
         GeneralOperationResult result = (GeneralOperationResult)protoData.result;
         if (GeneralOperationResult.LC_Succeed == result)
         {
             uint   key     = protoData.key;
             string ip      = protoData.server_ip;
             int    port    = (int)protoData.server_port;
             int    campId  = protoData.camp_id;
             int    sceneId = protoData.scene_type;
             ClientInfo.Instance.PropertyKey = protoData.prime;
             //延迟处理,防止当前正在切场景过程中
             PluginFramework.Instance.QueueAction(PluginFramework.Instance.TryEnterScene, key, ip, port, campId, sceneId);
         }
         else
         {
             PluginFramework.Instance.HighlightPrompt("Tip_SceneEnterFailed");
         }
     }
 }
コード例 #4
0
        //===================================================================
        //以下为与RoomServer之间的消息通信
        //响应RoomServer发来的房间创建反馈消息
        internal void OnEnterSceneResult(ulong userGuid, int roomID, int result)
        {
            UserInfo user = LobbyServer.Instance.UserProcessScheduler.GetUserInfo(userGuid);

            if (user == null)
            {
                return;
            }
            if ((int)SceneOperationResultEnum.Success == result)
            {
                user.CurrentState  = UserState.Room;
                user.CurrentRoomID = roomID;
                RoomInfo room = m_LobbyInfo.GetRoomByID(roomID);
                if (null != room)
                {
                    RoomServerInfo svrInfo;
                    if (m_LobbyInfo.RoomServerInfos.TryGetValue(room.RoomServerName, out svrInfo))
                    {
                        if (null != svrInfo)
                        {
                            NodeMessage enterSceneResultMsg = new NodeMessage(LobbyMessageDefine.EnterSceneResult, user.Guid);
                            GameFrameworkMessage.EnterSceneResult protoData = new GameFrameworkMessage.EnterSceneResult();
                            protoData.server_ip   = svrInfo.ServerIp;
                            protoData.server_port = svrInfo.ServerPort;
                            protoData.key         = user.Key;
                            protoData.camp_id     = user.CampId;
                            protoData.scene_type  = room.SceneType;
                            protoData.result      = (int)GeneralOperationResult.LC_Succeed;
                            protoData.prime       = Helper.Random.Next(2, 21);

                            enterSceneResultMsg.m_ProtoData = protoData;
                            LobbyServer.Instance.TransmitToWorld(user, enterSceneResultMsg);

                            LogSys.Log(LOG_TYPE.INFO, "user enter field success! guid {0} room {1} result {2}",
                                       userGuid, roomID, (SceneOperationResultEnum)result);
                        }
                        else
                        {
                            LobbyServer.Instance.HighlightPrompt(user, 42);//进入游戏失败,请稍后重试
                        }
                    }
                    else
                    {
                        LobbyServer.Instance.HighlightPrompt(user, 42);//进入游戏失败,请稍后重试
                    }
                }
                else
                {
                    LobbyServer.Instance.HighlightPrompt(user, 42);//进入游戏失败,请稍后重试
                }
            }
            else
            {
                RoomInfo curRoom = user.Room;
                if (null != curRoom)
                {
                    curRoom.DelUsers(userGuid);
                }
                user.CurrentState = UserState.Online;

                LogSys.Log(LOG_TYPE.INFO, "user enter field failed! guid {0} room {1} result {2}",
                           userGuid, roomID, (SceneOperationResultEnum)result);

                LobbyServer.Instance.HighlightPrompt(user, 42);//进入游戏失败,请稍后重试
            }
        }
コード例 #5
0
        //响应RoomServer玩家重新连接进入房间的反馈消息
        internal void OnReplyReconnectUser(ulong userGuid, int roomID, int result)
        {
            UserInfo user = LobbyServer.Instance.UserProcessScheduler.GetUserInfo(userGuid);
            if (user == null) { return; }
            switch (result) {
                case (int)Msg_RL_ReplyReconnectUser.ReconnectResultEnum.Drop: {
                        user.CurrentState = UserState.Room;
                        RoomInfo room = m_LobbyInfo.GetRoomByID(roomID);
                        if (null != room) {
                            RoomServerInfo svrInfo;
                            if (m_LobbyInfo.RoomServerInfos.TryGetValue(room.RoomServerName, out svrInfo)) {
                                if (null != svrInfo) {
                                    NodeMessage startGameResultMsg = new NodeMessage(LobbyMessageDefine.EnterSceneResult, user.Guid);
                                    GameFrameworkMessage.EnterSceneResult protoData = new GameFrameworkMessage.EnterSceneResult();
                                    protoData.server_ip = svrInfo.ServerIp;
                                    protoData.server_port = svrInfo.ServerPort;
                                    protoData.key = user.Key;
                                    protoData.camp_id = user.CampId;
                                    protoData.scene_type = room.SceneType;
                                    protoData.result = (int)GeneralOperationResult.LC_Succeed;
                                    protoData.prime = Helper.Random.Next(2, 21);

                                    startGameResultMsg.m_ProtoData = protoData;
                                    LobbyServer.Instance.TransmitToWorld(user, startGameResultMsg);
                                    //重新进入房间成功
                                    LogSys.Log(LOG_TYPE.INFO, "user reconnected roomServer success, guid {0}", userGuid);
                                }
                            }
                        }
                    }
                    break;
                case (int)Msg_RL_ReplyReconnectUser.ReconnectResultEnum.NotExist: {
                        //不存在,执行进场景流程
                        RequestEnterScene(userGuid, user.SceneId, roomID, 0);
                        LogSys.Log(LOG_TYPE.INFO, "user reconnected roomserver, not exist, request enter scene ! guid {0}", userGuid);
                    }
                    break;
                case (int)Msg_RL_ReplyReconnectUser.ReconnectResultEnum.Online: {
                        NodeMessage startGameResultMsg = new NodeMessage(LobbyMessageDefine.EnterSceneResult, user.Guid);
                        GameFrameworkMessage.EnterSceneResult protoData = new GameFrameworkMessage.EnterSceneResult();
                        protoData.result = (int)GeneralOperationResult.LC_Failed;

                        startGameResultMsg.m_ProtoData = protoData;
                        LobbyServer.Instance.TransmitToWorld(user, startGameResultMsg);
                        //room上玩家还是连接与在线状态,重连失败
                        LogSys.Log(LOG_TYPE.INFO, "user reconnected roomserver, user already online, guid {0}", userGuid);
                    }
                    break;
            }
        }
コード例 #6
0
        //===================================================================
        //以下为与RoomServer之间的消息通信
        //响应RoomServer发来的房间创建反馈消息
        internal void OnEnterSceneResult(ulong userGuid, int roomID, int result)
        {
            UserInfo user = LobbyServer.Instance.UserProcessScheduler.GetUserInfo(userGuid);
            if (user == null) { return; }
            if ((int)SceneOperationResultEnum.Success == result) {
                user.CurrentState = UserState.Room;
                user.CurrentRoomID = roomID;
                RoomInfo room = m_LobbyInfo.GetRoomByID(roomID);
                if (null != room) {
                    RoomServerInfo svrInfo;
                    if (m_LobbyInfo.RoomServerInfos.TryGetValue(room.RoomServerName, out svrInfo)) {
                        if (null != svrInfo) {
                            NodeMessage enterSceneResultMsg = new NodeMessage(LobbyMessageDefine.EnterSceneResult, user.Guid);
                            GameFrameworkMessage.EnterSceneResult protoData = new GameFrameworkMessage.EnterSceneResult();
                            protoData.server_ip = svrInfo.ServerIp;
                            protoData.server_port = svrInfo.ServerPort;
                            protoData.key = user.Key;
                            protoData.camp_id = user.CampId;
                            protoData.scene_type = room.SceneType;
                            protoData.result = (int)GeneralOperationResult.LC_Succeed;
                            protoData.prime = Helper.Random.Next(2, 21);

                            enterSceneResultMsg.m_ProtoData = protoData;
                            LobbyServer.Instance.TransmitToWorld(user, enterSceneResultMsg);

                            LogSys.Log(LOG_TYPE.INFO, "user enter field success! guid {0} room {1} result {2}",
                              userGuid, roomID, (SceneOperationResultEnum)result);
                        } else {
                            LobbyServer.Instance.HighlightPrompt(user, 42);//进入游戏失败,请稍后重试
                        }
                    } else {
                        LobbyServer.Instance.HighlightPrompt(user, 42);//进入游戏失败,请稍后重试
                    }
                } else {
                    LobbyServer.Instance.HighlightPrompt(user, 42);//进入游戏失败,请稍后重试
                }
            } else {
                RoomInfo curRoom = user.Room;
                if (null != curRoom) {
                    curRoom.DelUsers(userGuid);
                }
                user.CurrentState = UserState.Online;

                LogSys.Log(LOG_TYPE.INFO, "user enter field failed! guid {0} room {1} result {2}",
                  userGuid, roomID, (SceneOperationResultEnum)result);

                LobbyServer.Instance.HighlightPrompt(user, 42);//进入游戏失败,请稍后重试
            }
        }