From 2a5baa6770f8e0f980d5cf2e8d60c23573291ceb Mon Sep 17 00:00:00 2001 From: Mohammad Shoaib Khan Date: Fri, 24 Feb 2023 14:33:03 +0530 Subject: [PATCH] Moved collections page patch --- stardew-access/HarmonyPatches.cs | 2 +- stardew-access/Patches/GameMenuPatches.cs | 15 ------------- .../GameMenuPatches/CollectionsPagePatch.cs | 21 +++++++++++++++++++ 3 files changed, 22 insertions(+), 16 deletions(-) create mode 100644 stardew-access/Patches/GameMenuPatches/CollectionsPagePatch.cs diff --git a/stardew-access/HarmonyPatches.cs b/stardew-access/HarmonyPatches.cs index d0fe365..509109a 100644 --- a/stardew-access/HarmonyPatches.cs +++ b/stardew-access/HarmonyPatches.cs @@ -110,7 +110,7 @@ namespace stardew_access harmony.Patch( original: AccessTools.Method(typeof(CollectionsPage), nameof(CollectionsPage.draw), new Type[] { typeof(SpriteBatch) }), - postfix: new HarmonyMethod(typeof(GameMenuPatches), nameof(GameMenuPatches.CollectionsPagePatch)) + postfix: new HarmonyMethod(typeof(CollectionsPagePatch), nameof(CollectionsPagePatch.DrawPatch)) ); #endregion diff --git a/stardew-access/Patches/GameMenuPatches.cs b/stardew-access/Patches/GameMenuPatches.cs index d7c3891..0f7b6fb 100644 --- a/stardew-access/Patches/GameMenuPatches.cs +++ b/stardew-access/Patches/GameMenuPatches.cs @@ -18,21 +18,6 @@ namespace stardew_access.Patches internal static int currentSelectedCraftingRecipe = -1; internal static bool isSelectingRecipe = false; - internal static void CollectionsPagePatch(CollectionsPage __instance) - { - try - { - int x = Game1.getMousePosition().X, y = Game1.getMousePosition().Y; - if (__instance.letterviewerSubMenu != null) - { - DialoguePatches.NarrateLetterContent(__instance.letterviewerSubMenu); - } - } - catch (System.Exception e) - { - MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); - } - } internal static void SocialPagePatch(SocialPage __instance, List ___sprites, int ___slotPosition, List ___kidsNames) { diff --git a/stardew-access/Patches/GameMenuPatches/CollectionsPagePatch.cs b/stardew-access/Patches/GameMenuPatches/CollectionsPagePatch.cs new file mode 100644 index 0000000..a708930 --- /dev/null +++ b/stardew-access/Patches/GameMenuPatches/CollectionsPagePatch.cs @@ -0,0 +1,21 @@ +namespace stardew_access.Patches +{ + internal class CollectionsPagePatch + { + internal static void DrawPatch(StardewValley.Menus.CollectionsPage __instance) + { + try + { + int x = StardewValley.Game1.getMousePosition().X, y = StardewValley.Game1.getMousePosition().Y; + if (__instance.letterviewerSubMenu != null) + { + DialoguePatches.NarrateLetterContent(__instance.letterviewerSubMenu); + } + } + catch (System.Exception e) + { + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); + } + } + } +}