Exemple #1
0
        private static GameScreen AddSystemScreen(SystemScreen screenType)
        {
            GameScreen systemScreen = null;
            GameScreen tempScreen = null;
            try
            {
                switch (screenType)
                {
                    case SystemScreen.MenuScreen:
                        tempScreen = new MenuScreen();
                        break;

                    case SystemScreen.PauseScreen:
                        tempScreen = new PauseScreen();
                        break;
                }

                tempScreen.Initialize(ScreenManager.GraphicsDevice);
                tempScreen.LoadContent();
                systemScreen = tempScreen;
                tempScreen = null;
            }
            finally
            {
                if (tempScreen != null)
                {
                    tempScreen.Dispose();
                }
            }

            return systemScreen;
        }