Patched collections page's letter viewer menu

master
Mohammad Shoaib 2022-04-05 12:44:32 +05:30
parent 9fe91faeee
commit 53f7e3ceb0
3 changed files with 87 additions and 59 deletions

View File

@ -101,6 +101,11 @@ namespace stardew_access
original: AccessTools.Method(typeof(JunimoNoteMenu), nameof(JunimoNoteMenu.draw), new Type[] { typeof(SpriteBatch) }),
postfix: new HarmonyMethod(typeof(GameMenuPatches), nameof(GameMenuPatches.JunimoNoteMenuPatch))
);
harmony.Patch(
original: AccessTools.Method(typeof(CollectionsPage), nameof(CollectionsPage.draw), new Type[] { typeof(SpriteBatch) }),
postfix: new HarmonyMethod(typeof(GameMenuPatches), nameof(GameMenuPatches.CollectionsPagePatch))
);
#endregion
#region Menu Patches

View File

@ -330,6 +330,17 @@ namespace stardew_access.Patches
if (!__instance.IsActive())
return;
NarrateLetterContent(__instance);
}
catch (Exception e)
{
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
}
}
internal static void NarrateLetterContent(LetterViewerMenu __instance)
{
int x = Game1.getMousePosition().X, y = Game1.getMousePosition().Y;
#region Texts in the letter
string message = __instance.mailMessage[__instance.page];
@ -363,7 +374,7 @@ namespace stardew_access.Patches
if (__instance.mailMessage.Count > 1)
toSpeak = $"Page {__instance.page + 1} of {__instance.mailMessage.Count}:\n\t{toSpeak}";
MainClass.GetScreenReader().Say(toSpeak, false);
MainClass.GetScreenReader().Say(toSpeak, true);
}
#endregion
@ -390,11 +401,5 @@ namespace stardew_access.Patches
#endregion
}
catch (Exception e)
{
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
}
}
}
}

View File

@ -5,6 +5,7 @@ using StardewValley.Objects;
namespace stardew_access.Patches
{
// Menus in the game menu i.e., the menu which opens when we press `e`
internal class GameMenuPatches
{
internal static string hoveredItemQueryKey = "";
@ -19,11 +20,28 @@ namespace stardew_access.Patches
internal static string socialPageQuery = "";
internal static string profilePageQuery = "";
internal static string junimoNoteMenuQuery = "";
internal static string collectionsPageQuery = "";
internal static int currentSelectedCraftingRecipe = -1;
internal static bool isSelectingRecipe = false;
internal static bool isUsingCustomButtons = false;
internal static int currentIngredientListItem = -1, currentIngredientInputSlot = -1, currentInventorySlot = -1;
internal static void CollectionsPagePatch(CollectionsPage __instance)
{
try
{
int x = Game1.getMousePosition().X, y = Game1.getMousePosition().Y;
if (__instance.letterviewerSubMenu != null)
{
DialoguePatches.NarrateLetterContent(__instance.letterviewerSubMenu);
}
}
catch (System.Exception e)
{
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
}
}
internal static void JunimoNoteMenuPatch(JunimoNoteMenu __instance, bool ___specificBundlePage, int ___whichArea, Bundle ___currentPageBundle)
{
try