Beispiel #1
0
        public void PopGameScreen()
        {
            if (_instance == null || _screenStack.Count == 1)
            {
                Console.WriteLine("[GameScreenManager]Unable to Deactivate " + _instance.ScreenName());
                return;
            }
            else
            {
                if (DebugFlag)
                {
                    Console.WriteLine("[GameScreenManager]Deactivating Screen: " + _currentScreen.GameScreenName);
                }

                _screenStack.Pop().UnloadContent();
                if (_screenStack.Peek().GameScreenName == "LoadingScreen")
                {
                    _screenStack.Pop().UnloadContent();
                }
                _currentScreen = _instance._screenStack.Peek();
                _currentScreen.Initialize();
                _currentScreen.LoadContent(gameRef.Content);

                if (DebugFlag)
                {
                    Console.WriteLine("[GameScreenManager]Activating Screen: " + _currentScreen.GameScreenName);
                }
            }
        }
Beispiel #2
0
        public void PushGameScreen(GameScreens gameScreen)
        {
            if (_instance == null)
            {
                Console.WriteLine("[GameScreenManager]Manager is not instantiated!");
                return;
            }
            else
            {
                Debug.Assert(!_screenStack.Contains(gameScreen) || gameScreen.GameScreenName != "LoadingScreen", "GameScreen already in the stack... TRY AGAIN!");

                if (_screenStack.Count != 0)
                {
                    _newScreen = gameScreen;
                    _screenStack.Push(Instance._newScreen);
                    _currentScreen.UnloadContent();
                    _newScreen.Initialize();
                    _newScreen.LoadContent(gameRef.Content);
                    _currentScreen = Instance._newScreen;
                }
                else
                {
                    _screenStack.Push(gameScreen);
                    _screenStack.Peek().Initialize();
                    _screenStack.Peek().LoadContent(gameRef.Content);
                }
                if (DebugFlag)
                {
                    Console.WriteLine("[GameScreenManager]Active Screen: " + _currentScreen.GameScreenName);
                }
            }
        }
Beispiel #3
0
 public void ReinitializeBackToSplash(GameScreens Splash)
 {
     while (_instance._screenStack.Count != 0)
     {
         _instance._screenStack.Pop();
     }
     _instance.PushGameScreen(Splash);
 }
Beispiel #4
0
 public GameScreenManager(Game game, GameScreens initialScreen)
     : base(game)
 {
     _screenStack   = new Stack <GameScreens>();
     _currentScreen = initialScreen;
     gameRef        = game;
     TimeVal        = 0f;
     _instance      = this;
 }