Skip to content

Commit

Permalink
fix other popups
Browse files Browse the repository at this point in the history
  • Loading branch information
misternebula committed Nov 10, 2023
1 parent ef6c095 commit 5940668
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/OWML.ModHelper.Menus/NewMenuSystem/Patches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,22 @@ public static void FadeInTitleLogo(TitleScreenManager __instance)
var owmlManifest = JsonHelper.LoadJsonObject<ModManifest>($"{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<Canvas>();
__instance._popupCanvas.overrideSorting = true;
__instance._popupCanvas.sortingOrder = 30000;
if (!rootEnabled)
{
__instance._menuActivationRoot.gameObject.SetActive(false);
}
}
}
}

0 comments on commit 5940668

Please sign in to comment.