Moved game menu patch

master
Mohammad Shoaib Khan 2023-02-24 19:45:01 +05:30
parent 8d11cc6266
commit 911c93a555
No known key found for this signature in database
GPG Key ID: D8040D966320B620
3 changed files with 9 additions and 5 deletions

View File

@ -65,7 +65,7 @@ namespace stardew_access
#region Game Menu Patches
harmony.Patch(
original: AccessTools.Method(typeof(GameMenu), nameof(GameMenu.draw), new Type[] { typeof(SpriteBatch) }),
postfix: new HarmonyMethod(typeof(GameMenuPatches), nameof(GameMenuPatches.GameMenuPatch))
postfix: new HarmonyMethod(typeof(GameMenuPatch), nameof(GameMenuPatch.DrawPatch))
);
harmony.Patch(

View File

@ -1,14 +1,13 @@
using StardewValley;
using StardewValley.Menus;
using StardewValley.Objects;
namespace stardew_access.Patches
{
internal class GameMenuPatches
internal class GameMenuPatch
{
internal static string gameMenuQueryKey = "";
internal static void GameMenuPatch(GameMenu __instance)
internal static void DrawPatch(GameMenu __instance)
{
try
{
@ -38,5 +37,10 @@ namespace stardew_access.Patches
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
}
}
internal static void Cleanup()
{
gameMenuQueryKey = "";
}
}
}

View File

@ -33,7 +33,7 @@ namespace stardew_access.Patches
}
else if (menu is GameMenu)
{
GameMenuPatches.gameMenuQueryKey = "";
GameMenuPatch.Cleanup();
ExitPagePatch.Cleanup();
OptionsPagePatch.Cleanup();
SocialPagePatch.Cleanup();