Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Dispose method of my Application Core
- #region Dispose
- /// <summary>
- ///
- /// </summary>
- public virtual void Dispose()
- {
- if (this.mIsDisposed)
- return;
- //Disposing Cohesion Managers and Components
- this.mRegisteredLocationStructures.Clear();
- Log cohesionLog = LogManager.Instance.GetLog(LOGFILE);
- cohesionLog.MessageLogged -= LogConsole.Instance.MessageLogged;
- this.CleanUpScene();
- //Dispose all Managers, using inverse priority order
- if (this.mManagers != null)
- {
- for (int i = this.mManagers.Count - 1; i >= 0; i--)
- this.mManagers[this.mManagers.Keys[i]].Dispose();
- this.mManagers.Clear();
- this.mManagers = null;
- }
- //Disposing Axiom Engine
- if (Root.Instance != null)
- {
- // remove event handlers
- Root.Instance.FrameStarted -= this.OnFrameStartedDo;
- Root.Instance.FrameEnded -= this.OnFrameEndedDo;
- Root.Instance.FrameRenderingQueued -= this.OnFrameRenderingQueuedDo;
- }
- this.Platform.ShutDown();
- if (Root.Instance != null)
- Root.Instance.RenderSystem.DetachRenderTarget(this.RenderWindow);
- #if !( XBOX || XBOX360 )
- WindowEventMonitor.Instance.UnregisterListener(this.RenderWindow, this.mWindowListener);
- this.mWindowListener = null;
- #endif
- if (this.RenderWindow != null)
- {
- if (!this.RenderWindow.IsDisposed)
- this.RenderWindow.Dispose();
- this.RenderWindow = null;
- }
- if (Root.Instance!= null)
- Root.Instance.Dispose();
- this.mIsDisposed = true;
- }
- #endregion
- //Here it is the CleanUpScene method implementation
- #region CleanUpScene (private)
- /// <summary>
- ///
- /// </summary>
- internal void CleanUpScene()
- {
- if (this.SceneManager == null)
- return;
- this.SceneManager.RemoveAllBillboardSets();
- CameraManager.Instance.RemoveAllCameras();
- this.SceneManager.RemoveAllEntities();
- this.SceneManager.RemoveAllLights();
- this.SceneManager.RemoveAllRibonTrails();
- //this.SceneManager.DestroyAllAnimations(); task accomplished by ClearScene
- this.SceneManager.DestroyAllAnimationStates();
- //this.SceneManager.DestroyAllMovableObjects(); task accomplished by ClearScene
- //this.SceneManager.DestroyAllOverlays(); //not done 'cause it will remove overlays of debugpanel that cannot be removed XD
- this.SceneManager.DestroyAllStaticGeometry();
- this.SceneManager.ClearScene();
- }
- #endregion CleanUpScene (private)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement