Example #1
0
        public void Stop()
        {
            // UnityEngine.Debug.Log("stop..." + m_status);
            if (m_status == CombatRobotStatus.STOP)
            {
                return;
            }
            //  AddTips("stop");
            CmdManager.Instance().Clear();//清空指令
            //取消挂机定时器
            KillTimer(COMBAT_TIMEID);

            if (m_bInCopy)
            {
                RemoveListener(GameEventID.ROBOTCOMBAT_COPYKILLWAVE);
            }

            RemoveListener(GameEventID.SKILLNONESTATE_ENTER);      //播放完技能
            RemoveListener(GameEventID.ROBOTCOMBAT_NEXTCMD);       //技能连招
            RemoveListener(GameEventID.SKILLGUIDE_PROGRESSBREAK);  //技能使用失败
            RemoveListener(GameEventID.JOYSTICK_UNPRESS);          //摇杆松开
            RemoveListener(GameEventID.JOYSTICK_PRESS);            //摇杆按下
            RemoveListener(GameEventID.ENTITYSYSTEM_CREATEENTITY); //物品拾取
            RemoveListener(GameEventID.ENTITYSYSTEM_REMOVEENTITY); //物品拾取

            RemoveListener(GameEventID.SKILLSYSTEM_ADDSKILL);      //技能刷新
            RemoveListener(GameEventID.SKILLSYSTEM_SKILLLISTCHANE);
            RemoveListener(GameEventID.NETWORK_CONNECTE_CLOSE);
            RemoveListener(GameEventID.RECONNECT_SUCESS);
            RemoveListener(GameEventID.SKILLSYSTEM_STIFFTIMEOVER);
            if (m_CombatRobotMono != null)
            {
                m_CombatRobotMono.m_lstLog.Clear();
            }
            m_bInCopy   = false;
            m_nTargetID = 0;

            m_nCopyId           = 0;
            m_nLaskKillWave     = 0;
            m_nLaskMovePosIndex = 0;
            m_nPickItemId       = 0;
            if (m_lstSkills != null)
            {
                m_lstSkills.Clear();
            }

            if (m_dicWaveInfo != null)
            {
                m_dicWaveInfo.Clear();
            }
            ChangeRoleAction(RoleAction.NONE);
            ChangeStatus(CombatRobotStatus.STOP);
            StopMove();
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ROBOTCOMBAT_STOP, null);
        }
Example #2
0
    public void MainPlayStop()
    {
        IPlayer player = ClientGlobal.Instance().MainPlayer;

        if (player != null)
        {
            player.SendMessage(EntityMessage.EntityCommand_StopMove, player.GetPos());
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ROBOTCOMBAT_SEARCHPATH, false); //关闭自动寻路中
        }
        CmdManager.Instance().Clear();                                                                                  //清除寻路
    }
Example #3
0
        //-------------------------------------------------------------------------------------------------------

        /**
         * @brief 用来处理游戏中退回到登录或者选人界面 或者地图时使用
         * @param bFlag 标识是否清理主角 true清理主角
         */
        public void Clear(bool bFlag = false)
        {
            Engine.IRenderSystem renderSys = Engine.RareEngine.Instance().GetRenderSystem();
            if (renderSys != null && bFlag)
            {
                // 设置主Camera
                string         strCameraName = "MainCamera";
                Engine.ICamera cam           = renderSys.GetCamera(ref strCameraName);
                if (cam != null)
                {
                    cam.Enable(false);
                }
            }

            // 停止背景音乐
            Engine.IAudio audio = Engine.RareEngine.Instance().GetAudio();
            if (audio != null && bFlag)
            {
                audio.StopMusic();
            }

            if (bFlag)
            {
                CmdManager.Instance().Clear();
            }
            if (m_ControllerSys != null)
            {
                m_ControllerSys.GetCombatRobot().Stop(true);
            }

            if (MainPlayer != null)
            {
                MainPlayer.SendMessage(EntityMessage.EntityCommand_StopMove, MainPlayer.GetPos());
            }

            if (m_EntitySys != null)
            {
                m_EntitySys.Clear(bFlag);
            }

            if (m_MapSystem != null)
            {
                m_MapSystem.ExitMap();
            }
            MainPlayer = null;

            Engine.RareEngine.Instance().UnloadUnusedResources();
        }
