Exemplo n.º 1
0
    void OnPlayerStopMove(ref Client.stEntityStopMove stopEntity, int nEventId)
    {
        if (curTreasureMap == null)
        {
            return;
        }
        Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ROBOTCOMBAT_SEARCHPATH, false);
        Vector3 mainPos = Client.ClientGlobal.Instance().MainPlayer.GetPos();

        if (mainPos.x == curTreasureMap.TargetPosition.x && mainPos.z == -curTreasureMap.TargetPosition.y)
        {
            if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.MainUsePanel))
            {
                return;
            }
            if (arriveTargetStopMove)
            {
                return;
            }
            MainUsePanelData mainUsePanelData = new MainUsePanelData();
            mainUsePanelData.type    = 2;
            mainUsePanelData.Id      = curTreasureMap.BaseId;
            mainUsePanelData.onClick = MainUsePanelItemOnClick;
            DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.MainUsePanel, data: mainUsePanelData);
            arriveTargetStopMove = true;
        }
    }
Exemplo n.º 2
0
    //string GetMapXmlName()
    //{
    //    IMapSystem ms = Client.ClientGlobal.Instance().GetMapSystem();
    //    if ( ms != null )
    //    {
    //        uint mapID = ms.GetMapID();
    //        table.MapDataBase mapDB = GameTableManager.Instance.GetTableItem<table.MapDataBase>( mapID );
    //        if ( mapDB == null )
    //        {
    //            Engine.Utility.Log.Error( "MapSystem:找不到地图配置数据{0}" , mapID );
    //            return null;
    //        }

    //        return mapDB.miniMapInfo;
    //    }
    //    return null;
    //}
    void OnEvent(int eventID, object param)
    {
        if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_ENTERMAP)
        {
            InitNpcDic();
            BigMapPanel panel = DataManager.Manager <UIPanelManager>().GetPanel(PanelID.BigMapPanel) as BigMapPanel;
            if (panel != null)
            {
                panel.ClearScrollItem();
            }
        }
        else if (eventID == (int)GameEventID.ENTITYSYSTEM_LEAVEMAP)
        {
            //  DataManager.Manager<UIPanelManager>().HidePanel(PanelID.MiniMapPanel, needDestroy: true);
        }
        else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE)
        {
            if (bDoMoving)
            {
                Client.stEntityStopMove stopEntity = (Client.stEntityStopMove)param;
                if (stopEntity.uid == MainPlayerHelper.GetPlayerUID())
                {
                    BigMapPanel panel = DataManager.Manager <UIPanelManager>().GetPanel(PanelID.BigMapPanel) as BigMapPanel;
                    if (panel != null)
                    {
                        panel.ClearIcon();
                    }
                    bDoMoving = false;
                    Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ROBOTCOMBAT_SEARCHPATH, false);
                }
            }
        }
    }
Exemplo n.º 3
0
 void OnEvent(int nEventId, object param)
 {
     Client.GameEventID eid = (Client.GameEventID)nEventId;
     if (eid == Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE)
     {
         Client.stEntityStopMove stopEntity = (Client.stEntityStopMove)param;
         OnPlayerStopMove(ref stopEntity, nEventId);
         return;
     }
 }
