Mine elevator menu is accessible. Use wasd!

This commit is contained in:
shoaib11120
2022-01-03 19:47:58 +05:30
parent 8866e4f950
commit dda69f6b19
4 changed files with 42 additions and 18 deletions

View File

@@ -113,7 +113,7 @@ namespace stardew_access.Patches
try
{
// Fix for delete button hover text not narrating
if (Game1.activeClickableMenu is TitleMenuPatches && !((Game1.activeClickableMenu as TitleMenuPatches).GetChildMenu() is CharacterCustomization))
if (Game1.activeClickableMenu is TitleMenuPatches && !((Game1.activeClickableMenu as TitleMenu).GetChildMenu() is CharacterCustomization))
return;
if (Game1.activeClickableMenu is LetterViewerMenu || Game1.activeClickableMenu is QuestLog)
@@ -122,7 +122,7 @@ namespace stardew_access.Patches
if (Game1.activeClickableMenu is Billboard)
return;
StringBuilder toSpeak = new StringBuilder();
StringBuilder toSpeak = new StringBuilder(" ");
#region Add item count before title
if(hoveredItem != null && hoveredItem.HasBeenInInventory)
@@ -201,10 +201,14 @@ namespace stardew_access.Patches
#region Narrate toSpeak
// To prevent it from getting conflicted by two hover texts at the same time, two seperate methods are used.
// For example, sometimes `Welcome to Pierre's` and the items in seeds shop get conflicted causing it to speak infinitely.
if(Context.IsPlayerFree)
ScreenReader.sayWithChecker(toSpeak.ToString(), true); // Normal Checker
else
ScreenReader.sayWithMenuChecker(toSpeak.ToString(), true); // Normal Checker
if (toSpeak.ToString() != " ")
{
if (Context.IsPlayerFree)
ScreenReader.sayWithChecker(toSpeak.ToString(), true); // Normal Checker
else
ScreenReader.sayWithMenuChecker(toSpeak.ToString(), true); // Normal Checker
}
#endregion
}
catch (Exception e)

View File

@@ -1,10 +1,8 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Graphics;
using StardewModdingAPI;
using StardewValley;
using StardewValley.Menus;
using StardewValley.Quests;
using static StardewValley.Menus.LoadGameMenu;
namespace stardew_access.Patches
{
@@ -14,6 +12,26 @@ namespace stardew_access.Patches
private static string currentDailyQuestText = " ";
private static string currentLevelUpTitle = " ";
internal static void MineElevatorMenuPatch(List<ClickableComponent> ___elevators)
{
try
{
int x = Game1.getMousePosition(true).X, y = Game1.getMousePosition(true).Y; // Mouse x and y position
for (int i=0; i<___elevators.Count; i++)
{
if(___elevators[i].containsPoint(x, y))
{
ScreenReader.sayWithMenuChecker($"{___elevators[i].name} level", true);
break;
}
}
}
catch (Exception e)
{
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
internal static void NamingMenuPatch(NamingMenu __instance, string title, TextBox ___textBox)
{
try
@@ -51,8 +69,6 @@ namespace stardew_access.Patches
}
}
internal static void OptionsPagePatch(OptionsPage __instance)
{
try

View File

@@ -1,5 +1,4 @@

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using StardewModdingAPI;
using StardewValley;
using StardewValley.Menus;