예제 #1
0
 /// <summary>
 ///   Switches to another screen.
 /// </summary>
 /// <param name="switchTo">The screen to switch to.</param>
 public static void SwitchScreen(Screen switchTo)
 {
     if (screens.Search(switchTo) != null)
     {
         activeScreen.Stop();
         switchTo.LoadContent();
         activeScreen = switchTo;
         activeScreen.Start();
     }
     else
     {
         throw new ArgumentException("ScreenManager.SwitchScreen(Screen): The screen to switch to was not present in the manager. Please use the AddScreen(Screen, string) method to add it first.");
     }
 }
예제 #2
0
 /// <summary>
 ///   Sets the highest screen in the hierarchy. This screen has no owner.
 /// </summary>
 /// <param name="screen">The screen to set as root.</param>
 /// <param name="parameters">
 ///   Parameters that are used to determine certain settings of a screen.
 ///   Varies by screen; check the documentation.
 /// </param>
 public static void SetRootScreen(Screen screen, string parameters)
 {
     screens.Data = screen;
     activeScreen = screen;
     activeScreen.Initialize(null, parameters);
     activeScreen.Start();
 }