/// <summary>
        /// Restarts the game.
        /// </summary>
        public void RestartGame()
        {
            Logger.Log("Restarting game.");

#if !XNA
            // MonoGame takes ages to unload assets compared to XNA; sometimes MonoGame
            // can take over 8 seconds while XNA takes only 1 second
            // This is a bit dirty, but at least it makes the MonoGame build exit quicker
            GameClosing?.Invoke(this, EventArgs.Empty);
            // TODO move Windows-specific functionality
            Application.DoEvents();
            Process.Start(Application.ExecutablePath);
            Environment.Exit(0);
#else
            Application.Restart();
#endif
        }
 private void GameWindowManager_GameWindowClosing(object sender, EventArgs e)
 {
     GameClosing?.Invoke(this, EventArgs.Empty);
 }
Example #3
0
 private void FireGameClosing()
 {
     GameClosing?.Invoke(this, new GameClosingEventArgs(this));
 }
 /// <summary>
 /// Closes the game.
 /// </summary>
 public void CloseGame()
 {
     GameClosing?.Invoke(this, EventArgs.Empty);
     Game.Exit();
 }
Example #5
0
 //exit game
 public void closeGame()
 {
     GameClosing.Invoke(this, null);
 }