Moved some menus to their own class
parent
b0c1d9e173
commit
ea03f9a4cb
|
@ -159,17 +159,17 @@ namespace stardew_access
|
||||||
|
|
||||||
harmony.Patch(
|
harmony.Patch(
|
||||||
original: AccessTools.Method(typeof(MineElevatorMenu), nameof(MineElevatorMenu.draw), new Type[] { typeof(SpriteBatch) }),
|
original: AccessTools.Method(typeof(MineElevatorMenu), nameof(MineElevatorMenu.draw), new Type[] { typeof(SpriteBatch) }),
|
||||||
postfix: new HarmonyMethod(typeof(MenuPatches), nameof(MenuPatches.MineElevatorMenuPatch))
|
postfix: new HarmonyMethod(typeof(MineElevatorMenuPatch), nameof(MineElevatorMenuPatch.DrawPatch))
|
||||||
);
|
);
|
||||||
|
|
||||||
harmony.Patch(
|
harmony.Patch(
|
||||||
original: AccessTools.Method(typeof(LanguageSelectionMenu), nameof(LanguageSelectionMenu.draw), new Type[] { typeof(SpriteBatch) }),
|
original: AccessTools.Method(typeof(LanguageSelectionMenu), nameof(LanguageSelectionMenu.draw), new Type[] { typeof(SpriteBatch) }),
|
||||||
postfix: new HarmonyMethod(typeof(MenuPatches), nameof(MenuPatches.LanguageSelectionMenuPatch))
|
postfix: new HarmonyMethod(typeof(LanguageSelectionMenuPatch), nameof(LanguageSelectionMenuPatch.DrawPatch))
|
||||||
);
|
);
|
||||||
|
|
||||||
harmony.Patch(
|
harmony.Patch(
|
||||||
original: AccessTools.Method(typeof(ChooseFromListMenu), nameof(ChooseFromListMenu.draw), new Type[] { typeof(SpriteBatch) }),
|
original: AccessTools.Method(typeof(ChooseFromListMenu), nameof(ChooseFromListMenu.draw), new Type[] { typeof(SpriteBatch) }),
|
||||||
postfix: new HarmonyMethod(typeof(MenuPatches), nameof(MenuPatches.ChooseFromListMenuPatch))
|
postfix: new HarmonyMethod(typeof(ChooseFromListMenuPatch), nameof(ChooseFromListMenuPatch.DrawPatch))
|
||||||
);
|
);
|
||||||
|
|
||||||
harmony.Patch(
|
harmony.Patch(
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
using StardewValley;
|
||||||
|
using StardewValley.Menus;
|
||||||
|
|
||||||
|
namespace stardew_access.Patches
|
||||||
|
{
|
||||||
|
internal class ChooseFromListMenuPatch
|
||||||
|
{
|
||||||
|
internal static void DrawPatch(ChooseFromListMenu __instance, List<string> ___options, int ___index, bool ___isJukebox)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
|
||||||
|
string toSpeak = "";
|
||||||
|
|
||||||
|
if (__instance.okButton != null && __instance.okButton.containsPoint(x, y))
|
||||||
|
toSpeak = "Select " + (___isJukebox ? Utility.getSongTitleFromCueName(___options[___index]) : ___options[___index]) + " button";
|
||||||
|
else if (__instance.cancelButton != null && __instance.cancelButton.containsPoint(x, y))
|
||||||
|
toSpeak = "Cancel button";
|
||||||
|
else if (__instance.backButton != null && __instance.backButton.containsPoint(x, y))
|
||||||
|
toSpeak = "Previous option: " + (___isJukebox ? Utility.getSongTitleFromCueName(___options[Math.Max(0, ___index - 1)]) : ___options[Math.Max(0, ___index - 1)]) + " button";
|
||||||
|
else if (__instance.forwardButton != null && __instance.forwardButton.containsPoint(x, y))
|
||||||
|
toSpeak = "Next option: " + (___isJukebox ? Utility.getSongTitleFromCueName(___options[Math.Min(___options.Count, ___index + 1)]) : ___options[Math.Min(___options.Count, ___index + 1)]) + " button";
|
||||||
|
|
||||||
|
MainClass.ScreenReader.SayWithMenuChecker(toSpeak, true);
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
using StardewValley;
|
||||||
|
using StardewValley.Menus;
|
||||||
|
|
||||||
|
namespace stardew_access.Patches
|
||||||
|
{
|
||||||
|
internal class LanguageSelectionMenuPatch
|
||||||
|
{
|
||||||
|
internal static void DrawPatch(LanguageSelectionMenu __instance)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
|
||||||
|
|
||||||
|
if (__instance.nextPageButton != null && __instance.nextPageButton.containsPoint(x, y))
|
||||||
|
{
|
||||||
|
MainClass.ScreenReader.SayWithMenuChecker($"Next Page Button", true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (__instance.previousPageButton != null && __instance.previousPageButton.containsPoint(x, y))
|
||||||
|
{
|
||||||
|
MainClass.ScreenReader.SayWithMenuChecker($"Previous Page Button", true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < __instance.languages.Count; i++)
|
||||||
|
{
|
||||||
|
if (__instance.languages[i].containsPoint(x, y))
|
||||||
|
{
|
||||||
|
MainClass.ScreenReader.SayWithMenuChecker($"{__instance.languageList[i]} Button", true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -13,82 +13,8 @@ namespace stardew_access.Patches
|
||||||
internal static bool firstTimeInNamingMenu = true;
|
internal static bool firstTimeInNamingMenu = true;
|
||||||
internal static int prevSlotIndex = -999;
|
internal static int prevSlotIndex = -999;
|
||||||
|
|
||||||
internal static void ChooseFromListMenuPatch(ChooseFromListMenu __instance, List<string> ___options, int ___index, bool ___isJukebox)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
|
|
||||||
string toSpeak = "";
|
|
||||||
|
|
||||||
if (__instance.okButton != null && __instance.okButton.containsPoint(x, y))
|
|
||||||
toSpeak = "Select " + (___isJukebox ? Utility.getSongTitleFromCueName(___options[___index]) : ___options[___index]) + " button";
|
|
||||||
else if (__instance.cancelButton != null && __instance.cancelButton.containsPoint(x, y))
|
|
||||||
toSpeak = "Cancel button";
|
|
||||||
else if (__instance.backButton != null && __instance.backButton.containsPoint(x, y))
|
|
||||||
toSpeak = "Previous option: " + (___isJukebox ? Utility.getSongTitleFromCueName(___options[Math.Max(0, ___index - 1)]) : ___options[Math.Max(0, ___index - 1)]) + " button";
|
|
||||||
else if (__instance.forwardButton != null && __instance.forwardButton.containsPoint(x, y))
|
|
||||||
toSpeak = "Next option: " + (___isJukebox ? Utility.getSongTitleFromCueName(___options[Math.Min(___options.Count, ___index + 1)]) : ___options[Math.Min(___options.Count, ___index + 1)]) + " button";
|
|
||||||
|
|
||||||
MainClass.ScreenReader.SayWithMenuChecker(toSpeak, true);
|
|
||||||
}
|
|
||||||
catch (System.Exception e)
|
|
||||||
{
|
|
||||||
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static void LanguageSelectionMenuPatch(LanguageSelectionMenu __instance)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
|
|
||||||
|
|
||||||
if (__instance.nextPageButton != null && __instance.nextPageButton.containsPoint(x, y))
|
|
||||||
{
|
|
||||||
MainClass.ScreenReader.SayWithMenuChecker($"Next Page Button", true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (__instance.previousPageButton != null && __instance.previousPageButton.containsPoint(x, y))
|
|
||||||
{
|
|
||||||
MainClass.ScreenReader.SayWithMenuChecker($"Previous Page Button", true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < __instance.languages.Count; i++)
|
|
||||||
{
|
|
||||||
if (__instance.languages[i].containsPoint(x, y))
|
|
||||||
{
|
|
||||||
MainClass.ScreenReader.SayWithMenuChecker($"{__instance.languageList[i]} Button", true);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static void MineElevatorMenuPatch(List<ClickableComponent> ___elevators)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
|
|
||||||
for (int i = 0; i < ___elevators.Count; i++)
|
|
||||||
{
|
|
||||||
if (___elevators[i].containsPoint(x, y))
|
|
||||||
{
|
|
||||||
MainClass.ScreenReader.SayWithMenuChecker($"{___elevators[i].name} level", true);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static void TitleTextInputMenuPatch(TitleTextInputMenu __instance)
|
internal static void TitleTextInputMenuPatch(TitleTextInputMenu __instance)
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
using StardewValley;
|
||||||
|
using StardewValley.Menus;
|
||||||
|
|
||||||
|
namespace stardew_access.Patches
|
||||||
|
{
|
||||||
|
internal class MineElevatorMenuPatch
|
||||||
|
{
|
||||||
|
internal static void DrawPatch(List<ClickableComponent> ___elevators)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
|
||||||
|
for (int i = 0; i < ___elevators.Count; i++)
|
||||||
|
{
|
||||||
|
if (___elevators[i].containsPoint(x, y))
|
||||||
|
{
|
||||||
|
MainClass.ScreenReader.SayWithMenuChecker($"{___elevators[i].name} level", true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue