//------------------------------------------------------------------------------------------------------- /** * @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(); }
protected override void OnHide() { ResetSelectRole(); if (m_scene_obj) { if (m_Avater != null) { m_Avater.Destroy(); m_Avater = null; } } Engine.IAudio audio = Engine.RareEngine.Instance().GetAudio(); if (audio != null) { audio.StopMusic(); } }