diff --git a/stardew-access/ModEntry.cs b/stardew-access/ModEntry.cs
index 1e348fe..c66db14 100644
--- a/stardew-access/ModEntry.cs
+++ b/stardew-access/ModEntry.cs
@@ -22,28 +22,29 @@ namespace stardew_access
/// Provides simplified APIs for writing mods.
public override void Entry(IModHelper helper)
{
+ #region Initializations
// Inititalize monitor
monitor = Monitor;
-
// Initialize the screen reader
ScreenReader.initializeScreenReader();
-
// Init harmony
- harmony = new Harmony(ModManifest.UniqueID);
+ harmony = new Harmony(ModManifest.UniqueID);
+ #endregion
+
+ #region Harmony Patches
- // Add patches
harmony.Patch(
- original: AccessTools.Method(typeof(DialogueBox), nameof(DialogueBox.draw), new Type[] {typeof(SpriteBatch)}),
+ original: AccessTools.Method(typeof(DialogueBox), nameof(DialogueBox.draw), new Type[] { typeof(SpriteBatch) }),
postfix: new HarmonyMethod(typeof(DialoguePatch), nameof(DialoguePatch.CharachterDialoguePatch))
);
harmony.Patch(
- original: AccessTools.Method(typeof(IClickableMenu), nameof(IClickableMenu.drawHoverText), new Type[] { typeof(SpriteBatch), typeof(string), typeof(SpriteFont), typeof(int), typeof(int), typeof(int) , typeof(string) , typeof(int) , typeof(string[]) , typeof(Item) , typeof(int) , typeof(int), typeof(int), typeof(int), typeof(int), typeof(float), typeof(CraftingRecipe) , typeof(IList < Item >) }),
+ original: AccessTools.Method(typeof(IClickableMenu), nameof(IClickableMenu.drawHoverText), new Type[] { typeof(SpriteBatch), typeof(string), typeof(SpriteFont), typeof(int), typeof(int), typeof(int), typeof(string), typeof(int), typeof(string[]), typeof(Item), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(float), typeof(CraftingRecipe), typeof(IList- ) }),
postfix: new HarmonyMethod(typeof(DialoguePatch), nameof(DialoguePatch.HoverTextPatch))
);
harmony.Patch(
- original: AccessTools.Method(typeof(TitleMenu), nameof(TitleMenu.draw) , new Type[] {typeof(SpriteBatch)}),
+ original: AccessTools.Method(typeof(TitleMenu), nameof(TitleMenu.draw), new Type[] { typeof(SpriteBatch) }),
postfix: new HarmonyMethod(typeof(MenuPatch), nameof(MenuPatch.TitleMenuPatch))
);
@@ -52,6 +53,12 @@ namespace stardew_access
postfix: new HarmonyMethod(typeof(MenuPatch), nameof(MenuPatch.LoadGameMenuPatch))
);
+ harmony.Patch(
+ original: AccessTools.Method(typeof(ExitPage), nameof(ExitPage.draw), new Type[] { typeof(SpriteBatch) }),
+ postfix: new HarmonyMethod(typeof(MenuPatch), nameof(MenuPatch.ExitPagePatch))
+ );
+
+ #endregion
helper.Events.Input.ButtonPressed += this.OnButtonPressed;
}
diff --git a/stardew-access/Patches/DialoguePatch.cs b/stardew-access/Patches/DialoguePatch.cs
index 3ebe4aa..60a58f7 100644
--- a/stardew-access/Patches/DialoguePatch.cs
+++ b/stardew-access/Patches/DialoguePatch.cs
@@ -33,6 +33,10 @@ namespace stardew_access.Patches
{
try
{
+ // Fix for delete button hover text not narrating
+ if (Game1.activeClickableMenu is LoadGameMenu || Game1.activeClickableMenu is TitleMenu)
+ return;
+
StringBuilder toSpeak = new StringBuilder();
#region Add title if any
@@ -47,7 +51,6 @@ namespace stardew_access.Patches
#region Add crafting ingredients
if (craftingIngredients != null)
{
-
toSpeak.Append($"\n{craftingIngredients.description}");
toSpeak.Append("\nIngredients\n");
diff --git a/stardew-access/Patches/MenuPatch.cs b/stardew-access/Patches/MenuPatch.cs
index 26f4937..002cecf 100644
--- a/stardew-access/Patches/MenuPatch.cs
+++ b/stardew-access/Patches/MenuPatch.cs
@@ -1,6 +1,4 @@
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-using StardewModdingAPI;
+using StardewModdingAPI;
using StardewValley;
using StardewValley.Menus;
@@ -69,6 +67,13 @@ namespace stardew_access.Patches
if (__instance.Farmer == null)
return;
+ if (___menu.deleteButtons[i].containsPoint(Game1.getMousePosition(true).X, Game1.getMousePosition(true).Y))
+ {
+ // Fix for delete button hover text not narrating
+ ScreenReader.sayWithChecker($"Delete {__instance.Farmer.farmName} Farm", true);
+ return;
+ }
+
String farmerName = __instance.Farmer.Name;
String farmName = __instance.Farmer.farmName;
String money = __instance.Farmer.Money.ToString();
@@ -87,5 +92,19 @@ namespace stardew_access.Patches
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
+
+ internal static void ExitPagePatch(ExitPage __instance)
+ {
+ if (__instance.exitToTitle.visible &&
+ __instance.exitToTitle.containsPoint(Game1.getMousePosition(true).X, Game1.getMousePosition(true).Y))
+ {
+ ScreenReader.sayWithChecker("Exit to Title Button", true);
+ }
+ if (__instance.exitToDesktop.visible &&
+ __instance.exitToDesktop.containsPoint(Game1.getMousePosition(true).X, Game1.getMousePosition(true).Y))
+ {
+ ScreenReader.sayWithChecker("Exit to Desktop Button", true);
+ }
+ }
}
}