Ejemplo n.º 1
0
 public static void AddScreen(SystemScreen screen)
 {
     switch (screen)
     {
         case SystemScreen.PauseScreen:
             ScreenManager.activeScreens.Add(ScreenManager.systemScreens[SystemScreen.PauseScreen]);
             ScreenManager.currentScreen = ScreenManager.systemScreens[SystemScreen.PauseScreen];
             ScreenManager.popupCount++;
             ScreenManager.modalCount++;
             break;
     }
 }
Ejemplo n.º 2
0
        public static void AddScreen(GameScreen screen)
        {
            if (ScreenManager.IsInitialized && screen != null && !ScreenManager.activeScreens.Contains(screen))
            {
                screen.Initialize(ScreenManager.GraphicsDevice);
                if (screen.LoadContent())
                {
                    if (screen.IsPopup)
                    {
                        ScreenManager.popupCount++;
                    }

                    if (screen.IsModal)
                    {
                        ScreenManager.modalCount++;
                    }

                    ScreenManager.activeScreens.Add(screen);
                    ScreenManager.currentScreen = screen;
                }
                else
                {
                    System.Console.WriteLine("Error while loading screen {0} of type: {1}", screen.Name, screen.GetType().Name);
                }
            }
        }
Ejemplo n.º 3
0
 public static void PopBackTo(SystemScreen screen)
 {
     switch (screen)
     {
         case SystemScreen.MenuScreen:
             ScreenManager.UnloadContent();
             ScreenManager.CurrentScreen = ScreenManager.systemScreens[SystemScreen.MenuScreen];
             break;
     }
 }
Ejemplo n.º 4
0
        public static void RemoveScreen(string screenName)
        {
            if (screenName == SystemScreen.MenuScreen.ToString())
            {
                if (ScreenManager.Quit != null)
                {
                    ScreenManager.Quit(null, null);
                }
            }
            else
            {
                var screen = ScreenManager.activeScreens.FirstOrDefault(sc => sc.Name == screenName);
                if (screen != null)
                {
                    ScreenManager.activeScreens.Remove(screen);

                    if (screen.IsPopup)
                    {
                        ScreenManager.popupCount--;
                    }

                    if (screen.IsModal)
                    {
                        ScreenManager.modalCount--;
                    }
                }

                ScreenManager.CurrentScreen = ScreenManager.activeScreens.Count == 0 ?
                                                ScreenManager.systemScreens[SystemScreen.MenuScreen] :
                                                ScreenManager.activeScreens[ScreenManager.activeScreens.Count - 1];
            }
        }
Ejemplo n.º 5
0
        public static void Initialize(GraphicsDevice graphicsDev)
        {
            ScreenManager.GraphicsDevice = graphicsDev;
            ScreenManager.IsInitialized = true;

            systemScreens.Add(ScreenManager.AddSystemScreen(SystemScreen.MenuScreen));
            systemScreens.Add(ScreenManager.AddSystemScreen(SystemScreen.PauseScreen));

            ScreenManager.CurrentScreen = ScreenManager.systemScreens[SystemScreen.MenuScreen];
        }