Patched choose from list(jukebox) menu
parent
9e1c263cf8
commit
4b6879b1f3
|
@ -1,5 +1,4 @@
|
||||||
using Microsoft.Xna.Framework.Audio;
|
using Microsoft.Xna.Framework.Audio;
|
||||||
using StardewModdingAPI;
|
|
||||||
using StardewValley;
|
using StardewValley;
|
||||||
|
|
||||||
namespace stardew_access
|
namespace stardew_access
|
||||||
|
@ -16,6 +15,9 @@ namespace stardew_access
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (MainClass.ModHelper == null)
|
||||||
|
return;
|
||||||
|
|
||||||
Dictionary<String, TYPE> soundEffects = new Dictionary<String, TYPE>();
|
Dictionary<String, TYPE> soundEffects = new Dictionary<String, TYPE>();
|
||||||
|
|
||||||
soundEffects.Add("drop_item", TYPE.Sound);
|
soundEffects.Add("drop_item", TYPE.Sound);
|
||||||
|
|
|
@ -163,6 +163,11 @@ namespace stardew_access
|
||||||
original: AccessTools.Method(typeof(AnimalQueryMenu), nameof(AnimalQueryMenu.draw), new Type[] { typeof(SpriteBatch) }),
|
original: AccessTools.Method(typeof(AnimalQueryMenu), nameof(AnimalQueryMenu.draw), new Type[] { typeof(SpriteBatch) }),
|
||||||
postfix: new HarmonyMethod(typeof(MenuPatches), nameof(MenuPatches.AnimalQueryMenuPatch))
|
postfix: new HarmonyMethod(typeof(MenuPatches), nameof(MenuPatches.AnimalQueryMenuPatch))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
harmony.Patch(
|
||||||
|
original: AccessTools.Method(typeof(ChooseFromListMenu), nameof(ChooseFromListMenu.draw), new Type[] { typeof(SpriteBatch) }),
|
||||||
|
postfix: new HarmonyMethod(typeof(MenuPatches), nameof(MenuPatches.ChooseFromListMenuPatch))
|
||||||
|
);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Quest Patches
|
#region Quest Patches
|
||||||
|
|
|
@ -197,6 +197,12 @@ namespace stardew_access.Patches
|
||||||
|
|
||||||
if (Game1.activeClickableMenu is AnimalQueryMenu)
|
if (Game1.activeClickableMenu is AnimalQueryMenu)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (Game1.activeClickableMenu is ConfirmationDialog)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (Game1.activeClickableMenu is ReadyCheckDialog)
|
||||||
|
return;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
string toSpeak = " ";
|
string toSpeak = " ";
|
||||||
|
|
|
@ -15,6 +15,30 @@ namespace stardew_access.Patches
|
||||||
private static string animalQueryMenuQuery = " ";
|
private static string animalQueryMenuQuery = " ";
|
||||||
public static Vector2? prevTile = null;
|
public static Vector2? prevTile = null;
|
||||||
|
|
||||||
|
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 AnimalQueryMenuPatch(AnimalQueryMenu __instance, bool ___confirmingSell, FarmAnimal ___animal, TextBox ___textBox, string ___parentName)
|
internal static void AnimalQueryMenuPatch(AnimalQueryMenu __instance, bool ___confirmingSell, FarmAnimal ___animal, TextBox ___textBox, string ___parentName)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -235,16 +259,18 @@ namespace stardew_access.Patches
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int x = Game1.getMouseX(true), y = Game1.getMouseY(true);
|
int x = Game1.getMouseX(true), y = Game1.getMouseY(true);
|
||||||
|
string toSpeak = ___message;
|
||||||
|
|
||||||
MainClass.ScreenReader.SayWithMenuChecker(___message, true);
|
|
||||||
if (__instance.okButton.containsPoint(x, y))
|
if (__instance.okButton.containsPoint(x, y))
|
||||||
{
|
{
|
||||||
MainClass.ScreenReader.SayWithMenuChecker("Ok Button", false);
|
toSpeak += "\n\tOk Button";
|
||||||
}
|
}
|
||||||
else if (__instance.cancelButton.containsPoint(x, y))
|
else if (__instance.cancelButton.containsPoint(x, y))
|
||||||
{
|
{
|
||||||
MainClass.ScreenReader.SayWithMenuChecker("Cancel Button", false);
|
toSpeak += "\n\tCancel Button";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MainClass.ScreenReader.SayWithMenuChecker(toSpeak, true);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"Name": "Stardew Access",
|
"Name": "Stardew Access",
|
||||||
"Author": "Mohammad Shoaib",
|
"Author": "Mohammad Shoaib",
|
||||||
"Version": "1.1.4",
|
"Version": "1.1.5",
|
||||||
"Description": "An accessibility mod with screen reader support!",
|
"Description": "An accessibility mod with screen reader support!",
|
||||||
"UniqueID": "shoaib.stardewaccess",
|
"UniqueID": "shoaib.stardewaccess",
|
||||||
"EntryDll": "stardew-access.dll",
|
"EntryDll": "stardew-access.dll",
|
||||||
|
|
Loading…
Reference in New Issue