Пример #1
0
    public static System.Object PacketToProtocol(ushort packetId, Packet packet)
    {
        switch (packetId)
        {
        case 1020:
            AckRoleLoginOk ackRoleLoginOk = new AckRoleLoginOk(packet);
            return(ackRoleLoginOk);

        case 2020:
            AckScenePlayers ackScenePlayers = new AckScenePlayers(packet);
            return(ackScenePlayers);

        case 2030:
            AckSceneEnter ackSceneEnter = new AckSceneEnter(packet);
            return(ackSceneEnter);

        case 2040:
            AckSceneExit ackSceneExit = new AckSceneExit(packet);
            return(ackSceneExit);

        case 2060:
            AckScenePosRotOk ackScenePosRotOk = new AckScenePosRotOk(packet);
            return(ackScenePosRotOk);

        case 2080:
            AckSceneAnimMoveOk ackSceneAnimMoveOk = new AckSceneAnimMoveOk(packet);
            return(ackSceneAnimMoveOk);

        case 2100:
            AckSceneAnimOk ackSceneAnimOk = new AckSceneAnimOk(packet);
            return(ackSceneAnimOk);
        }

        return(null);
    }
Пример #2
0
    public static System.Object PacketToProtocol(ushort packetId, Packet packet)
    {
        switch (packetId)
        {
        case 1520:
            AckChatSendOk ackChatSendOk = new AckChatSendOk(packet);
            return(ackChatSendOk);

        case 1040:
            AckRoleRandNameOk ackRoleRandNameOk = new AckRoleRandNameOk(packet);
            return(ackRoleRandNameOk);

        case 1050:
            AckRoleLoginOk ackRoleLoginOk = new AckRoleLoginOk(packet);
            return(ackRoleLoginOk);

        case 1060:
            AckRoleLoginOkNoRole ackRoleLoginOkNoRole = new AckRoleLoginOkNoRole(packet);
            return(ackRoleLoginOkNoRole);

        case 2040:
            AckSceneEnter ackSceneEnter = new AckSceneEnter(packet);
            return(ackSceneEnter);

        case 2050:
            AckScenePlayers ackScenePlayers = new AckScenePlayers(packet);
            return(ackScenePlayers);

        case 2060:
            AckSceneExit ackSceneExit = new AckSceneExit(packet);
            return(ackSceneExit);

        case 2080:
            AckSceneMove ackSceneMove = new AckSceneMove(packet);
            return(ackSceneMove);

        case 40020:
            AckTestSendOk ackTestSendOk = new AckTestSendOk(packet);
            return(ackTestSendOk);

        case 40050:
            AckTestXX ackTestXX = new AckTestXX(packet);
            return(ackTestXX);

        case 40070:
            AckTestPhpOk ackTestPhpOk = new AckTestPhpOk(packet);
            return(ackTestPhpOk);
        }

        return(null);
    }
Пример #3
0
    public static System.Object PacketToProtocol(ushort packetId, Packet packet)
    {
        switch (packetId)
        {
            case 1520:
                AckChatSendOk ackChatSendOk = new AckChatSendOk(packet);
                return ackChatSendOk;
            case 1040:
                AckRoleRandNameOk ackRoleRandNameOk = new AckRoleRandNameOk(packet);
                return ackRoleRandNameOk;
            case 1050:
                AckRoleLoginOk ackRoleLoginOk = new AckRoleLoginOk(packet);
                return ackRoleLoginOk;
            case 1060:
                AckRoleLoginOkNoRole ackRoleLoginOkNoRole = new AckRoleLoginOkNoRole(packet);
                return ackRoleLoginOkNoRole;
            case 2040:
                AckSceneEnter ackSceneEnter = new AckSceneEnter(packet);
                return ackSceneEnter;
            case 2050:
                AckScenePlayers ackScenePlayers = new AckScenePlayers(packet);
                return ackScenePlayers;
            case 2060:
                AckSceneExit ackSceneExit = new AckSceneExit(packet);
                return ackSceneExit;
            case 2080:
                AckSceneMove ackSceneMove = new AckSceneMove(packet);
                return ackSceneMove;
            case 40020:
                AckTestSendOk ackTestSendOk = new AckTestSendOk(packet);
                return ackTestSendOk;
            case 40050:
                AckTestXX ackTestXX = new AckTestXX(packet);
                return ackTestXX;
            case 40070:
                AckTestPhpOk ackTestPhpOk = new AckTestPhpOk(packet);
                return ackTestPhpOk;
        }

        return null;
    }
Пример #4
0
    public void OnNetHandler(ushort packetId, System.Object obj)
    {
        Log.Error("SceneMgr OnNetHandler packetId:" + packetId);
        if (packetId == Msg.P_ACK_SCENE_PLAYERS)
        {
            AckScenePlayers scenePlayers = obj as AckScenePlayers;
            foreach (MsgScenePlayer msgPlayer in scenePlayers.players)
            {
                SceneAddPlayer(msgPlayer);
            }
        }
        else if (packetId == Msg.P_ACK_SCENE_ENTER)
        {
            AckSceneEnter  sceneEnter = obj as AckSceneEnter;
            MsgScenePlayer msgPlayer  = sceneEnter.player;

            SceneAddPlayer(msgPlayer);
        }
        else if (packetId == Msg.P_ACK_SCENE_EXIT)
        {
            AckSceneExit sceneExit = obj as AckSceneExit;
            SceneData.DelPlayer(sceneExit.uid);
        }
        else if (packetId == Msg.P_ACK_SCENE_POS_ROT_OK)
        {
            AckScenePosRotOk posRotOk    = obj as AckScenePosRotOk;
            ScenePlayer      scenePlayer = SceneData.GetPlayer(posRotOk.uid);
            if (scenePlayer != null)
            {
                scenePlayer.moveSync.SetPositionAndRotation(posRotOk.posrot);
            }
            else
            {
                Debug.Log("P_ACK_SCENE_POS_ROT_OK no player");
            }
        }
        else if (packetId == Msg.P_ACK_SCENE_ANIM_MOVE_OK)
        {
            AckSceneAnimMoveOk animMoveOk  = obj as AckSceneAnimMoveOk;
            ScenePlayer        scenePlayer = SceneData.GetPlayer(animMoveOk.uid);
            if (scenePlayer != null)
            {
                scenePlayer.moveSync.SetAnim(animMoveOk.is_move);
            }
            else
            {
                Debug.Log("P_ACK_SCENE_ANIM_MOVE_OK no player");
            }
        }
        else if (packetId == Msg.P_ACK_SCENE_ANIM_OK)
        {
            AckSceneAnimOk animOk      = obj as AckSceneAnimOk;
            ScenePlayer    scenePlayer = SceneData.GetPlayer(animOk.uid);
            if (scenePlayer != null)
            {
                scenePlayer.animSync.SetAnim(animOk);
            }
            else
            {
                Debug.Log("P_ACK_SCENE_ANIM_OK no player");
            }
        }
    }