diff --git a/stardew-access/HarmonyPatches.cs b/stardew-access/HarmonyPatches.cs index f63e185..7dc84b6 100644 --- a/stardew-access/HarmonyPatches.cs +++ b/stardew-access/HarmonyPatches.cs @@ -175,6 +175,11 @@ namespace stardew_access original: AccessTools.Method(typeof(ChooseFromListMenu), nameof(ChooseFromListMenu.draw), new Type[] { typeof(SpriteBatch) }), postfix: new HarmonyMethod(typeof(MenuPatches), nameof(MenuPatches.ChooseFromListMenuPatch)) ); + + harmony.Patch( + original: AccessTools.Method(typeof(TailoringMenu), nameof(TailoringMenu.draw), new Type[] { typeof(SpriteBatch) }), + postfix: new HarmonyMethod(typeof(MenuPatches), nameof(MenuPatches.TailoringMenuPatch)) + ); #endregion #region Quest Patches diff --git a/stardew-access/Patches/MenuPatches.cs b/stardew-access/Patches/MenuPatches.cs index 01ba637..e820de6 100644 --- a/stardew-access/Patches/MenuPatches.cs +++ b/stardew-access/Patches/MenuPatches.cs @@ -15,6 +15,53 @@ namespace stardew_access.Patches private static string animalQueryMenuQuery = " "; public static Vector2? prevTile = null; + internal static void TailoringMenuPatch(TailoringMenu __instance) + { + try + { + int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position + string toSpeak = ""; + + if (__instance.leftIngredientSpot != null && __instance.leftIngredientSpot.containsPoint(x, y)) + { + if (__instance.leftIngredientSpot.item == null) + { + toSpeak = "Input cloth here"; + } + else + { + Item item = __instance.leftIngredientSpot.item; + toSpeak = $"Cloth slot: {item.Stack} {item.DisplayName}"; + } + } + else if (__instance.rightIngredientSpot != null && __instance.rightIngredientSpot.containsPoint(x, y)) + { + if (__instance.rightIngredientSpot.item == null) + { + toSpeak = "Input ingredient here"; + } + else + { + Item item = __instance.rightIngredientSpot.item; + toSpeak = $"Ingredient slot: {item.Stack} {item.DisplayName}"; + } + } + else if (__instance.startTailoringButton != null && __instance.startTailoringButton.containsPoint(x, y)) + { + toSpeak = "Star tailoring button"; + } + + // TODO add other things + + if (toSpeak != "") + MainClass.ScreenReader.SayWithMenuChecker(toSpeak, true); + } + catch (System.Exception e) + { + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); + } + } + internal static void ChooseFromListMenuPatch(ChooseFromListMenu __instance, List ___options, int ___index, bool ___isJukebox) { try