示例#1
0
        /// <inheritdoc/>
        protected override void OnClose()
        {
            // Shutdown GUI system
            _dialogRenderer?.Dispose();
            _guiManager?.Dispose();

            base.OnClose();
        }
示例#2
0
        void IDisposable.Dispose()
        {
            lock (syncRoot)
            {
                if (root != null)
                {
                    root.Dispose();
                    window.Dispose();

                    window = null;
                    root   = null;
                }
            }
        }
示例#3
0
 protected override void Dispose(bool disposing)
 {
     try
     {
         if (disposing)
         {
             if (_guiManager != null)
             {
                 _guiManager.Dispose();
             }
         }
     }
     finally
     {
         base.Dispose(disposing);
     }
 }
示例#4
0
 public void Dispose()
 {
     Gui.Dispose();
 }
示例#5
0
        public void ChangeState(int state)
        {
            //Title screen state
            if (state == GameCore.STATE_TITLE)
            {
                UnloadGame();
                GameState = GameCore.STATE_TITLE;
                if (highScoresGui != null)
                {
                    highScoresGui.Dispose();
                }
                titleGui = GuiFactory.CreateTitleGui(this, titleGui, inputManager);
            }
            //Play the game state
            else if (state == GameCore.STATE_GAME)
            {
                LoadGame();
                GameState = GameCore.STATE_GAME;
                titleGui.Dispose();
            }
            //Show the high scores state
            else if (state == GameCore.STATE_SCORES)
            {
                UnloadGame();
                GameState = GameCore.STATE_SCORES;
                titleGui.Dispose();
                if (inputHighScoreGui != null)
                {
                    inputHighScoreGui.Dispose();
                }
                highScoresGui = GuiFactory.CreateHighScoresGui(this, highScoresGui, inputManager);
                SortHighScores();
            }
            //Game over state
            else if (state == GameCore.STATE_GAMEOVER)
            {
                score = World.Score;
                UnloadGame();
                var addTo = false;
                foreach (HighScore scoreData in HighScoreData)
                {
                    if (score > scoreData.Score)
                    {
                        addTo = true;
                        break;
                    }
                }
                if (HighScoreData.Count < 10)
                {
                    addTo = true;
                }
                if (addTo)
                {
                    ChangeState(GameCore.STATE_INPUTSCORE);
                }
                else
                {
                    ChangeState(GameCore.STATE_SCORES);
                }
            }

            else if (state == GameCore.STATE_INPUTSCORE)
            {
                GameState         = GameCore.STATE_INPUTSCORE;
                inputHighScoreGui = GuiFactory.CreateInputHighScoreGui(this, inputHighScoreGui, inputManager);
            }
        }