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( harmony.Patch(
original: AccessTools.Method(typeof(TitleMenu), nameof(TitleMenu.draw), new Type[] { typeof(SpriteBatch) }), 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( harmony.Patch(
original: AccessTools.Method(typeof(LoadGameMenu.SaveFileSlot), nameof(LoadGameMenu.SaveFileSlot.Draw), new Type[] { typeof(SpriteBatch), typeof(int) }), 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( harmony.Patch(
@ -89,7 +89,7 @@ namespace stardew_access
harmony.Patch( harmony.Patch(
original: AccessTools.Method(typeof(CharacterCustomization), nameof(CharacterCustomization.draw), new Type[] { typeof(SpriteBatch) }), 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( harmony.Patch(
@ -119,12 +119,12 @@ namespace stardew_access
harmony.Patch( harmony.Patch(
original: AccessTools.Method(typeof(CoopMenu), nameof(CoopMenu.update), new Type[] { typeof(GameTime) }), 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( harmony.Patch(
original: AccessTools.Method(typeof(ChatBox), nameof(ChatBox.update), new Type[] { typeof(GameTime) }), 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( harmony.Patch(
@ -142,6 +142,11 @@ namespace stardew_access
postfix: new HarmonyMethod(typeof(MenuPatch), nameof(MenuPatch.NamingMenuPatch)) 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 #endregion
#region Custom Commands #region Custom Commands

View File

@ -113,7 +113,7 @@ namespace stardew_access.Patches
try try
{ {
// Fix for delete button hover text not narrating // 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; return;
if (Game1.activeClickableMenu is LetterViewerMenu || Game1.activeClickableMenu is QuestLog) if (Game1.activeClickableMenu is LetterViewerMenu || Game1.activeClickableMenu is QuestLog)
@ -122,7 +122,7 @@ namespace stardew_access.Patches
if (Game1.activeClickableMenu is Billboard) if (Game1.activeClickableMenu is Billboard)
return; return;
StringBuilder toSpeak = new StringBuilder(); StringBuilder toSpeak = new StringBuilder(" ");
#region Add item count before title #region Add item count before title
if(hoveredItem != null && hoveredItem.HasBeenInInventory) if(hoveredItem != null && hoveredItem.HasBeenInInventory)
@ -201,10 +201,14 @@ namespace stardew_access.Patches
#region Narrate toSpeak #region Narrate toSpeak
// To prevent it from getting conflicted by two hover texts at the same time, two seperate methods are used. // 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. // 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 if (toSpeak.ToString() != " ")
else {
ScreenReader.sayWithMenuChecker(toSpeak.ToString(), true); // Normal Checker if (Context.IsPlayerFree)
ScreenReader.sayWithChecker(toSpeak.ToString(), true); // Normal Checker
else
ScreenReader.sayWithMenuChecker(toSpeak.ToString(), true); // Normal Checker
}
#endregion #endregion
} }
catch (Exception e) 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 StardewModdingAPI;
using StardewValley; using StardewValley;
using StardewValley.Menus; using StardewValley.Menus;
using StardewValley.Quests; using StardewValley.Quests;
using static StardewValley.Menus.LoadGameMenu;
namespace stardew_access.Patches namespace stardew_access.Patches
{ {
@ -14,6 +12,26 @@ namespace stardew_access.Patches
private static string currentDailyQuestText = " "; private static string currentDailyQuestText = " ";
private static string currentLevelUpTitle = " "; 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) internal static void NamingMenuPatch(NamingMenu __instance, string title, TextBox ___textBox)
{ {
try try
@ -51,8 +69,6 @@ namespace stardew_access.Patches
} }
} }
internal static void OptionsPagePatch(OptionsPage __instance) internal static void OptionsPagePatch(OptionsPage __instance)
{ {
try try

View File

@ -1,5 +1,4 @@
 using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using StardewModdingAPI; using StardewModdingAPI;
using StardewValley; using StardewValley;
using StardewValley.Menus; using StardewValley.Menus;