Moved and organized mini game patches
parent
2c233f6e6b
commit
53fe731401
|
@ -267,12 +267,12 @@ namespace stardew_access
|
||||||
#region Mini Games
|
#region Mini Games
|
||||||
harmony.Patch(
|
harmony.Patch(
|
||||||
original: AccessTools.Method(typeof(Intro), nameof(Intro.draw), new Type[] { typeof(SpriteBatch) }),
|
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(
|
harmony.Patch(
|
||||||
original: AccessTools.Method(typeof(GrandpaStory), nameof(GrandpaStory.draw), new Type[] { typeof(SpriteBatch) }),
|
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
|
#endregion
|
||||||
|
|
||||||
|
|
|
@ -4,43 +4,11 @@ using StardewValley.Minigames;
|
||||||
|
|
||||||
namespace stardew_access.Patches
|
namespace stardew_access.Patches
|
||||||
{
|
{
|
||||||
public class MiniGamesPatches
|
public class GrandpaStoryPatch
|
||||||
{
|
{
|
||||||
public static string grandpaStoryQuery = " ";
|
public static string grandpaStoryQuery = " ";
|
||||||
public static string introQuery = " ";
|
|
||||||
|
|
||||||
internal static void IntroPatch(Intro __instance, int ___currentState)
|
internal static void DrawPatch(GrandpaStory __instance, StardewValley.Menus.LetterViewerMenu ___letterView, bool ___drawGrandpa, bool ___letterReceived, bool ___mouseActive, Queue<string> ___grandpaSpeech, int ___grandpaSpeechTimer, int ___totalMilliseconds, int ___scene, int ___parallaxPan)
|
||||||
{
|
|
||||||
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<string> ___grandpaSpeech, int ___grandpaSpeechTimer, int ___totalMilliseconds, int ___scene, int ___parallaxPan)
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
|
@ -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}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue