Moved exit page patch
parent
820d714594
commit
8d11cc6266
|
@ -75,7 +75,7 @@ namespace stardew_access
|
|||
|
||||
harmony.Patch(
|
||||
original: AccessTools.Method(typeof(ExitPage), nameof(ExitPage.draw), new Type[] { typeof(SpriteBatch) }),
|
||||
postfix: new HarmonyMethod(typeof(GameMenuPatches), nameof(GameMenuPatches.ExitPagePatch))
|
||||
postfix: new HarmonyMethod(typeof(ExitPagePatch), nameof(ExitPagePatch.DrawPatch))
|
||||
);
|
||||
|
||||
harmony.Patch(
|
||||
|
|
|
@ -4,13 +4,9 @@ using StardewValley.Objects;
|
|||
|
||||
namespace stardew_access.Patches
|
||||
{
|
||||
// Menus in the game menu i.e., the menu which opens when we press `e`
|
||||
internal class GameMenuPatches
|
||||
{
|
||||
internal static string hoveredItemQueryKey = "";
|
||||
internal static string gameMenuQueryKey = "";
|
||||
internal static string exitPageQueryKey = "";
|
||||
internal static string profilePageQuery = "";
|
||||
|
||||
internal static void GameMenuPatch(GameMenu __instance)
|
||||
{
|
||||
|
@ -42,41 +38,5 @@ namespace stardew_access.Patches
|
|||
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal static void ExitPagePatch(ExitPage __instance)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (__instance.exitToTitle.visible &&
|
||||
__instance.exitToTitle.containsPoint(Game1.getMouseX(true), Game1.getMouseY(true)))
|
||||
{
|
||||
string toSpeak = "Exit to Title Button";
|
||||
if (exitPageQueryKey != toSpeak)
|
||||
{
|
||||
gameMenuQueryKey = "";
|
||||
exitPageQueryKey = toSpeak;
|
||||
MainClass.ScreenReader.Say(toSpeak, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (__instance.exitToDesktop.visible &&
|
||||
__instance.exitToDesktop.containsPoint(Game1.getMouseX(true), Game1.getMouseY(true)))
|
||||
{
|
||||
string toSpeak = "Exit to Desktop Button";
|
||||
if (exitPageQueryKey != toSpeak)
|
||||
{
|
||||
gameMenuQueryKey = "";
|
||||
exitPageQueryKey = toSpeak;
|
||||
MainClass.ScreenReader.Say(toSpeak, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
using StardewValley;
|
||||
using StardewValley.Menus;
|
||||
|
||||
namespace stardew_access.Patches
|
||||
{
|
||||
internal class ExitPagePatch
|
||||
{
|
||||
internal static string exitPageQueryKey = "";
|
||||
|
||||
internal static void DrawPatch(ExitPage __instance)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (__instance.exitToTitle.visible &&
|
||||
__instance.exitToTitle.containsPoint(Game1.getMouseX(true), Game1.getMouseY(true)))
|
||||
{
|
||||
string toSpeak = "Exit to Title Button";
|
||||
if (exitPageQueryKey != toSpeak)
|
||||
{
|
||||
exitPageQueryKey = toSpeak;
|
||||
MainClass.ScreenReader.Say(toSpeak, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (__instance.exitToDesktop.visible &&
|
||||
__instance.exitToDesktop.containsPoint(Game1.getMouseX(true), Game1.getMouseY(true)))
|
||||
{
|
||||
string toSpeak = "Exit to Desktop Button";
|
||||
if (exitPageQueryKey != toSpeak)
|
||||
{
|
||||
exitPageQueryKey = toSpeak;
|
||||
MainClass.ScreenReader.Say(toSpeak, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
|
||||
}
|
||||
}
|
||||
|
||||
internal static void Cleanup()
|
||||
{
|
||||
exitPageQueryKey = "";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -34,7 +34,7 @@ namespace stardew_access.Patches
|
|||
else if (menu is GameMenu)
|
||||
{
|
||||
GameMenuPatches.gameMenuQueryKey = "";
|
||||
GameMenuPatches.exitPageQueryKey = "";
|
||||
ExitPagePatch.Cleanup();
|
||||
OptionsPagePatch.Cleanup();
|
||||
SocialPagePatch.Cleanup();
|
||||
InventoryPagePatch.Cleanup();
|
||||
|
|
Loading…
Reference in New Issue