コード例 #1
0
    public static PacketDistributed CreatePacket(MessageID packetID)
    {
        PacketDistributed packet = null;

        switch (packetID)
        {
        case MessageID.PACKET_CG_CHAT: { packet = new CG_CHAT(); } break;

        case MessageID.PACKET_CG_CONNECTED_HEARTBEAT: { packet = new CG_CONNECTED_HEARTBEAT(); } break;

        case MessageID.PACKET_CG_FIGHT: { packet = new CG_FIGHT(); } break;

        case MessageID.PACKET_CG_LEAVE_COPYSCENE: { packet = new CG_LEAVE_COPYSCENE(); } break;

        case MessageID.PACKET_CG_LOGIN: { packet = new CG_LOGIN(); } break;

        case MessageID.PACKET_CG_MOVE: { packet = new CG_MOVE(); } break;

        case MessageID.PACKET_CG_REQ_NEAR_LIST: { packet = new CG_REQ_NEAR_LIST(); } break;

        case MessageID.PACKET_GC_ATTACKFLY: { packet = new GC_ATTACKFLY(); } break;

        case MessageID.PACKET_GC_CHAT: { packet = new GC_CHAT(); } break;

        case MessageID.PACKET_GC_CONNECTED_HEARTBEAT: { packet = new GC_CONNECTED_HEARTBEAT(); } break;

        case MessageID.PACKET_GC_DELETE_OBJ: { packet = new GC_DELETE_OBJ(); } break;

        case MessageID.PACKET_GC_FORCE_SETPOS: { packet = new GC_FORCE_SETPOS(); } break;

        case MessageID.PACKET_GC_LOGIN_RET: { packet = new GC_LOGIN_RET(); } break;

        case MessageID.PACKET_GC_MOVE: { packet = new GC_MOVE(); } break;

        case MessageID.PACKET_GC_NEAR_MARCHLIST: { packet = new GC_NEAR_MARCHLIST(); } break;

        case MessageID.PACKET_GC_NOTICE: { packet = new GC_NOTICE(); } break;

        case MessageID.PACKET_GC_PLAY_EFFECT: { packet = new GC_PLAY_EFFECT(); } break;

        case MessageID.PACKET_GC_REMOVEEFFECT: { packet = new GC_REMOVEEFFECT(); } break;

        case MessageID.PACKET_GC_RET_USE_SKILL: { packet = new GC_RET_USE_SKILL(); } break;

        case MessageID.PACKET_GC_STOP: { packet = new GC_STOP(); } break;

        case MessageID.PACKET_GC_TELEMOVE: { packet = new GC_TELEMOVE(); } break;

        case MessageID.PACKET_GC_UPDATE_ANIMATION_STATE: { packet = new GC_UPDATE_ANIMATION_STATE(); } break;

        case MessageID.PACKET_GC_UPDATE_NEEDIMPACTINFO: { packet = new GC_UPDATE_NEEDIMPACTINFO(); } break;

        case MessageID.PACKET_GC_UPDATE_SCENE_INSTACTIVATION: { packet = new GC_UPDATE_SCENE_INSTACTIVATION(); } break;
        }
        if (null != packet)
        {
            packet.packetID = packetID;
        }
        return(packet);
    }
コード例 #2
0
        public uint Execute(PacketDistributed ipacket)
        {
            GC_STOP packet = (GC_STOP )ipacket;

            if (null == packet)
            {
                return((uint)PACKET_EXE.PACKET_EXE_ERROR);
            }
            //enter your logic
            return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
        }
コード例 #3
0
        public uint Execute(PacketDistributed ipacket)
        {
            GC_STOP packet = (GC_STOP)ipacket;

            if (null == packet)
            {
                return((uint)PACKET_EXE.PACKET_EXE_ERROR);
            }

            //临时代码,先返回,调试的时候打开
            //return (uint)PACKET_EXE.PACKET_EXE_CONTINUE;

            //判断ServerID
            if (packet.Serverid == GlobeVar.INVALID_ID)
            {
                return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
            }

            //查找该NPC
            Obj_Character obj = Singleton <ObjManager> .GetInstance().FindObjCharacterInScene(packet.Serverid);

            if (null == obj)
            {
                return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
            }
            //轻功状态下停止轻功
            if (obj.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_OTHER_PLAYER)
            {
                Obj_OtherPlayer _otherPlayer = obj as Obj_OtherPlayer;
                if (_otherPlayer && _otherPlayer.IsLightState)
                {
                    _otherPlayer.EndLightSkillMove();
                }
            }
            //查找Obj是否绑定AutoMove组件
            AutoMove autoMove = obj.AutoMoveComponent;

            if (null != autoMove)
            {
                autoMove.InterruptMove(packet);
            }

            return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
        }
