Language Selection Menu is Accessible menu. Use wasd!

master
shoaib11120 2022-01-03 19:55:15 +05:30
parent dda69f6b19
commit 1084ef8dd8
2 changed files with 38 additions and 0 deletions

View File

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

View File

@ -12,6 +12,39 @@ namespace stardew_access.Patches
private static string currentDailyQuestText = " ";
private static string currentLevelUpTitle = " ";
internal static void LanguageSelectionMenuPatch(LanguageSelectionMenu __instance)
{
try
{
int x = Game1.getMousePosition(true).X, y = Game1.getMousePosition(true).Y; // Mouse x and y position
if(__instance.nextPageButton != null && __instance.nextPageButton.containsPoint(x, y))
{
ScreenReader.sayWithMenuChecker($"Next Page Button", true);
return;
}
if (__instance.previousPageButton != null && __instance.previousPageButton.containsPoint(x, y))
{
ScreenReader.sayWithMenuChecker($"Previous Page Button", true);
return;
}
for(int i=0; i<__instance.languages.Count; i++)
{
if(__instance.languages[i].containsPoint(x, y))
{
ScreenReader.sayWithMenuChecker($"{__instance.languageList[i]} Button", true);
break;
}
}
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
internal static void MineElevatorMenuPatch(List<ClickableComponent> ___elevators)
{
try