Exemplo n.º 1
0
 private void KillLast()
 {
     if (Instance == null)
     {
         return;
     }
     if (IsMusic)
     {
         MusicInstance.Stop();
         MusicInstance.Dispose();
     }
     else
     {
         Instance.Stop();
         Instance.Dispose();
     }
     Instance      = null;
     MusicInstance = null;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Stop all services and dispose of them. This should be called once before the game
        /// exits. It can be called repeatedly to destroy re-created resources.
        /// </summary>
        public static void StopAllServices()
        {
            try
            {
                Game.Dispose();
            }
            catch (Exception) { }
            finally
            {
                Game = null;
            }

            try
            {
                Resources.Dispose();
            }
            catch (Exception) { }
            finally
            {
                Resources = null;
            }

            StateManager = null;
            try
            {
                Echelon.Dispose();
            }
            catch (Exception) { }
            finally
            {
                Echelon = null;
            }

            try
            {
                Theater.Dispose();
            }
            catch (Exception) { }
            finally
            {
                Theater = null;
            }

            try
            {
                AudioManager.Dispose();
            }
            catch (Exception) { }
            finally
            {
                AudioManager = null;
            }

            try
            {
                MP3Player.Dispose();
            }
            catch (Exception) { }
            finally
            {
                MP3Player = null;
            }

            try
            {
                Logger.Close();
            }
            catch (Exception) { }
            finally
            {
                Logger = null;
            }
        }