Made the letter/mailbox menu accessible
parent
099f5b02e1
commit
afa173d66e
|
@ -58,5 +58,23 @@ namespace stardew_access.Game
|
||||||
int y = (int)player.getTileLocation().Y;
|
int y = (int)player.getTileLocation().Y;
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static int getToolHItPositionX()
|
||||||
|
{
|
||||||
|
if (player == null)
|
||||||
|
initPlayer();
|
||||||
|
|
||||||
|
int x = (int)player.GetGrabTile().X;
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static int getToolHItPositionY()
|
||||||
|
{
|
||||||
|
if (player == null)
|
||||||
|
initPlayer();
|
||||||
|
|
||||||
|
int y = (int)player.GetGrabTile().Y;
|
||||||
|
return y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ using StardewValley.Menus;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using stardew_access.Patches;
|
using stardew_access.Patches;
|
||||||
using AutoHotkey.Interop;
|
using AutoHotkey.Interop;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
|
||||||
namespace stardew_access
|
namespace stardew_access
|
||||||
{
|
{
|
||||||
|
@ -85,9 +86,30 @@ namespace stardew_access
|
||||||
postfix: new HarmonyMethod(typeof(MenuPatch), nameof(MenuPatch.NewGameMenuPatch))
|
postfix: new HarmonyMethod(typeof(MenuPatch), nameof(MenuPatch.NewGameMenuPatch))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
harmony.Patch(
|
||||||
|
original: AccessTools.Method(typeof(LetterViewerMenu), nameof(LetterViewerMenu.draw), new Type[] { typeof(SpriteBatch) }),
|
||||||
|
postfix: new HarmonyMethod(typeof(MenuPatch), nameof(MenuPatch.LetterViewerMenuPatch))
|
||||||
|
);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
helper.Events.Input.ButtonPressed += this.OnButtonPressed;
|
helper.Events.Input.ButtonPressed += this.OnButtonPressed;
|
||||||
|
helper.Events.GameLoop.UpdateTicked += this.onUpdateTicked;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onUpdateTicked(object sender, UpdateTickedEventArgs e)
|
||||||
|
{
|
||||||
|
if (!Context.IsPlayerFree)
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void On1SecUpdateTicked(object sender, OneSecondUpdateTickedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnButtonPressed(object sender, ButtonPressedEventArgs e)
|
private void OnButtonPressed(object sender, ButtonPressedEventArgs e)
|
||||||
|
@ -104,7 +126,7 @@ namespace stardew_access
|
||||||
// Narrate Position
|
// Narrate Position
|
||||||
if (Equals(e.Button, SButton.K))
|
if (Equals(e.Button, SButton.K))
|
||||||
{
|
{
|
||||||
string toSpeak = $"X: {CurrentPlayer.getPositionX()} , Y: {CurrentPlayer.getPositionX()}";
|
string toSpeak = $"X: {CurrentPlayer.getPositionX()} , Y: {CurrentPlayer.getPositionY()}";
|
||||||
ScreenReader.say(toSpeak, true);
|
ScreenReader.say(toSpeak, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,67 @@ namespace stardew_access.Patches
|
||||||
{
|
{
|
||||||
private static int saveGameIndex = -1;
|
private static int saveGameIndex = -1;
|
||||||
private static bool isRunning = false;
|
private static bool isRunning = false;
|
||||||
|
private static string currentLetterText = " ";
|
||||||
|
|
||||||
|
internal static void LetterViewerMenuPatch(LetterViewerMenu __instance)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!__instance.IsActive())
|
||||||
|
return;
|
||||||
|
|
||||||
|
#region Texts in the letter
|
||||||
|
string title = __instance.mailTitle;
|
||||||
|
string message = __instance.mailMessage[__instance.page];
|
||||||
|
|
||||||
|
string toSpeak = $"{title} \t\n\t {message}.";
|
||||||
|
|
||||||
|
if (__instance.ShouldShowInteractable())
|
||||||
|
{
|
||||||
|
if (__instance.moneyIncluded > 0)
|
||||||
|
{
|
||||||
|
string moneyText = Game1.content.LoadString("Strings\\UI:LetterViewer_MoneyIncluded", __instance.moneyIncluded);
|
||||||
|
toSpeak += $"\t\n\t ,Included money: {moneyText}";
|
||||||
|
}
|
||||||
|
else if (__instance.learnedRecipe != null && __instance.learnedRecipe.Length > 0)
|
||||||
|
{
|
||||||
|
string recipeText = Game1.content.LoadString("Strings\\UI:LetterViewer_LearnedRecipe", __instance.cookingOrCrafting);
|
||||||
|
toSpeak += $"\t\n\t ,Learned Recipe: {recipeText}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (__instance.ShouldShowInteractable() && __instance.questID != -1)
|
||||||
|
{
|
||||||
|
toSpeak += "\t\n\t ,Close this menu to accept or press left click button";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentLetterText != toSpeak)
|
||||||
|
{
|
||||||
|
currentLetterText = toSpeak;
|
||||||
|
ScreenReader.say(toSpeak, false);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Narrate items given in the mail
|
||||||
|
if (__instance.ShouldShowInteractable())
|
||||||
|
{
|
||||||
|
foreach (ClickableComponent c in __instance.itemsToGrab)
|
||||||
|
{
|
||||||
|
string name = c.name;
|
||||||
|
string label = c.label;
|
||||||
|
|
||||||
|
if (c.containsPoint(Game1.getMousePosition().X, Game1.getMousePosition().Y))
|
||||||
|
ScreenReader.sayWithChecker($"Grab: {name} \t\n {label}", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
|
||||||
|
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal static void TitleMenuPatch(TitleMenu __instance)
|
internal static void TitleMenuPatch(TitleMenu __instance)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace stardew_access
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MainClass.monitor.Log($"Error initializing NVDA:\n{ex.StackTrace}", LogLevel.Error);
|
MainClass.monitor.Log($"Error initializing NVDA:\n{ex.StackTrace}", LogLevel.Info);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize JAWS
|
// Initialize JAWS
|
||||||
|
@ -31,7 +31,7 @@ namespace stardew_access
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MainClass.monitor.Log($"Error initializing JAWS:\n{ex.StackTrace}", LogLevel.Error);
|
MainClass.monitor.Log($"Error initializing JAWS:\n{ex.StackTrace}", LogLevel.Info);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize SAPI
|
// Initialize SAPI
|
||||||
|
@ -41,7 +41,7 @@ namespace stardew_access
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MainClass.monitor.Log($"Error initializing SAPI:\n{ex.StackTrace}", LogLevel.Error);
|
MainClass.monitor.Log($"Error initializing SAPI:\n{ex.StackTrace}", LogLevel.Info);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nvdaOutput != null && nvdaOutput.IsAvailable())
|
if (nvdaOutput != null && nvdaOutput.IsAvailable())
|
||||||
|
|
Loading…
Reference in New Issue