Fixed letter viewer menu patch

master
Mohammad Shoaib 2022-03-19 14:30:37 +05:30
parent 49be1d3e6b
commit 5b0c6fe154
1 changed files with 15 additions and 2 deletions

View File

@ -281,6 +281,7 @@ namespace stardew_access.Patches
if (!__instance.IsActive()) if (!__instance.IsActive())
return; return;
int x = Game1.getMousePosition().X, y = Game1.getMousePosition().Y;
#region Texts in the letter #region Texts in the letter
string message = __instance.mailMessage[__instance.page]; string message = __instance.mailMessage[__instance.page];
@ -305,11 +306,14 @@ namespace stardew_access.Patches
currentLetterText = toSpeak; currentLetterText = toSpeak;
// snap mouse to accept quest button // snap mouse to accept quest button
if (__instance.acceptQuestButton != null && __instance.acceptQuestButton.visible) if (__instance.acceptQuestButton != null && __instance.questID != -1)
{ {
toSpeak += "\t\n Left click to accept quest."; toSpeak += "\t\n Left click to accept quest.";
__instance.acceptQuestButton.snapMouseCursorToCenter(); __instance.acceptQuestButton.snapMouseCursorToCenter();
} }
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, false);
} }
#endregion #endregion
@ -322,11 +326,20 @@ namespace stardew_access.Patches
string name = c.name; string name = c.name;
string label = c.label; string label = c.label;
if (c.containsPoint(Game1.getMousePosition().X, Game1.getMousePosition().Y)) if (c.containsPoint(x, y))
MainClass.GetScreenReader().SayWithChecker($"Grab: {name} \t\n {label}", false); MainClass.GetScreenReader().SayWithChecker($"Grab: {name} \t\n {label}", false);
} }
} }
#endregion #endregion
#region Narrate buttons
if (__instance.backButton != null && __instance.backButton.visible && __instance.backButton.containsPoint(x, y))
MainClass.GetScreenReader().SayWithChecker($"Previous page button", false);
if (__instance.forwardButton != null && __instance.forwardButton.visible && __instance.forwardButton.containsPoint(x, y))
MainClass.GetScreenReader().SayWithChecker($"Next page button", false);
#endregion
} }
catch (Exception e) catch (Exception e)
{ {