Exemplo n.º 4
0
        public override void OnEvent(int nEventID, object param)
        {
            IEntity casetr = skillPart.GetMaster();

            if (casetr == null)
            {
                return;
            }

            if (nEventID == (int)Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE)
            {
                Client.stEntityStopMove stopEntity = (Client.stEntityStopMove)param;
                if (m_skillDatabase != null && stopEntity.uid == skillPart.GetMaster().GetUID())
                {
                    if (m_skillDatabase.dwMoveType == (uint)SkillMoveType.FastMove) // 冲锋类技能
                    {
                        PlayerSkillPart playerSkill = skillPart as PlayerSkillPart;
                        if (playerSkill != null)
                        {
                            if (playerSkill.gotoPos != Vector3.zero)
                            {
                                playerSkill.Master.SendMessage(EntityMessage.EntityCommand_SetPos, (object)playerSkill.gotoPos);
                                Client.IEntity target = playerSkill.SkillTarget;
                                if (target != null)
                                {
                                    if (m_skillDatabase.targetType != (int)SkillTargetType.TargetForwardPoint)
                                    {
                                        playerSkill.Master.SendMessage(EntityMessage.EntityCommand_LookTarget, target.GetPos());
                                    }
                                }
                            }
                        }

                        m_Statemachine.ChangeState((int)SkillState.Over, null);
                        // 接冲锋动作后半段
                        //PlayAni anim_param = new PlayAni();
                        //string strAniName = m_caster.GetAniState().name;
                        //anim_param.strAcionName = strAniName + "_Over";
                        //anim_param.fSpeed = 1;
                        //anim_param.nStartFrame = 0;
                        //anim_param.nLoop = 1;
                        //anim_param.fBlendTime = 0.2f;
                        //anim_param.aniCallback = OnAnimationPlayEnd;
                        //anim_param.callbackParam = casetr.GetUID();
                        //// 播放攻击动作
                        //playerSkill.Player.SendMessage( EntityMessage.EntityCommand_PlayAni , anim_param );
                    }
                }
            }
            else if (nEventID == (int)Client.GameEventID.ENTITYSYSTEM_ENTITYBEGINMOVE)
            {
                // 攻击状态中收到移动事件,则切换到OVer状态
            }
        }
Exemplo n.º 5
0
 public void OnContrllerEvent(int nEventID, object param)
 {
     if (m_Host == null)
     {
         Engine.Utility.Log.Error("MoveController.OnContrllerEvent: host is null");
         return;
     }
     if (nEventID == (int)Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE)
     {
         Client.stEntityStopMove stopEntity = (Client.stEntityStopMove)param;
         if (m_bJoystick && stopEntity.uid == m_Host.GetUID() && !stopEntity.bExternal) // 自行移动停止才需要继续向前预测
         {
             // 继续向前预测
             MoveByDir(m_fCalcRotate);
         }
     }
     else if (nEventID == (int)Client.GameEventID.SKLL_LONGPRESS)
     {
         stSkillLongPress st = (stSkillLongPress)param;
         m_bSkillLongPress = st.bLongPress;
     }
     else if (nEventID == (int)Client.GameEventID.ENTITYSYSTEM_ENTITYDEAD)
     {
         stEntityDead ed = (stEntityDead)param;
         if (m_ClientGlobal.IsMainPlayer(ed.uid))
         {
             m_bJoystick = false;
             m_Host.SendMessage(EntityMessage.EntityCommand_StopMove, m_ClientGlobal.MainPlayer.GetPos());
         }
     }
     else if (nEventID == (int)Client.GameEventID.SKILL_FORBIDDENJOYSTICK)
     {
         Client.stForbiddenJoystick info   = (Client.stForbiddenJoystick)param;
         Client.IPlayer             player = m_ClientGlobal.MainPlayer;
         if (player == null)
         {
             return;
         }
         if (info.playerID == player.GetUID())
         {
             //bForbiddenJoystick = info.bFobidden;
             //if(bForbiddenJoystick)
             //{
             //   // Log.LogGroup( "ZDY" , "摇杆禁用" );
             //}
             //else
             //{
             //  //  Log.LogGroup( "ZDY" , "摇杆回复" );
             //}
         }
     }
 }
Exemplo n.º 6
0
        private object ForceStopMove(object param)
        {
            if (m_Owner == null)
            {
                return(null);
            }

            if (param != null)
            {
                Vector3 pos = (Vector3)param;

                m_Owner.SendMessage(EntityMessage.EntityCommand_SetPos, pos);

                // 切换到Normal状态
                Creature owner = m_Owner as Creature;
                if (owner != null)
                {
                    if (!m_bIgnoreMoveAction && !owner.IsDead())
                    {
                        if (m_param != null)
                        {
                            owner.ChangeState(CreatureState.Normal, (object)(m_param.m_ignoreStand?1:0));
                        }
                        else
                        {
                            owner.ChangeState(CreatureState.Normal);
                        }
                    }
                }
                else
                {
                    m_Owner.PlayAction(EntityAction.Stand, 0, m_fSpeedFact);
                }
            }

            if (m_Owner.GetEntityCallback() != null)
            {
                m_Owner.GetEntityCallback().OnMoveEnd(m_Owner, m_param.param);
            }

            m_LastTime = 0;

            // 强制同步
            SyncPos();  // 不需要同步主角位置

            Client.stEntityStopMove stopEntity = new Client.stEntityStopMove();
            stopEntity.uid = m_Owner.GetUID();

            m_vSpeed     = Vector3.zero;
            m_nPathIndex = -1;
            if (m_param != null)
            {
                m_param.m_speed = 0;
            }
            m_bMoving   = false;
            m_hasTarget = false;

            Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE, stopEntity);

            return(null);
        }
