示例#1
0
        public void SetNewScreen(Screen screen, bool disposeOld)
        {
            // don't switch to the new screen immediately if the user
            // is currently looking at a warning dialog.
            if (activeScreen is WarningScreen)
            {
                WarningScreen warning = (WarningScreen)activeScreen;
                if (warning.lastScreen != null)
                {
                    warning.lastScreen.Dispose();
                }

                warning.lastScreen = screen;
                if (warning.lastScreen != null)
                {
                    screen.Init();
                }
                return;
            }
            InputHandler.ScreenChanged(activeScreen, screen);
            if (activeScreen != null && disposeOld)
            {
                activeScreen.Dispose();
            }

            if (screen == null)
            {
                hudScreen.GainFocus();
            }
            else if (activeScreen == null)
            {
                hudScreen.LoseFocus();
            }

            if (screen != null)
            {
                screen.Init();
            }
            activeScreen = screen;
        }
示例#2
0
        public void SetNewScreen(Screen screen, bool disposeOld)
        {
            InputHandler.ScreenChanged(activeScreen, screen);
            if (activeScreen != null && disposeOld)
            {
                activeScreen.Dispose();
            }

            if (screen == null)
            {
                hudScreen.GainFocus();
            }
            else if (activeScreen == null)
            {
                hudScreen.LoseFocus();
            }

            if (screen != null)
            {
                screen.Init();
            }
            activeScreen = screen;
        }