/// <summary> /// Activates target subscreen /// </summary> /// <param id="screen">Screen id</param> /// <param id="screenParams">Parameters passed to the new screen OnActivate method</param> public void CallSubscreen(string screen, params object[] screenParams) { if (activeSubscreen != null) { activeSubscreen.OnDeactivate(); } activeSubscreen = screens[screen]; activeSubscreen.OnActivate(screenParams); }
/// <summary> /// Updates the active screen and active subscreen, /// </summary> public void Update() { if (activeScreen == null) { activeScreen = screens.First().Value; activeScreen.OnActivate(null); } if (activeSubscreen == null) { activeScreen.Update(); } else { activeScreen.BackgroundUpdate(); activeSubscreen.Update(); } }
/// <summary> /// Closes the active subscreen /// </summary> /// <param id="screenParams">Parameters passed to the underlaying OnSubscreenExit method</param> public void CloseSubscreen(params object[] screenParams) { activeSubscreen.OnDeactivate(); activeSubscreen = null; activeScreen.OnSubscreenExit(screenParams); }
/// <summary> /// Switches between screens /// </summary> /// <param id="screen">Name of the new screen</param> /// <param id="screenParams">Parameters passed to the new screen OnActivate method</param> public void SwitchScreen(string screen, params object[] screenParams) { activeScreen.OnDeactivate(); activeScreen = screens[screen]; activeScreen.OnActivate(screenParams); }
/// <summary> /// Adds a screen to the dictionary of available screens /// </summary> /// <param id="screen">New screen</param> public void Add(Screen screen) { screens.Add(screen.Id, screen); }