Exemplo n.º 7
0
        private object StopMove(object param)
        {
            if (m_Owner == null)
            {
                return(null);
            }

            Client.IMapSystem mapSys = EntitySystem.m_ClientGlobal.GetMapSystem();
            if (mapSys == null)
            {
                return(null);
            }

            if (param != null)
            {
                Vector3 pos = (Vector3)param;

                if (m_bMoving)
                {
                    m_param.m_speed = m_Owner.GetProp((int)WorldObjProp.MoveSpeed) * EntityConst.MOVE_SPEED_RATE;
                    m_vSpeed        = (m_param.m_speed * m_fSpeedFact * m_fSpeedTerrainFact) * m_dir;

                    long    nCurTime = Engine.Utility.TimeHelper.GetTickCount();
                    Vector3 ds       = m_vSpeed * ((nCurTime - m_LastTime) * 0.001f);
                    pos          = m_vLastPos + ds;
                    m_fDistance += ds.magnitude;
                    m_LastTime   = nCurTime;

                    if (EntitySystem.m_ClientGlobal.IsMainPlayer(m_Owner))
                    {
                        m_uServerTime = EntityConfig.serverTime;
                    }
                }

                // 停止时如果是阻挡点客户端做一下修正 目前的同步方案可能会和服务器之间不同步 测试再看效果
                if (!mapSys.CanWalk(pos))
                {
                    pos = m_lastWalkPos;
                }

                m_Owner.SendMessage(EntityMessage.EntityCommand_SetPos, pos);

                m_LastTime = Engine.Utility.TimeHelper.GetTickCount();
                //Engine.Utility.Log.Error("Move stop: ({0},{1}) {2} {3} speed:{4}", pos.x, pos.z, m_LastTime, m_fDistance, m_fDistance / (m_LastTime - m_BeginTime));

                // 切换到Normal状态
                Creature owner = m_Owner as Creature;
                if (owner != null)
                {
                    if (!m_bIgnoreMoveAction && !owner.IsDead())
                    {
                        if (m_param != null)
                        {
                            owner.ChangeState(CreatureState.Normal, (object)(m_param.m_ignoreStand?1:0));
                        }
                        else
                        {
                            owner.ChangeState(CreatureState.Normal);
                        }
                    }
                }
                else
                {
                    m_Owner.PlayAction(EntityAction.Stand, 0, m_fSpeedFact);
                }
            }

            m_LastTime = 0;

            // 强制同步
            SyncPos(true);  // 停止同步

            Client.stEntityStopMove stopEntity = new Client.stEntityStopMove();
            stopEntity.uid       = m_Owner.GetUID();
            stopEntity.bExternal = m_bExternalStop;

            m_vSpeed     = Vector3.zero;
            m_nPathIndex = -1;
            if (m_param != null)
            {
                m_param.m_speed = 0;
            }
            m_bMoving   = false;
            m_hasTarget = false;
            //Engine.Utility.TimerAxis.Instance().KillTimer(0, this);
            if (m_Owner.GetEntityCallback() != null && m_param != null)
            {
                m_Owner.GetEntityCallback().OnMoveEnd(m_Owner, m_param.param);
            }
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE, stopEntity);

            return(null);
        }