コード例 #4
0
ファイル: AutoMove.cs プロジェクト: kimch2/PackageClient
    //强制打断移动
    //策略是找到路径中和GC_STOP的Serial相同点,走完之前点,删除之后点,并且将该点的目的地变为GC_STOP中的坐标
    public void InterruptMove(GC_STOP packet)
    {
        if (Cutscene.CutsceneManager.Instance.IsPlayingCutscene)
        {
            return;
        }

        if (null == m_BindObj || m_BindObj.ServerID != packet.Serverid)
        {
            return;
        }

        //for (int i = 0; i < m_posList.Count; ++i)
        //{
        //    if (m_posList[i].m_nPosSerial == packet.Posserial)
        //    {
        //        //如果不是最后一个点,则清除该点之后所有点
        //        if (i < m_posList.Count-1)
        //        {
        //            m_posList.RemoveRange(i + 1, m_posList.Count - i - 1);
        //        }

        //        //修改i数值
        //        AutoMovePos autoPos = m_posList[i];
        //        autoPos.m_fDstPosX = ((float)packet.Posx) / 100;
        //        autoPos.m_fDstPosZ = ((float)packet.Posz) / 100;

        //        //删除原有数据,插入新数值
        //        m_posList.RemoveAt(i);
        //        m_posList.Add(autoPos);

        //        //如果是第一个点,则重新发起移动
        //        if (i == 0)
        //        {
        //            BeginMove(m_posList[i]);
        //        }

        //        return;
        //    }
        //}

        //如果没找到点,也强制打断移动
        StopMove();
    }
コード例 #5
0
    public static PacketDistributed CreatePacket(MessageID packetID)
    {
        PacketDistributed packet = null;

        switch (packetID)
        {
        case MessageID.PACKET_CG_ASSIGN_HERO: { packet = new CG_ASSIGN_HERO(); } break;

        case MessageID.PACKET_CG_BATTLEINFOR: { packet = new CG_BATTLEINFOR(); } break;

        case MessageID.PACKET_CG_BATTLEPREPARE: { packet = new CG_BATTLEPREPARE(); } break;

        case MessageID.PACKET_CG_BUILDING_LEVELUP: { packet = new CG_Building_LevelUp(); } break;

        case MessageID.PACKET_CG_CHAT: { packet = new CG_CHAT(); } break;

        case MessageID.PACKET_CG_CONNECTED_HEARTBEAT: { packet = new CG_CONNECTED_HEARTBEAT(); } break;

        case MessageID.PACKET_CG_CREATEROLE: { packet = new CG_CREATEROLE(); } break;

        case MessageID.PACKET_CG_FIGHT: { packet = new CG_FIGHT(); } break;

        case MessageID.PACKET_CG_LEAVE_COPYSCENE: { packet = new CG_LEAVE_COPYSCENE(); } break;

        case MessageID.PACKET_CG_LOGIN: { packet = new CG_LOGIN(); } break;

        case MessageID.PACKET_CG_MARCH_MOVE: { packet = new CG_MARCH_MOVE(); } break;

        case MessageID.PACKET_CG_MOVE: { packet = new CG_MOVE(); } break;

        case MessageID.PACKET_CG_OBJPOSLIST: { packet = new CG_OBJPOSLIST(); } break;

        case MessageID.PACKET_CG_REQ_NEAR_LIST: { packet = new CG_REQ_NEAR_LIST(); } break;

        case MessageID.PACKET_CG_ROBOT_OPEN: { packet = new CG_ROBOT_OPEN(); } break;

        case MessageID.PACKET_CG_SEND_MARCH: { packet = new CG_SEND_MARCH(); } break;

        case MessageID.PACKET_CG_SKILL_USE: { packet = new CG_SKILL_USE(); } break;

        case MessageID.PACKET_CG_TROOP_TRAIN: { packet = new CG_Troop_Train(); } break;

        case MessageID.PACKET_GC_ASSIGN_HERO: { packet = new GC_ASSIGN_HERO(); } break;

        case MessageID.PACKET_GC_ATTACKFLY: { packet = new GC_ATTACKFLY(); } break;

        case MessageID.PACKET_GC_BATTLEEND: { packet = new GC_BATTLEEND(); } break;

        case MessageID.PACKET_GC_BATTLEINFOR: { packet = new GC_BATTLEINFOR(); } break;

        case MessageID.PACKET_GC_BATTLEPREPARE: { packet = new GC_BATTLEPREPARE(); } break;

        case MessageID.PACKET_GC_BATTLESTART: { packet = new GC_BattleStart(); } break;

        case MessageID.PACKET_GC_BUILDING_LEVELUP: { packet = new GC_Building_LevelUp(); } break;

        case MessageID.PACKET_GC_CHAT: { packet = new GC_CHAT(); } break;

        case MessageID.PACKET_GC_CONNECTED_HEARTBEAT: { packet = new GC_CONNECTED_HEARTBEAT(); } break;

        case MessageID.PACKET_GC_CREATEROLE_RET: { packet = new GC_CREATEROLE_RET(); } break;

        case MessageID.PACKET_GC_DELETE_OBJ: { packet = new GC_DELETE_OBJ(); } break;

        case MessageID.PACKET_GC_FIGHT: { packet = new GC_FIGHT(); } break;

        case MessageID.PACKET_GC_FORCE_SETPOS: { packet = new GC_FORCE_SETPOS(); } break;

        case MessageID.PACKET_GC_LOGIN_QUEUE_STATUS: { packet = new GC_LOGIN_QUEUE_STATUS(); } break;

        case MessageID.PACKET_GC_LOGIN_RET: { packet = new GC_LOGIN_RET(); } break;

        case MessageID.PACKET_GC_MARCH_MOVE: { packet = new GC_MARCH_MOVE(); } break;

        case MessageID.PACKET_GC_MOVE: { packet = new GC_MOVE(); } break;

        case MessageID.PACKET_GC_NEAR_MARCHLIST: { packet = new GC_NEAR_MARCHLIST(); } break;

        case MessageID.PACKET_GC_NOTICE: { packet = new GC_NOTICE(); } break;

        case MessageID.PACKET_GC_OBJCOMMANDPURSUE: { packet = new GC_OBJCOMMANDPURSUE(); } break;

        case MessageID.PACKET_GC_OBJGETHURT: { packet = new GC_OBJGETHURT(); } break;

        case MessageID.PACKET_GC_OBJPOSLIST: { packet = new GC_OBJPOSLIST(); } break;

        case MessageID.PACKET_GC_OBJPREPAREFORATTACK: { packet = new GC_OBJPREPAREFORATTACK(); } break;

        case MessageID.PACKET_GC_PLAY_EFFECT: { packet = new GC_PLAY_EFFECT(); } break;

        case MessageID.PACKET_GC_REMOVEEFFECT: { packet = new GC_REMOVEEFFECT(); } break;

        case MessageID.PACKET_GC_RET_USE_SKILL: { packet = new GC_RET_USE_SKILL(); } break;

        case MessageID.PACKET_GC_ROBOT_OPEN: { packet = new GC_ROBOT_OPEN(); } break;

        case MessageID.PACKET_GC_SEND_MARCH: { packet = new GC_SEND_MARCH(); } break;

        case MessageID.PACKET_GC_STOP: { packet = new GC_STOP(); } break;

        case MessageID.PACKET_GC_TELEMOVE: { packet = new GC_TELEMOVE(); } break;

        case MessageID.PACKET_GC_TROOPTRAIN_OVER: { packet = new GC_TroopTrain_Over(); } break;

        case MessageID.PACKET_GC_TROOP_TRAIN: { packet = new GC_Troop_Train(); } break;

        case MessageID.PACKET_GC_UPDATE_ANIMATION_STATE: { packet = new GC_UPDATE_ANIMATION_STATE(); } break;

        case MessageID.PACKET_GC_UPDATE_MARCH: { packet = new GC_Update_March(); } break;

        case MessageID.PACKET_GC_UPDATE_NEEDIMPACTINFO: { packet = new GC_UPDATE_NEEDIMPACTINFO(); } break;

        case MessageID.PACKET_GC_UPDATE_SCENE_INSTACTIVATION: { packet = new GC_UPDATE_SCENE_INSTACTIVATION(); } break;
        }
        if (null != packet)
        {
            packet.packetID = packetID;
        }
        return(packet);
    }
