Mine elevator menu is accessible. Use wasd!

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

View File

@ -74,12 +74,12 @@ namespace stardew_access
harmony.Patch(
original: AccessTools.Method(typeof(TitleMenu), nameof(TitleMenu.draw), new Type[] { typeof(SpriteBatch) }),
postfix: new HarmonyMethod(typeof(MenuPatch), nameof(TitleMenuPatches.TitleMenuPatch))
postfix: new HarmonyMethod(typeof(TitleMenuPatches), nameof(TitleMenuPatches.TitleMenuPatch))
);
harmony.Patch(
original: AccessTools.Method(typeof(LoadGameMenu.SaveFileSlot), nameof(LoadGameMenu.SaveFileSlot.Draw), new Type[] { typeof(SpriteBatch), typeof(int) }),
postfix: new HarmonyMethod(typeof(MenuPatch), nameof(TitleMenuPatches.LoadGameMenuPatch))
postfix: new HarmonyMethod(typeof(TitleMenuPatches), nameof(TitleMenuPatches.LoadGameMenuPatch))
);
harmony.Patch(
@ -89,7 +89,7 @@ namespace stardew_access
harmony.Patch(
original: AccessTools.Method(typeof(CharacterCustomization), nameof(CharacterCustomization.draw), new Type[] { typeof(SpriteBatch) }),
postfix: new HarmonyMethod(typeof(MenuPatch), nameof(TitleMenuPatches.NewGameMenuPatch))
postfix: new HarmonyMethod(typeof(TitleMenuPatches), nameof(TitleMenuPatches.NewGameMenuPatch))
);
harmony.Patch(
@ -119,12 +119,12 @@ namespace stardew_access
harmony.Patch(
original: AccessTools.Method(typeof(CoopMenu), nameof(CoopMenu.update), new Type[] { typeof(GameTime) }),
postfix: new HarmonyMethod(typeof(MenuPatch), nameof(TitleMenuPatches.CoopMenuPatch))
postfix: new HarmonyMethod(typeof(TitleMenuPatches), nameof(TitleMenuPatches.CoopMenuPatch))
);
harmony.Patch(
original: AccessTools.Method(typeof(ChatBox), nameof(ChatBox.update), new Type[] { typeof(GameTime) }),
postfix: new HarmonyMethod(typeof(MenuPatch), nameof(ChatManuPatches.ChatBoxPatch))
postfix: new HarmonyMethod(typeof(ChatManuPatches), nameof(ChatManuPatches.ChatBoxPatch))
);
harmony.Patch(
@ -142,6 +142,11 @@ namespace stardew_access
postfix: new HarmonyMethod(typeof(MenuPatch), nameof(MenuPatch.NamingMenuPatch))
);
harmony.Patch(
original: AccessTools.Method(typeof(MineElevatorMenu), nameof(MineElevatorMenu.draw), new Type[] { typeof(SpriteBatch) }),
postfix: new HarmonyMethod(typeof(MenuPatch), nameof(MenuPatch.MineElevatorMenuPatch))
);
#endregion
#region Custom Commands

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 (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;