From b8ea5c95582c929d7472e061fde466e634255114 Mon Sep 17 00:00:00 2001 From: _nebula <41904486+misternebula@users.noreply.github.com> Date: Mon, 19 Feb 2024 09:37:27 +0000 Subject: [PATCH] Update PopupMenuManager.cs --- .../NewMenuSystem/PopupMenuManager.cs | 42 +++++++++++++++---- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/src/OWML.ModHelper.Menus/NewMenuSystem/PopupMenuManager.cs b/src/OWML.ModHelper.Menus/NewMenuSystem/PopupMenuManager.cs index 4bdcfb60..1809025b 100644 --- a/src/OWML.ModHelper.Menus/NewMenuSystem/PopupMenuManager.cs +++ b/src/OWML.ModHelper.Menus/NewMenuSystem/PopupMenuManager.cs @@ -162,6 +162,7 @@ public IOWMLThreeChoicePopupMenu CreateThreeChoicePopup(string message, string c popup._selectableItemsRoot = originalPopup._selectableItemsRoot; popup._subMenus = originalPopup._subMenus; popup._menuOptions = originalPopup._menuOptions; + popup._addToMenuStackManager = true; popup.SetUpPopup( message, InputLibrary.menuConfirm, @@ -293,6 +294,7 @@ public IOWMLFourChoicePopupMenu CreateFourChoicePopup(string message, string con popup._selectableItemsRoot = originalPopup._selectableItemsRoot; popup._subMenus = originalPopup._subMenus; popup._menuOptions = originalPopup._menuOptions; + popup._addToMenuStackManager = true; popup.SetUpPopup( message, InputLibrary.menuConfirm, @@ -330,23 +332,45 @@ public static bool DetermineStartupPopups(TitleScreenManager __instance) return false; } - public static bool TryShowStartupPopupsAndShowMenu(TitleScreenManager __instance) + public static bool TryShowStartupPopupsAndShowMenu(TitleScreenManager __instance, bool firstTimeRun) { - if (PopupMenuManager.PopupsToShow.Count != 0) + if (__instance._setGammaMenuCallback) { - __instance.TryShowStartupPopups(); - return false; + PlayerData.SetRanFirstRunGammaSetup(true); + __instance._setGammaMenuCallback = false; + __instance._firstTimeGammaSetup.OnGammaMenuFadeOutComplete -= __instance.TryShowStartupPopupsAndShowMenu; } - __instance._okCancelPopup.ResetPopup(); - __instance.SetUpMainMenu(); - - if (__instance._autoResumeExpedition) + if (!PlayerData.RanFirstRunGammaSetup() && __instance.MainMenuIsActive()) { + __instance._inputModule.EnableInputs(); + __instance._setGammaMenuCallback = true; + __instance._firstTimeGammaSetup.OnGammaMenuFadeOutComplete += __instance.TryShowStartupPopupsAndShowMenu; + __instance._firstTimeGammaSetup.OnDeactivateMenu += __instance.OnGammaMenuDeactivate; + __instance._firstTimeGammaSetup.ActivateAsFirstTimeSetup(); return false; } - __instance.FadeInMenuOptions(); + if (PopupMenuManager.PopupsToShow.Count == 0) + { + __instance._okCancelPopup.ResetPopup(); + __instance.SetUpMainMenu(); + + if (__instance._autoResumeExpedition) + { + return false; + } + + if (firstTimeRun) + { + __instance.FadeInMenuOptions(); + return false; + } + } + else + { + __instance.TryShowStartupPopups(); + } return false; }