Skip to content

Commit

Permalink
Update PopupMenuManager.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
misternebula committed Feb 19, 2024
1 parent 42d7d63 commit b8ea5c9
Showing 1 changed file with 33 additions and 9 deletions.
42 changes: 33 additions & 9 deletions src/OWML.ModHelper.Menus/NewMenuSystem/PopupMenuManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit b8ea5c9

Please sign in to comment.