From 59406684dad4c545246c9d1297172866c638d808 Mon Sep 17 00:00:00 2001 From: _nebula <41904486+misternebula@users.noreply.github.com> Date: Fri, 10 Nov 2023 15:56:57 +0000 Subject: [PATCH] fix other popups --- .../NewMenuSystem/Patches.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/OWML.ModHelper.Menus/NewMenuSystem/Patches.cs b/src/OWML.ModHelper.Menus/NewMenuSystem/Patches.cs index adde2a36..a8371c2c 100644 --- a/src/OWML.ModHelper.Menus/NewMenuSystem/Patches.cs +++ b/src/OWML.ModHelper.Menus/NewMenuSystem/Patches.cs @@ -121,5 +121,22 @@ public static void FadeInTitleLogo(TitleScreenManager __instance) var owmlManifest = JsonHelper.LoadJsonObject($"{Application.dataPath}/Managed/{Constants.OwmlManifestFileName}"); __instance._gameVersionTextDisplay.text = $"Outer Wilds : {Application.version}{Environment.NewLine}OWML : {owmlManifest.Version}"; } + + [HarmonyPostfix] + [HarmonyPatch(typeof(PopupMenu), nameof(PopupMenu.EnableMenu))] + public static void EnableMenu(PopupMenu __instance) + { + var rootEnabled = __instance._menuActivationRoot.gameObject.activeSelf; + + // PopupCanvas is disabled after the menus are initialized, and overrideSorting can only be set when it's enabled + __instance._menuActivationRoot.gameObject.SetActive(true); + __instance._popupCanvas = __instance.gameObject.GetAddComponent(); + __instance._popupCanvas.overrideSorting = true; + __instance._popupCanvas.sortingOrder = 30000; + if (!rootEnabled) + { + __instance._menuActivationRoot.gameObject.SetActive(false); + } + } } }