Patched choose from list(jukebox) menu
parent
9e1c263cf8
commit
4b6879b1f3
|
@ -1,5 +1,4 @@
|
|||
using Microsoft.Xna.Framework.Audio;
|
||||
using StardewModdingAPI;
|
||||
using StardewValley;
|
||||
|
||||
namespace stardew_access
|
||||
|
@ -16,6 +15,9 @@ namespace stardew_access
|
|||
{
|
||||
try
|
||||
{
|
||||
if (MainClass.ModHelper == null)
|
||||
return;
|
||||
|
||||
Dictionary<String, TYPE> soundEffects = new Dictionary<String, TYPE>();
|
||||
|
||||
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) }),
|
||||
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
|
||||
|
||||
#region Quest Patches
|
||||
|
|
|
@ -197,6 +197,12 @@ namespace stardew_access.Patches
|
|||
|
||||
if (Game1.activeClickableMenu is AnimalQueryMenu)
|
||||
return;
|
||||
|
||||
if (Game1.activeClickableMenu is ConfirmationDialog)
|
||||
return;
|
||||
|
||||
if (Game1.activeClickableMenu is ReadyCheckDialog)
|
||||
return;
|
||||
#endregion
|
||||
|
||||
string toSpeak = " ";
|
||||
|
|
|
@ -15,6 +15,30 @@ namespace stardew_access.Patches
|
|||
private static string animalQueryMenuQuery = " ";
|
||||
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)
|
||||
{
|
||||
try
|
||||
|
@ -235,16 +259,18 @@ namespace stardew_access.Patches
|
|||
try
|
||||
{
|
||||
int x = Game1.getMouseX(true), y = Game1.getMouseY(true);
|
||||
string toSpeak = ___message;
|
||||
|
||||
MainClass.ScreenReader.SayWithMenuChecker(___message, true);
|
||||
if (__instance.okButton.containsPoint(x, y))
|
||||
{
|
||||
MainClass.ScreenReader.SayWithMenuChecker("Ok Button", false);
|
||||
toSpeak += "\n\tOk Button";
|
||||
}
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"Name": "Stardew Access",
|
||||
"Author": "Mohammad Shoaib",
|
||||
"Version": "1.1.4",
|
||||
"Version": "1.1.5",
|
||||
"Description": "An accessibility mod with screen reader support!",
|
||||
"UniqueID": "shoaib.stardewaccess",
|
||||
"EntryDll": "stardew-access.dll",
|
||||
|
|
Loading…
Reference in New Issue