diff --git a/stardew-access/HarmonyPatches.cs b/stardew-access/HarmonyPatches.cs index 69bccb5..900e674 100644 --- a/stardew-access/HarmonyPatches.cs +++ b/stardew-access/HarmonyPatches.cs @@ -267,12 +267,12 @@ namespace stardew_access #region Mini Games harmony.Patch( original: AccessTools.Method(typeof(Intro), nameof(Intro.draw), new Type[] { typeof(SpriteBatch) }), - postfix: new HarmonyMethod(typeof(MiniGamesPatches), nameof(MiniGamesPatches.IntroPatch)) + postfix: new HarmonyMethod(typeof(IntroPatch), nameof(IntroPatch.DrawPatch)) ); harmony.Patch( original: AccessTools.Method(typeof(GrandpaStory), nameof(GrandpaStory.draw), new Type[] { typeof(SpriteBatch) }), - postfix: new HarmonyMethod(typeof(MiniGamesPatches), nameof(MiniGamesPatches.GrandpaStoryPatch)) + postfix: new HarmonyMethod(typeof(GrandpaStoryPatch), nameof(GrandpaStoryPatch.DrawPatch)) ); #endregion diff --git a/stardew-access/Patches/MiniGamesPatches.cs b/stardew-access/Patches/MiniGamesPatches/GrandpaStoryPatch.cs similarity index 71% rename from stardew-access/Patches/MiniGamesPatches.cs rename to stardew-access/Patches/MiniGamesPatches/GrandpaStoryPatch.cs index 07480bf..90e93d2 100644 --- a/stardew-access/Patches/MiniGamesPatches.cs +++ b/stardew-access/Patches/MiniGamesPatches/GrandpaStoryPatch.cs @@ -4,43 +4,11 @@ using StardewValley.Minigames; namespace stardew_access.Patches { - public class MiniGamesPatches + public class GrandpaStoryPatch { public static string grandpaStoryQuery = " "; - public static string introQuery = " "; - internal static void IntroPatch(Intro __instance, int ___currentState) - { - try - { - if (MainClass.ModHelper == null) - return; - - string toSpeak = " "; - - if (___currentState == 3) - { - toSpeak = MainClass.ModHelper.Translation.Get("intro.scene3"); - } - else if (___currentState == 4) - { - toSpeak = MainClass.ModHelper.Translation.Get("intro.scene4"); - } - - if (toSpeak != " " && introQuery != toSpeak) - { - introQuery = toSpeak; - MainClass.ScreenReader.Say(toSpeak, false); - return; - } - } - catch (System.Exception e) - { - MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); - } - } - - internal static void GrandpaStoryPatch(GrandpaStory __instance, StardewValley.Menus.LetterViewerMenu ___letterView, bool ___drawGrandpa, bool ___letterReceived, bool ___mouseActive, Queue ___grandpaSpeech, int ___grandpaSpeechTimer, int ___totalMilliseconds, int ___scene, int ___parallaxPan) + internal static void DrawPatch(GrandpaStory __instance, StardewValley.Menus.LetterViewerMenu ___letterView, bool ___drawGrandpa, bool ___letterReceived, bool ___mouseActive, Queue ___grandpaSpeech, int ___grandpaSpeechTimer, int ___totalMilliseconds, int ___scene, int ___parallaxPan) { try { diff --git a/stardew-access/Patches/MiniGamesPatches/IntroPatch.cs b/stardew-access/Patches/MiniGamesPatches/IntroPatch.cs new file mode 100644 index 0000000..08759a7 --- /dev/null +++ b/stardew-access/Patches/MiniGamesPatches/IntroPatch.cs @@ -0,0 +1,40 @@ +using StardewValley.Minigames; + +namespace stardew_access.Patches +{ + public class IntroPatch + { + public static string introQuery = " "; + + internal static void DrawPatch(Intro __instance, int ___currentState) + { + try + { + if (MainClass.ModHelper == null) + return; + + string toSpeak = " "; + + if (___currentState == 3) + { + toSpeak = MainClass.ModHelper.Translation.Get("intro.scene3"); + } + else if (___currentState == 4) + { + toSpeak = MainClass.ModHelper.Translation.Get("intro.scene4"); + } + + if (toSpeak != " " && introQuery != toSpeak) + { + introQuery = toSpeak; + MainClass.ScreenReader.Say(toSpeak, false); + return; + } + } + catch (System.Exception e) + { + MainClass.ErrorLog($"An error occured in intro minigame patch:\n{e.Message}\n{e.StackTrace}"); + } + } + } +}