Added naming menu title narration

master
shoaib11120 2021-12-31 20:45:52 +05:30
parent dc12fe99c8
commit 408cdbde66
2 changed files with 21 additions and 0 deletions

View File

@ -137,6 +137,11 @@ namespace stardew_access
postfix: new HarmonyMethod(typeof(MenuPatch), nameof(MenuPatch.ConfirmationDialogPatch))
);
harmony.Patch(
original: AccessTools.Constructor(typeof(NamingMenu), new Type[] { typeof(NamingMenu.doneNamingBehavior), typeof(string), typeof(string) }),
postfix: new HarmonyMethod(typeof(MenuPatch), nameof(MenuPatch.NamingMenuPatch))
);
#endregion
#region Custom Commands

View File

@ -17,6 +17,22 @@ namespace stardew_access.Patches
private static string currentLevelUpTitle = " ";
private const int MAX_COMPONENTS = 20;
internal static void NamingMenuPatch(NamingMenu __instance, string title, TextBox ___textBox)
{
try
{
__instance.textBoxCC.snapMouseCursor();
___textBox.SelectMe();
string toSpeak = $"{title}";
ScreenReader.sayWithChecker(toSpeak, true);
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
internal static void ConfirmationDialogPatch(ConfirmationDialog __instance, string ___message)
{
try