/// <summary> /// Handles process for all tutorial GUI derived classes. /// This passes time to the TutorialState as the tutorial GUI Node shouldn't stop processing on pause /// </summary> public static void ProcessTutorialGUI(ITutorialGUI gui, float delta) { // Just to make sure this is reset properly gui.IsClosingAutomatically = false; // Let the attached tutorial controller do stuff gui.EventReceiver?.Process(gui, delta); }
public static void HandleCloseSpecificForGUI(ITutorialGUI gui, string closedThing) { if (gui.IsClosingAutomatically) { return; } GUICommon.Instance.PlayButtonPressSound(); gui.EventReceiver?.OnCurrentTutorialClosed(closedThing); }
/// <summary> /// Handles process for all tutorial GUI derived classes. /// This passes time to the TutorialState as the tutorial GUI Node shouldn't stop processing on pause /// </summary> public static void ProcessTutorialGUI(ITutorialGUI gui, float delta) { // https://github.com/Revolutionary-Games/Thrive/issues/1976 if (delta <= 0) { return; } // Just to make sure this is reset properly gui.IsClosingAutomatically = false; // Let the attached tutorial controller do stuff gui.EventReceiver?.Process(gui, delta); }
public static void HandleCloseAllForGUI(ITutorialGUI gui) { if (gui.IsClosingAutomatically) { return; } GUICommon.Instance.PlayButtonPressSound(); gui.EventReceiver?.OnTutorialClosed(); if (!gui.TutorialEnabledSelected) { gui.EventReceiver?.OnTutorialDisabled(); } }
public void Process(ITutorialGUI gui, float delta) { if (!Enabled) { if (hasPaused) { UnPause(gui); } if (needsToApplyEvenIfDisabled) { HideAll(); ApplyGUIState(gui); needsToApplyEvenIfDisabled = false; } return; } HandlePausing(gui); // Pause if the game is paused, but we didn't want to pause things if (gui.GUINode.GetTree().Paused&& !WantsGamePaused) { return; } TotalElapsed += delta; foreach (var tutorial in Tutorials) { if (!tutorial.ShownCurrently && !tutorial.ProcessWhileHidden) { continue; } tutorial.Process(this, delta); } ApplyGUIState(gui); }
/// <summary> /// Applies all the GUI states related to the tutorial, this makes saving and loading the tutorial state easier /// </summary> /// <param name="gui">The target GUI instance</param> private void ApplyGUIState(ITutorialGUI gui) { gui.IsClosingAutomatically = true; switch (gui) { case MicrobeTutorialGUI casted: ApplySpecificGUI(casted); break; case MicrobeEditorTutorialGUI casted: ApplySpecificGUI(casted); break; default: throw new ArgumentException("Unhandled GUI class in ApplyGUIState"); } gui.IsClosingAutomatically = false; needsToApplyEvenIfDisabled = true; }
private void HandlePausing(ITutorialGUI gui) { if (WantsGamePaused != hasPaused) { if (hasPaused) { // Unpause UnPause(gui); } else { // Due to initialization stuff, the tutorial is not allowed to immediately pause the game if (TotalElapsed < Constants.TIME_BEFORE_TUTORIAL_CAN_PAUSE) { return; } // Pause returnToPauseState = gui.GUINode.GetTree().Paused; gui.GUINode.GetTree().Paused = true; hasPaused = true; } } }
private void UnPause(ITutorialGUI gui) { gui.GUINode.GetTree().Paused = returnToPauseState; hasPaused = false; }