/// <summary> /// Called to begin the exit to a new screen /// </summary> public virtual void Exit(Func <QuaverScreen> screen, int delay = 0, QuaverScreenChangeType type = QuaverScreenChangeType.CompleteChange) { Exiting = true; Button.IsGloballyClickable = false; ScreenExiting?.Invoke(this, new ScreenExitingEventArgs()); if (delay > 0) { QuaverScreenManager.ScheduleScreenChange(screen, delay, type); } else { QuaverScreenManager.ScheduleScreenChange(screen, false, type); } ScreenExiting = null; }
/// <summary> /// Schedules the current screen to start changing to the next /// </summary> /// <param name="newScreen"></param> /// <param name="delayFade"></param> /// <param name="type"></param> public static void ScheduleScreenChange(Func <QuaverScreen> newScreen, bool delayFade = false, QuaverScreenChangeType type = QuaverScreenChangeType.CompleteChange) { ChangeType = type; if (!delayFade) { Transitioner.FadeIn(); } ThreadScheduler.Run(() => { if (QueuedScreen != null) { lock (QueuedScreen) QueuedScreen = newScreen(); } else { QueuedScreen = newScreen(); } Logger.Important($"Scheduled screen change to: '{QueuedScreen.Type}'. w/ {DelayedScreenChangeTime}ms delay", LogType.Runtime); }); }
/// <summary> /// Schedule a screen change with a delay before doing so /// </summary> /// <param name="newScreen"></param> /// <param name="delay"></param> public static void ScheduleScreenChange(Func <QuaverScreen> newScreen, int delay, QuaverScreenChangeType type = QuaverScreenChangeType.CompleteChange) { DelayedScreenChangeTime = delay; ScheduleScreenChange(newScreen, true, type); }