Confirmation Menu is accessible, hopefully

master
shoaib11120 2021-12-30 19:25:42 +05:30
parent 5cf6327552
commit 2806267b60
2 changed files with 28 additions and 0 deletions

View File

@ -132,6 +132,11 @@ namespace stardew_access
postfix: new HarmonyMethod(typeof(MenuPatch), nameof(MenuPatch.LevelUpMenuPatch)) postfix: new HarmonyMethod(typeof(MenuPatch), nameof(MenuPatch.LevelUpMenuPatch))
); );
harmony.Patch(
original: AccessTools.Method(typeof(ConfirmationDialog), nameof(ConfirmationDialog.draw), new Type[] { typeof(SpriteBatch) }),
postfix: new HarmonyMethod(typeof(MenuPatch), nameof(MenuPatch.ConfirmationDialogPatch))
);
#endregion #endregion
#region Custom Commands #region Custom Commands

View File

@ -16,6 +16,29 @@ namespace stardew_access.Patches
private static string currentDailyQuestText = " "; private static string currentDailyQuestText = " ";
private static string currentLevelUpTitle = " "; private static string currentLevelUpTitle = " ";
internal static void ConfirmationDialogPatch(ConfirmationDialog __instance, string ___message)
{
try
{
int x = Game1.getMousePosition(true).X, y = Game1.getMousePosition(true).Y;
if(__instance.okButton.containsPoint(x, y))
{
ScreenReader.sayWithMenuChecker("Ok Button", false);
} else if (__instance.cancelButton.containsPoint(x, y))
{
ScreenReader.sayWithMenuChecker("Cancel Button", false);
} else
{
ScreenReader.sayWithMenuChecker(___message, true);
}
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
internal static void ChatBoxPatch(ChatBox __instance, List<ChatMessage> ___messages) internal static void ChatBoxPatch(ChatBox __instance, List<ChatMessage> ___messages)
{ {
try try