* Exit Menu Page is now accessible
* Fix for delete button hover text not narratingmaster
parent
a513a14ca0
commit
24a5c906b8
|
@ -22,16 +22,17 @@ namespace stardew_access
|
|||
/// <param name="helper">Provides simplified APIs for writing mods.</param>
|
||||
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);
|
||||
#endregion
|
||||
|
||||
#region Harmony Patches
|
||||
|
||||
// Add patches
|
||||
harmony.Patch(
|
||||
original: AccessTools.Method(typeof(DialogueBox), nameof(DialogueBox.draw), new Type[] { typeof(SpriteBatch) }),
|
||||
postfix: new HarmonyMethod(typeof(DialoguePatch), nameof(DialoguePatch.CharachterDialoguePatch))
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue