diff --git a/JKMP.Core/Events.cs b/JKMP.Core/Events.cs index 9de17cf..119fa76 100644 --- a/JKMP.Core/Events.cs +++ b/JKMP.Core/Events.cs @@ -27,5 +27,12 @@ public static void OnPostGameInitialize() { PostGameInitialized?.Invoke(DefaultEventSender, EventArgs.Empty); } + + public static event EventHandler? GameTitleScreenLoaded; + + public static void OnGameTitleScreenLoaded() + { + GameTitleScreenLoaded?.Invoke(DefaultEventSender, EventArgs.Empty); + } } } \ No newline at end of file diff --git a/JKMP.Core/JKCore.cs b/JKMP.Core/JKCore.cs index 38b9ad5..1f0acc3 100644 --- a/JKMP.Core/JKCore.cs +++ b/JKMP.Core/JKCore.cs @@ -65,6 +65,7 @@ internal JKCore() Events.PostGameInitialized += OnPostGameInitialized; Events.PreGameUpdate += OnPreGameUpdate; Events.PostGameUpdate += OnPostGameUpdate; + Events.GameTitleScreenLoaded += OnGameTitleScreenLoaded; } internal void SaveConfig() @@ -82,6 +83,10 @@ private void OnPostGameInitialized(object sender, EventArgs e) JsonSerializerSettings = PluginManager.CreateDefaultJsonSerializerSettings() }; Config = configs.LoadConfig("Config"); + } + + private void OnGameTitleScreenLoaded(object sender, EventArgs e) + { startupInformation = new(); } diff --git a/JKMP.Core/Patches/GameTitleScreenPatches.cs b/JKMP.Core/Patches/GameTitleScreenPatches.cs index b6263bd..0b4851b 100644 --- a/JKMP.Core/Patches/GameTitleScreenPatches.cs +++ b/JKMP.Core/Patches/GameTitleScreenPatches.cs @@ -68,4 +68,13 @@ private static void DrawLogo() TextHelper.DrawString(JKContentManager.Font.MenuFont, logoText, drawPosition, Color.Gold, Vector2.Zero); } } + + [HarmonyPatch(typeof(GameTitleScreen), "OnNewRun")] + internal static class GameTitleScreenOnNewRunPatch + { + private static void Postfix() + { + Events.OnGameTitleScreenLoaded(); + } + } } \ No newline at end of file