Example #4
0
 private void AddAttackCmd(IEntity target, uint skillid)
 {
     Client.IPlayer player = ControllerSystem.m_ClientGlobal.MainPlayer;
     if (target != null && skillid != 0)
     {
         if (m_CombatRobotMono != null)
         {
             m_CombatRobotMono.AddLog(string.Format("添加攻击命令 技能id:{0} {1}", skillid, UnityEngine.Time.realtimeSinceStartup));
         }
         CmdManager.Instance().AddCmd(Cmd.Attack, player.GetUID(), target.GetUID(), skillid);
     }
     else
     {
         ChangeRoleAction(RoleAction.NONE);
     }
 }
Example #5
0
        private void DoAttack()
        {
            Profiler.BeginSample("CombatRobot_DoAttack");

            if (!CmdManager.Instance().IsMoving() || !IsMoving())
            {
                IEntity target = null;
                if (TryGetCurrTarget(out target)) //如果当前有攻击目标
                {
                    uint skillid = GetNextSkillID();
                    if (skillid != 0 && m_skillPart.IsSkillCanUse(skillid))
                    {
                        AddAttackCmd(target, skillid);
                    }
                    else
                    {
                        ChangeRoleAction(RoleAction.NONE);
                        //  AddTips(string.Format("CombatRobot_DoAttack 技能{0} 不可使用 {1}", skillid, UnityEngine.Time.realtimeSinceStartup));
                    }
                }
                else //寻找目标开始攻击(如果没有可以捡的物品前提下)
                {
                    if (TryPickUpNow() == false)
                    {
                        FindMonsterAddAttack();
                    }
                    else
                    {
                        ChangeRoleAction(RoleAction.PICKUPITEM);
                        DoNextCMD();
                    }
                }
            }
            else
            {
                // AddTips("移动不能攻击");
                //StopMove();
                //                 if (m_RoleAction == RoleAction.USESKILL)
                //                 {
                //
                //                 }
                //ChangeRoleAction(RoleAction.NONE);
            }
            Profiler.EndSample();
        }
Example #6
0
        private void OnPause(bool bShowTip)
        {
            if (m_status == CombatRobotStatus.PAUSE)
            {
                return;
            }

            ChangeStatus(CombatRobotStatus.PAUSE);
            ChangeRoleAction(RoleAction.NONE);
            if (bShowTip)
            {
                Client.ITipsManager tip = ControllerSystem.m_ClientGlobal.GetTipsManager();
                if (tip != null)
                {
                    tip.ShowTipsById(701);
                }
            }
            CmdManager.Instance().Clear();//清空指令
            RemoveListener(GameEventID.SKILLINFO_REFRESH);
            RemoveListener(GameEventID.SKILLNONESTATE_ENTER);
            RemoveListener(GameEventID.ROBOTCOMBAT_NEXTCMD);
        }
Example #7
0
    void ClearCopyData()
    {
        //退出副本
        stExitCopyUserCmd_CS cmd = new stExitCopyUserCmd_CS()
        {
            copy_base_id = 0
        };

        Client.IMapSystem mapsys = ClientGlobal.Instance().GetMapSystem();
        if (mapsys != null)
        {
            mapsys.SetEnterZoneCallback(null);
        }

        ICopy copy = GetCopyByCopyID(m_uEnterCopyID);

        if (copy != null)
        {
            copy.ExitCopy();
        }

        m_uEnterCopyID      = 0;
        m_nLastKillWave     = 0;
        m_nLastTransmitWave = 0;
        m_dicEnterZoneStatus.Clear();
        m_dicSendEnterZoneTime.Clear();

        this.CopyCDAndExitData = null;

        //清副本目标数据
        CleanCopyTargetData();

        stCopyInfo info = new stCopyInfo();

        info.bShow = false;
        DataManager.Manager <UIPanelManager>().SendMsg(PanelID.MainPanel, UIMsgID.eShowCopyInfo, info);

        if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.MissionAndTeamPanel))
        {
            DataManager.Manager <UIPanelManager>().SendMsg(PanelID.MissionAndTeamPanel, UIMsgID.eCopyExit, null);
        }

        Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.COMBOT_ENTER_EXIT, new Client.stCombotCopy()
        {
            copyid = cmd.copy_base_id, exit = true
        });

        IControllerSystem cs = ClientGlobal.Instance().GetControllerSystem();

        if (cs == null)
        {
            Engine.Utility.Log.Error("ExecuteCmd: ControllerSystem is null");
            return;
        }

        if (cs.GetCombatRobot().Status != CombatRobotStatus.STOP)
        {
            cs.GetCombatRobot().Stop();
        }

        IPlayer player = ClientGlobal.Instance().MainPlayer;

        if (player != null)
        {
            player.SendMessage(EntityMessage.EntityCommand_StopMove, player.GetPos());
            CmdManager.Instance().Clear();//清除寻路
        }

        //退出副本标志
        m_bIsEnterCopy = false;
    }