Exemplo n.º 8
0
    void OnEvent(int nEventId, object param)
    {
        Client.GameEventID eid = (Client.GameEventID)nEventId;
        if (eid == Client.GameEventID.TASK_ACCEPT)
        {
            uint nTaskID = (uint)param;
            OnTaskAccept(nTaskID);
            return;
        }
        else if (eid == Client.GameEventID.TASK_CANSUBMIT)
        {
            Client.stTaskCanSubmit cs = (Client.stTaskCanSubmit)param;
            OnTaskCanCommit(cs.taskid);
        }
        else if (eid == Client.GameEventID.TASK_DONE)
        {
            Client.stTaskDone td = (Client.stTaskDone)param;
            OnTaskDone(td.taskid);
        }
        else if (eid == Client.GameEventID.TASK_DONING)
        {
            Client.stDoingTask dt = (Client.stDoingTask)param;
            DataManager.Manager <TaskDataManager>().DoingTaskID = dt.taskid;
            OnExecuteTask(dt.taskid);
        }
        else if (eid == Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE)
        {
            Client.stEntityStopMove stopEntity = (Client.stEntityStopMove)param;
            OnPlayerStopMove(ref stopEntity, nEventId);
            return;
        }
        else if (eid == Client.GameEventID.SKILLNONESTATE_ENTER)
        {
            Client.stSkillStateEnter sse = (Client.stSkillStateEnter)param;
            OnSkillPlayOver(ref sse, nEventId);
            return;
        }
        else if (eid == Client.GameEventID.ENTITYSYSTEM_CHANGE)
        {
            Client.stPlayerChange pc = (Client.stPlayerChange)param;

            if (!Client.ClientGlobal.Instance().IsMainPlayer(pc.uid))
            {
                return;
            }
            Engine.Utility.EventEngine.Instance().RemoveEventListener(nEventId, OnEvent);
            QuestTraceInfo questInfo = QuestTranceManager.Instance.GetQuestTraceInfo(m_nDoingTaskID);
            if (questInfo == null)
            {
                return;
            }
            m_bAddChangeListener = false;
            Engine.Utility.Log.Info("{0} 变身完毕 执行任务{1}", TAG, m_nDoingTaskID);
            ProcessTask(questInfo);
            m_nDoingTaskID = 0;
        }
        else if (eid == Client.GameEventID.ENTITYSYSTEM_RESTORE)
        {
            Client.stPlayerChange pc = (Client.stPlayerChange)param;
            if (!Client.ClientGlobal.Instance().IsMainPlayer(pc.uid))
            {
                return;
            }
            Engine.Utility.EventEngine.Instance().RemoveEventListener(nEventId, OnEvent);
            Engine.Utility.Log.Info("{0}变身回来 执行任务{1}", TAG, m_nDoingTaskID);
            OnTaskDone(m_nDoingTaskID);
            m_nDoingTaskID        = 0;
            m_bAddRestoreListener = false;
        }
    }
Exemplo n.º 9
0
    private void OnPlayerStopMove(ref Client.stEntityStopMove stopEntity, int nEventId)
    {
        if (!Client.ClientGlobal.Instance().IsMainPlayer(stopEntity.uid))
        {
            return;
        }

        if (m_nDoingTaskID == 0)
        {
            Engine.Utility.EventEngine.Instance().RemoveEventListener(nEventId, OnEvent);
            m_bAddStopMoveListener = false;
            return;
        }

        QuestTraceInfo questInfo = QuestTranceManager.Instance.GetQuestTraceInfo(m_nDoingTaskID);

        if (questInfo == null)
        {
            Engine.Utility.EventEngine.Instance().RemoveEventListener(nEventId, OnEvent);
            m_bAddStopMoveListener = false;
            return;
        }

        if (EqualsMapID(questInfo.QuestTable.destMapID))
        {
            Engine.Utility.EventEngine.Instance().RemoveEventListener(nEventId, OnEvent);
            m_bAddStopMoveListener = false;

            uint    npcid;
            Vector2 pos;
            if (questInfo.IsKillMonster(out npcid))
            {
                Client.IMapSystem ms = Client.ClientGlobal.Instance().GetMapSystem();
                if (ms.GetClienNpcPos((int)npcid, out pos))
                {
                    UnityEngine.Vector3 mainPos = Client.ClientGlobal.Instance().MainPlayer.GetPos();
                    if (mainPos.x == pos.x && mainPos.z == -pos.y)
                    {
                        Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem();
                        if (cs != null)
                        {
                            cs.GetCombatRobot().StartWithTarget((int)npcid);
                            Engine.Utility.Log.LogGroup("ZCX", "挂机杀怪物{0}", npcid);
                        }
                    }
                }
            }
            else if (questInfo.IsMoveToTargetPos(out pos))
            {
                Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ROBOTCOMBAT_SEARCHPATH, false);

                UnityEngine.Vector3 mainPos = Client.ClientGlobal.Instance().MainPlayer.GetPos();
                if (mainPos.x == pos.x && mainPos.z == -pos.y)
                {
                    if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.MainUsePanel))
                    {
                        return;
                    }

                    MainUsePanelData mainUsePanelData = new MainUsePanelData();
                    mainUsePanelData.type    = 2; //  type = 2为item
                    mainUsePanelData.Id      = questInfo.QuestTable.usecommitItemID;
                    mainUsePanelData.onClick = MainUsePanelItemOnClick;

                    this.usecommitItemID = questInfo.QuestTable.usecommitItemID;

                    DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.MainUsePanel, data: mainUsePanelData);

                    // DataManager.Manager<UIPanelManager>().ShowPanel(PanelID.MainUsePanel, data: questInfo.QuestTable.usecommitItemID);
                }
            }
        }
    }
