* Exit Menu Page is now accessible
* Fix for delete button hover text not narratingmaster
parent
a513a14ca0
commit
24a5c906b8
|
@ -22,28 +22,29 @@ namespace stardew_access
|
||||||
/// <param name="helper">Provides simplified APIs for writing mods.</param>
|
/// <param name="helper">Provides simplified APIs for writing mods.</param>
|
||||||
public override void Entry(IModHelper helper)
|
public override void Entry(IModHelper helper)
|
||||||
{
|
{
|
||||||
|
#region Initializations
|
||||||
// Inititalize monitor
|
// Inititalize monitor
|
||||||
monitor = Monitor;
|
monitor = Monitor;
|
||||||
|
|
||||||
// Initialize the screen reader
|
// Initialize the screen reader
|
||||||
ScreenReader.initializeScreenReader();
|
ScreenReader.initializeScreenReader();
|
||||||
|
|
||||||
// Init harmony
|
// Init harmony
|
||||||
harmony = new Harmony(ModManifest.UniqueID);
|
harmony = new Harmony(ModManifest.UniqueID);
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Harmony Patches
|
||||||
|
|
||||||
// Add patches
|
|
||||||
harmony.Patch(
|
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))
|
postfix: new HarmonyMethod(typeof(DialoguePatch), nameof(DialoguePatch.CharachterDialoguePatch))
|
||||||
);
|
);
|
||||||
|
|
||||||
harmony.Patch(
|
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<Item>) }),
|
||||||
postfix: new HarmonyMethod(typeof(DialoguePatch), nameof(DialoguePatch.HoverTextPatch))
|
postfix: new HarmonyMethod(typeof(DialoguePatch), nameof(DialoguePatch.HoverTextPatch))
|
||||||
);
|
);
|
||||||
|
|
||||||
harmony.Patch(
|
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))
|
postfix: new HarmonyMethod(typeof(MenuPatch), nameof(MenuPatch.TitleMenuPatch))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -52,6 +53,12 @@ namespace stardew_access
|
||||||
postfix: new HarmonyMethod(typeof(MenuPatch), nameof(MenuPatch.LoadGameMenuPatch))
|
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;
|
helper.Events.Input.ButtonPressed += this.OnButtonPressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,10 @@ namespace stardew_access.Patches
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// Fix for delete button hover text not narrating
|
||||||
|
if (Game1.activeClickableMenu is LoadGameMenu || Game1.activeClickableMenu is TitleMenu)
|
||||||
|
return;
|
||||||
|
|
||||||
StringBuilder toSpeak = new StringBuilder();
|
StringBuilder toSpeak = new StringBuilder();
|
||||||
|
|
||||||
#region Add title if any
|
#region Add title if any
|
||||||
|
@ -47,7 +51,6 @@ namespace stardew_access.Patches
|
||||||
#region Add crafting ingredients
|
#region Add crafting ingredients
|
||||||
if (craftingIngredients != null)
|
if (craftingIngredients != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
toSpeak.Append($"\n{craftingIngredients.description}");
|
toSpeak.Append($"\n{craftingIngredients.description}");
|
||||||
toSpeak.Append("\nIngredients\n");
|
toSpeak.Append("\nIngredients\n");
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
using Microsoft.Xna.Framework;
|
using StardewModdingAPI;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
|
||||||
using StardewModdingAPI;
|
|
||||||
using StardewValley;
|
using StardewValley;
|
||||||
using StardewValley.Menus;
|
using StardewValley.Menus;
|
||||||
|
|
||||||
|
@ -69,6 +67,13 @@ namespace stardew_access.Patches
|
||||||
if (__instance.Farmer == null)
|
if (__instance.Farmer == null)
|
||||||
return;
|
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 farmerName = __instance.Farmer.Name;
|
||||||
String farmName = __instance.Farmer.farmName;
|
String farmName = __instance.Farmer.farmName;
|
||||||
String money = __instance.Farmer.Money.ToString();
|
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);
|
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