コード例 #6
0
    public static PacketDistributed CreatePacket(MessageID packetID)
    {
        PacketDistributed packet = null;

        switch (packetID)
        {
        case MessageID.PACKET_CG_ABANDONMISSION: { packet = new CG_ABANDONMISSION(); } break;

        case MessageID.PACKET_CG_ACCEPTMISSION: { packet = new CG_ACCEPTMISSION(); } break;

        case MessageID.PACKET_CG_ASK_SETCOMMONFLAG: { packet = new CG_ASK_SETCOMMONFLAG(); } break;

        case MessageID.PACKET_CG_COMPLETEMISSION: { packet = new CG_COMPLETEMISSION(); } break;

        case MessageID.PACKET_CG_CONNECTED_HEARTBEAT: { packet = new CG_CONNECTED_HEARTBEAT(); } break;

        case MessageID.PACKET_CG_CREATEROLE: { packet = new CG_CREATEROLE(); } break;

        case MessageID.PACKET_CG_ENTER_SCENE_OK: { packet = new CG_ENTER_SCENE_OK(); } break;

        case MessageID.PACKET_CG_LOGIN: { packet = new CG_LOGIN(); } break;

        case MessageID.PACKET_CG_MOVE: { packet = new CG_MOVE(); } break;

        case MessageID.PACKET_CG_PING: { packet = new CG_PING(); } break;

        case MessageID.PACKET_CG_REQ_CHANGE_SCENE: { packet = new CG_REQ_CHANGE_SCENE(); } break;

        case MessageID.PACKET_CG_REQ_RANDOMNAME: { packet = new CG_REQ_RANDOMNAME(); } break;

        case MessageID.PACKET_CG_SELECTROLE: { packet = new CG_SELECTROLE(); } break;

        case MessageID.PACKET_CG_SYNC_POS: { packet = new CG_SYNC_POS(); } break;

        case MessageID.PACKET_GC_ABANDONMISSION_RET: { packet = new GC_ABANDONMISSION_RET(); } break;

        case MessageID.PACKET_GC_ACCEPTMISSION_RET: { packet = new GC_ACCEPTMISSION_RET(); } break;

        case MessageID.PACKET_GC_ASK_COMMONFLAG_RET: { packet = new GC_ASK_COMMONFLAG_RET(); } break;

        case MessageID.PACKET_GC_BROADCAST_ATTR: { packet = new GC_BROADCAST_ATTR(); } break;

        case MessageID.PACKET_GC_COMPLETEMISSION_RET: { packet = new GC_COMPLETEMISSION_RET(); } break;

        case MessageID.PACKET_GC_CONNECTED_HEARTBEAT: { packet = new GC_CONNECTED_HEARTBEAT(); } break;

        case MessageID.PACKET_GC_CREATEROLE_RET: { packet = new GC_CREATEROLE_RET(); } break;

        case MessageID.PACKET_GC_CREATE_PLAYER: { packet = new GC_CREATE_PLAYER(); } break;

        case MessageID.PACKET_GC_DELETE_OBJ: { packet = new GC_DELETE_OBJ(); } break;

        case MessageID.PACKET_GC_ENTER_SCENE: { packet = new GC_ENTER_SCENE(); } break;

        case MessageID.PACKET_GC_LOGIN_QUEUE_STATUS: { packet = new GC_LOGIN_QUEUE_STATUS(); } break;

        case MessageID.PACKET_GC_LOGIN_RET: { packet = new GC_LOGIN_RET(); } break;

        case MessageID.PACKET_GC_MISSION_PARAM: { packet = new GC_MISSION_PARAM(); } break;

        case MessageID.PACKET_GC_MISSION_STATE: { packet = new GC_MISSION_STATE(); } break;

        case MessageID.PACKET_GC_MISSION_SYNC_MISSIONLIST: { packet = new GC_MISSION_SYNC_MISSIONLIST(); } break;

        case MessageID.PACKET_GC_MOVE: { packet = new GC_MOVE(); } break;

        case MessageID.PACKET_GC_NOTICE: { packet = new GC_NOTICE(); } break;

        case MessageID.PACKET_GC_RET_PING: { packet = new GC_RET_PING(); } break;

        case MessageID.PACKET_GC_RET_RANDOMNAME: { packet = new GC_RET_RANDOMNAME(); } break;

        case MessageID.PACKET_GC_SELECTROLE_RET: { packet = new GC_SELECTROLE_RET(); } break;

        case MessageID.PACKET_GC_STOP: { packet = new GC_STOP(); } break;

        case MessageID.PACKET_GC_SYNC_COMMONDATA: { packet = new GC_SYNC_COMMONDATA(); } break;

        case MessageID.PACKET_GC_SYNC_COMMONFLAG: { packet = new GC_SYNC_COMMONFLAG(); } break;

        case MessageID.PACKET_GC_SYNC_POS: { packet = new GC_SYNC_POS(); } break;

        case MessageID.PACKET_GC_SYN_ATTR: { packet = new GC_SYN_ATTR(); } break;
        }
        if (null != packet)
        {
            packet.packetID = packetID;
        }
        return(packet);
    }