diff --git a/BloonsTD6 Mod Helper/MelonMain.cs b/BloonsTD6 Mod Helper/MelonMain.cs index 1b80cd9b0..ec446cc0e 100644 --- a/BloonsTD6 Mod Helper/MelonMain.cs +++ b/BloonsTD6 Mod Helper/MelonMain.cs @@ -91,6 +91,8 @@ public static void SettingsPatch() modsButton.Init(); } + private static bool afterTitleScreen; + public override void OnUpdate() { KeyCodeHooks(); @@ -103,8 +105,8 @@ public override void OnUpdate() if (Game.instance is null) return; - - if (PopupScreen.instance != null) + + if (PopupScreen.instance != null && afterTitleScreen) UpdateHandler.AnnounceUpdates(modsNeedingUpdates, this.GetModDirectory()); if (InGame.instance is null) @@ -130,15 +132,6 @@ private void KeyCodeHooks() public override void OnTitleScreen() { - if (UpdateHandler.updatedMods && PopupScreen.instance != null) - { - PopupScreen.instance.ShowPopup(PopupScreen.Placement.menuCenter, "Restart Required", - "You've downloaded new updates for mods, but still need to restart your game to apply them.\n" + - "\nWould you like to do that now?", new Action(() => MenuManager.instance.QuitGame()), - "Yes, quit the game", null, "Not now", Popup.TransitionAnim.Update); - UpdateHandler.updatedMods = false; - } - ModSettingsHandler.SaveModSettings(this.GetModSettingsDir()); if (!scheduledInGamePatch) @@ -203,6 +196,8 @@ public override void OnTitleScreen() $"Finished exporting upgrades to {FileIOUtil.sandboxRoot + "Upgrades"}"); }); }); + + afterTitleScreen = true; } private void Schedule_GameModel_Loaded() @@ -231,6 +226,18 @@ public static void DoPatchMethods(Action action) } } + public override void OnMainMenu() + { + if (UpdateHandler.updatedMods && PopupScreen.instance != null) + { + PopupScreen.instance.ShowPopup(PopupScreen.Placement.menuCenter, "Restart Required", + "You've downloaded new updates for mods, but still need to restart your game to apply them.\n" + + "\nWould you like to do that now?", new Action(() => MenuManager.instance.QuitGame()), + "Yes, quit the game", null, "Not now", Popup.TransitionAnim.Update); + UpdateHandler.updatedMods = false; + } + } + #region Autosave public static ModSettingBool openBackupDir = new ModSettingBool(true)