Example #1
0
    public override Package.Types.Frame DealMsg(Package.Types.Frame req)
    {
        Logger.Info("DealMsg, CmdID={0}, UserID={1}", req.CmdId, req.UserId);

        IMessage reply = null;

        Package.Types.Frame response = req;

        if (req.CmdId == (UInt32)HotelGsCmdID.HotelCreateConnect)
        {
            reply = msgHandler.OnHotelConnect(req.Message);
        }
        else if (req.CmdId == (UInt32)HotelGsCmdID.HotelBroadcastCmdid)
        {
            reply = msgHandler.OnHotelBroadCast(req.Message);
        }
        else if (req.CmdId == (UInt32)HotelGsCmdID.HotelCloseConnet)
        {
            reply = msgHandler.OnHotelCloseConnect(req.Message);
        }
        else if (req.CmdId == (UInt32)HotelGsCmdID.HotelPlayerCheckin)
        {
            reply = msgHandler.OnHotelCheckin(req.Message);
        }
        else if (req.CmdId == (UInt32)HotelGsCmdID.GssetFrameSyncRateNotifyCmdid)
        {
            reply = SetFrameSyncRateNotify(req.Message);
        }
        else if (req.CmdId == (UInt32)HotelGsCmdID.GsframeDataNotifyCmdid)
        {
            reply = FrameDataNotify(req.Message);
        }
        else if (req.CmdId == (UInt32)HotelGsCmdID.GsframeSyncNotifyCmdid)
        {
            reply = FrameSyncNotify(req.Message);
        }
        else if (req.CmdId == (UInt32)MvsGsCmdID.MvsJoinRoomReq)
        {
            reply = msgHandler.OnJoinRoom(req.Message);
        }
        else if (req.CmdId == (UInt32)MvsGsCmdID.MvsCreateRoomReq)
        {
            reply = msgHandler.OnCreateRoom(req.Message);
        }
        else if (req.CmdId == (UInt32)MvsGsCmdID.MvsLeaveRoomReq)
        {
            reply = msgHandler.OnLeaveRoom(req.Message);
        }
        else if (req.CmdId == (UInt32)MvsGsCmdID.MvsJoinOverReq)
        {
            reply = msgHandler.OnJoinOver(req.Message);
        }
        else if (req.CmdId == (UInt32)MvsGsCmdID.MvsJoinOpenReq)
        {
            reply = msgHandler.OnJoinOpen(req.Message);
        }
        else if (req.CmdId == (UInt32)MvsGsCmdID.MvsKickPlayerReq)
        {
            reply = msgHandler.OnKickPlayer(req.Message);
        }
        else if (req.CmdId == (UInt32)MvsGsCmdID.MvsNetworkStateReq)
        {
            reply = msgHandler.OnConnectStatus(req.Message);
        }
        else if (req.CmdId == (UInt32)MvsGsCmdID.MvsGetRoomDetailPush)
        {
            reply = msgHandler.OnRoomDetail(req.Message);
        }
        else if (req.CmdId == (UInt32)MvsGsCmdID.MvsSetRoomPropertyReq)
        {
            reply = msgHandler.OnSetRoomProperty(req.Message);
        }
        else
        {
            reply = new Reply()
            {
                Errno  = ErrorCode.NotImplemented,
                ErrMsg = string.Format("not found the cmdid:{0}", req.CmdId),
            };
        }

        response.CmdId  += 1;
        response.Message = ByteUtils.ObjectToByteString(reply);

        return(response);
    }