Exemplo n.º 10
0
 void OnEvent(int nEvent, object param)
 {
     Client.GameEventID ge = (Client.GameEventID)nEvent;
     if (ge == Client.GameEventID.TASK_DONING || ge == GameEventID.UIEVENTGUIDESHOWOUT || ge == GameEventID.SKILLSYSTEM_USESKILL)
     {
         ResetArrow();
         KillTimer();
     }
     else if (ge == GameEventID.STORY_PLAY_OVER)
     {
         ShowArrow();
     }
     else if (ge == GameEventID.ENTITYSYSTEM_ENTITYBEGINMOVE)
     {
         stEntityBeginMove move = (stEntityBeginMove)param;
         if (Client.ClientGlobal.Instance().IsMainPlayer(move.uid))
         {
             ResetArrow();
             KillTimer();
         }
     }
     else if (ge == GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE)
     {
         Client.stEntityStopMove stopEntity = (Client.stEntityStopMove)param;
         if (ClientGlobal.Instance().IsMainPlayer(stopEntity.uid))
         {
             if (CheckCondition())
             {
                 SetTime();
             }
         }
     }
     else if (ge == Client.GameEventID.UIEVENT_PANELFOCUSSTATUSCHANGED)
     {
         UIPanelManager.PanelFocusData fdata = (UIPanelManager.PanelFocusData)param;
         if (fdata.ID == PanelID.MissionAndTeamPanel)
         {
             if (fdata.GetFocus)
             {
                 if (CheckCondition())
                 {
                     SetTime();
                 }
             }
             else
             {
                 ResetArrow();
                 KillTimer();
             }
         }
     }
     else if (ge == Client.GameEventID.ENTITYSYSTEM_PROPUPDATE)
     {
         Client.stPropUpdate prop = (Client.stPropUpdate)param;
         if (Client.ClientGlobal.Instance().IsMainPlayer(prop.uid))
         {
             if (m_nignoreLevel <= MainPlayerHelper.GetPlayerLevel())
             {
                 RegisterEvent(false);
                 ResetArrow();
                 KillTimer();
             }
         }
     }
     else if (ge == GameEventID.SKILLNONESTATE_ENTER)
     {
         stSkillStateEnter state = (stSkillStateEnter)param;
         if (ClientGlobal.Instance().IsMainPlayer(state.uid))
         {
             if (CheckCondition())
             {
                 SetTime();
             }
         }
     }
     else if (ge == Client.GameEventID.COMBOT_ENTER_EXIT)
     {
         stCombotCopy cc = (stCombotCopy)param;
         if (cc.exit)
         {
             if (CheckCondition())
             {
                 SetTime();
             }
         }
         else if (cc.enter)
         {
             ResetArrow();
             KillTimer();
         }
     }
     else if (ge == GameEventID.SKILLGUIDE_PROGRESSSTART)
     {
         ResetArrow();
         KillTimer();
     }
     else if (ge == GameEventID.SKILLGUIDE_PROGRESSEND)
     {
         if (CheckCondition())
         {
             SetTime();
         }
     }
     else if (ge == Client.GameEventID.TASK_MAIN_ARROWHIDE)
     {
         ResetArrow();
         KillTimer();
     }
     else if (ge == Client.GameEventID.UIEVENTGUIDECOMPLETE || ge == Client.GameEventID.UIEVENTGUIDESKIP)
     {
         if (CheckCondition())
         {
             SetTime();
         }
     }
 }