Added mod config with keybindings
parent
9607a008e0
commit
fb087476d2
|
@ -16,6 +16,7 @@ namespace stardew_access
|
|||
helper.ConsoleCommands.Add("readtile", "Toggle read tile feature.", (string commmand, string[] args) =>
|
||||
{
|
||||
MainClass.Config.ReadTile = !MainClass.Config.ReadTile;
|
||||
MainClass.ModHelper.WriteConfig(MainClass.Config);
|
||||
|
||||
MainClass.DebugLog("Read Tile is " + (MainClass.Config.ReadTile ? "on" : "off"));
|
||||
});
|
||||
|
@ -23,6 +24,7 @@ namespace stardew_access
|
|||
helper.ConsoleCommands.Add("snapmouse", "Toggle snap mouse feature.", (string commmand, string[] args) =>
|
||||
{
|
||||
MainClass.Config.SnapMouse = !MainClass.Config.SnapMouse;
|
||||
MainClass.ModHelper.WriteConfig(MainClass.Config);
|
||||
|
||||
MainClass.DebugLog("Snap Mouse is " + (MainClass.Config.SnapMouse ? "on" : "off"));
|
||||
});
|
||||
|
@ -30,6 +32,7 @@ namespace stardew_access
|
|||
helper.ConsoleCommands.Add("flooring", "Toggle flooring in read tile.", (string commmand, string[] args) =>
|
||||
{
|
||||
MainClass.Config.ReadFlooring = !MainClass.Config.ReadFlooring;
|
||||
MainClass.ModHelper.WriteConfig(MainClass.Config);
|
||||
|
||||
MainClass.DebugLog("Flooring is " + (MainClass.Config.ReadFlooring ? "on" : "off"));
|
||||
});
|
||||
|
@ -37,6 +40,7 @@ namespace stardew_access
|
|||
helper.ConsoleCommands.Add("radar", "Toggle radar feature.", (string commmand, string[] args) =>
|
||||
{
|
||||
MainClass.Config.Radar = !MainClass.Config.Radar;
|
||||
MainClass.ModHelper.WriteConfig(MainClass.Config);
|
||||
|
||||
MainClass.DebugLog("Radar " + (MainClass.Config.Radar ? "on" : "off"));
|
||||
});
|
||||
|
@ -52,6 +56,7 @@ namespace stardew_access
|
|||
helper.ConsoleCommands.Add("rstereo", "Toggle stereo sound in radar feature.", (string commmand, string[] args) =>
|
||||
{
|
||||
MainClass.Config.RadarStereoSound = !MainClass.Config.RadarStereoSound;
|
||||
MainClass.ModHelper.WriteConfig(MainClass.Config);
|
||||
|
||||
MainClass.DebugLog("Stereo sound is " + (MainClass.Config.RadarStereoSound ? "on" : "off"));
|
||||
});
|
||||
|
@ -466,6 +471,13 @@ namespace stardew_access
|
|||
|
||||
MainClass.DebugLog("Screen Reader refreshed!");
|
||||
});
|
||||
|
||||
helper.ConsoleCommands.Add("refmc", "Refresh mod config", (string commmand, string[] args) =>
|
||||
{
|
||||
MainClass.Config = helper.ReadConfig<ModConfig>();
|
||||
|
||||
MainClass.DebugLog("Mod Config refreshed!");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace stardew_access
|
|||
|
||||
harmony.Patch(
|
||||
original: AccessTools.Method(typeof(CharacterCustomization), nameof(CharacterCustomization.draw), new Type[] { typeof(SpriteBatch) }),
|
||||
postfix: new HarmonyMethod(typeof(TitleMenuPatches), nameof(TitleMenuPatches.NewGameMenuPatch))
|
||||
postfix: new HarmonyMethod(typeof(TitleMenuPatches), nameof(TitleMenuPatches.CharacterCustomizationMenuPatch))
|
||||
);
|
||||
|
||||
harmony.Patch(
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
namespace stardew_access
|
||||
using StardewModdingAPI.Utilities;
|
||||
|
||||
namespace stardew_access
|
||||
{
|
||||
internal class ModConfig
|
||||
{
|
||||
|
@ -9,5 +11,21 @@
|
|||
public Boolean RadarStereoSound { get; set; } = true;
|
||||
public Boolean ReadFlooring { get; set; } = false;
|
||||
|
||||
#region KeyBinds
|
||||
|
||||
// https://stardewvalleywiki.com/Modding:Modder_Guide/APIs/Input#SButton button key codes
|
||||
public KeybindList LeftClickMainKey { get; set; } = KeybindList.Parse("LeftControl + Enter");
|
||||
public KeybindList RightClickMainKey { get; set; } = KeybindList.Parse("LeftShift + Enter");
|
||||
public KeybindList LeftClickAlternateKey { get; set; } = KeybindList.Parse("OemOpenBrackets");
|
||||
public KeybindList RightClickAlternateKey { get; set; } = KeybindList.Parse("OemCloseBrackets");
|
||||
public KeybindList HealthNStaminaKey { get; set; } = KeybindList.Parse("H");
|
||||
public KeybindList PositionKey { get; set; } = KeybindList.Parse("K");
|
||||
public KeybindList LocationKey { get; set; } = KeybindList.Parse("LeftAlt + K");
|
||||
public KeybindList MoneyKey { get; set; } = KeybindList.Parse("R");
|
||||
public KeybindList TimeNSeasonKey { get; set; } = KeybindList.Parse("Q");
|
||||
public KeybindList ReadTileKey { get; set; } = KeybindList.Parse("J");
|
||||
public KeybindList ReadStandingTileKey { get; set; } = KeybindList.Parse("LeftAlt + J");
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,39 +144,34 @@ namespace stardew_access
|
|||
bool isLeftControlPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftControl);
|
||||
bool isCustomizingChrachter = Game1.activeClickableMenu is CharacterCustomization || (TitleMenu.subMenu != null && TitleMenu.subMenu is CharacterCustomization);
|
||||
|
||||
// Perform Left Click
|
||||
if (!isCustomizingChrachter && Equals(e.Button, SButton.OemOpenBrackets)) // Excluding the character creation menu
|
||||
#region Mouse Click Simulation
|
||||
// Main Keybinds
|
||||
if (isLeftControlPressed && Config.LeftClickMainKey.JustPressed())
|
||||
{
|
||||
Game1.activeClickableMenu.receiveLeftClick(Game1.getMouseX(true), Game1.getMouseY(true));
|
||||
}
|
||||
if (isLeftControlPressed && Equals(e.Button, SButton.Enter))
|
||||
if (isLeftShiftPressed && Config.RightClickMainKey.JustPressed())
|
||||
{
|
||||
Game1.activeClickableMenu.receiveLeftClick(Game1.getMouseX(true), Game1.getMouseY(true));
|
||||
Game1.activeClickableMenu.receiveRightClick(Game1.getMouseX(true), Game1.getMouseY(true));
|
||||
}
|
||||
|
||||
// Perform Right CLick
|
||||
if (!isCustomizingChrachter && Equals(e.Button, SButton.OemCloseBrackets)) // Excluding the character creation menu
|
||||
{
|
||||
Game1.activeClickableMenu.receiveRightClick(Game1.getMouseX(true), Game1.getMouseY(true));
|
||||
}
|
||||
if (isLeftShiftPressed && Equals(e.Button, SButton.Enter))
|
||||
// Alternate Keybinds
|
||||
if (!isCustomizingChrachter && Config.LeftClickAlternateKey.JustPressed()) // Excluding the character creation menu
|
||||
{
|
||||
Game1.activeClickableMenu.receiveLeftClick(Game1.getMouseX(true), Game1.getMouseY(true));
|
||||
}
|
||||
if (!isCustomizingChrachter && Config.RightClickAlternateKey.JustPressed()) // Excluding the character creation menu
|
||||
{
|
||||
Game1.activeClickableMenu.receiveRightClick(Game1.getMouseX(true), Game1.getMouseY(true));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
if (!Context.IsPlayerFree)
|
||||
return;
|
||||
|
||||
// Narrate health and stamina
|
||||
if (Equals(e.Button, SButton.H))
|
||||
{
|
||||
string toSpeak = $"Health is {CurrentPlayer.getHealth()} and Stamina is {CurrentPlayer.getStamina()}";
|
||||
MainClass.GetScreenReader().Say(toSpeak, true);
|
||||
}
|
||||
|
||||
// Narrate Position
|
||||
if (Equals(e.Button, SButton.K) && !isLeftAltPressed)
|
||||
if (Config.PositionKey.JustPressed())
|
||||
{
|
||||
string toSpeak;
|
||||
if (Config.VerboseCoordinates)
|
||||
|
@ -189,46 +184,54 @@ namespace stardew_access
|
|||
}
|
||||
|
||||
MainClass.GetScreenReader().Say(toSpeak, true);
|
||||
return;
|
||||
}
|
||||
|
||||
// Narrate health and stamina
|
||||
if (Config.HealthNStaminaKey.JustPressed())
|
||||
{
|
||||
string toSpeak = $"Health is {CurrentPlayer.getHealth()} and Stamina is {CurrentPlayer.getStamina()}";
|
||||
MainClass.GetScreenReader().Say(toSpeak, true);
|
||||
return;
|
||||
}
|
||||
|
||||
// Narrate Current Location
|
||||
if (Equals(e.Button, SButton.K) && isLeftAltPressed)
|
||||
if (Config.LocationKey.JustPressed())
|
||||
{
|
||||
string toSpeak = $"{Game1.currentLocation.Name}";
|
||||
MainClass.GetScreenReader().Say(toSpeak, true);
|
||||
return;
|
||||
}
|
||||
|
||||
// Narrate money at hand
|
||||
if (Equals(e.Button, SButton.R))
|
||||
if (Config.MoneyKey.JustPressed())
|
||||
{
|
||||
string toSpeak = $"You have {CurrentPlayer.getMoney()}g";
|
||||
MainClass.GetScreenReader().Say(toSpeak, true);
|
||||
return;
|
||||
}
|
||||
|
||||
// Narrate time and season
|
||||
if (Equals(e.Button, SButton.Q))
|
||||
if (Config.TimeNSeasonKey.JustPressed())
|
||||
{
|
||||
string toSpeak = $"Time is {CurrentPlayer.getTimeOfDay()} and it is {CurrentPlayer.getDay()} {CurrentPlayer.getDate()} of {CurrentPlayer.getSeason()}";
|
||||
MainClass.GetScreenReader().Say(toSpeak, true);
|
||||
}
|
||||
|
||||
// Manual read tile at looking tile
|
||||
if (Equals(e.Button, SButton.J) && !isLeftAltPressed)
|
||||
{
|
||||
ReadTile.run(manuallyTriggered: true);
|
||||
return;
|
||||
}
|
||||
|
||||
// Manual read tile at player's position
|
||||
if (Equals(e.Button, SButton.J) && isLeftAltPressed)
|
||||
if (Config.ReadStandingTileKey.JustPressed())
|
||||
{
|
||||
ReadTile.run(manuallyTriggered: true, playersPosition: true);
|
||||
return;
|
||||
}
|
||||
|
||||
/*if (Equals(e.Button, SButton.B))
|
||||
// Manual read tile at looking tile
|
||||
if (Config.ReadTileKey.JustPressed())
|
||||
{
|
||||
Game1.player.controller = new PathFindController(Game1.player, Game1.currentLocation, new Point(49,13), 2);
|
||||
monitor.Log($"{Game1.player.controller.pathToEndPoint==null}", LogLevel.Debug); // true if path not found
|
||||
}*/
|
||||
ReadTile.run(manuallyTriggered: true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public static void ErrorLog(string message)
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace stardew_access.Patches
|
|||
{
|
||||
try
|
||||
{
|
||||
int x = Game1.getMouseX(), y = Game1.getMouseY(); // Mouse x and y position
|
||||
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
|
||||
purchaseAnimalsMenu = __instance;
|
||||
isOnFarm = ___onFarm;
|
||||
|
||||
|
@ -125,7 +125,7 @@ namespace stardew_access.Patches
|
|||
if (currentBluprint == null)
|
||||
return;
|
||||
|
||||
int x = Game1.getMouseX(), y = Game1.getMouseY(); // Mouse x and y position
|
||||
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
|
||||
bool isBPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.B);
|
||||
string ingredients = "";
|
||||
string name = currentBluprint.displayName;
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace stardew_access.Patches
|
|||
{
|
||||
try
|
||||
{
|
||||
int x = Game1.getMouseX(), y = Game1.getMouseY(); // Mouse x and y position
|
||||
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
|
||||
if (!___specificBundlePage)
|
||||
{
|
||||
currentIngredientListItem = -1;
|
||||
|
@ -300,7 +300,7 @@ namespace stardew_access.Patches
|
|||
{
|
||||
try
|
||||
{
|
||||
int x = Game1.getMouseX(), y = Game1.getMouseY(); // Mouse x and y position
|
||||
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
|
||||
for (int i = ___slotPosition; i < ___slotPosition + 5; i++)
|
||||
{
|
||||
if (i < ___sprites.Count)
|
||||
|
@ -308,7 +308,7 @@ namespace stardew_access.Patches
|
|||
if (__instance.names[i] is string)
|
||||
{
|
||||
#region For NPCs
|
||||
if (__instance.characterSlots[i].bounds.Contains(Game1.getMouseX(), Game1.getMouseY()))
|
||||
if (__instance.characterSlots[i].bounds.Contains(Game1.getMouseX(true), Game1.getMouseY(true)))
|
||||
{
|
||||
string name = $"{__instance.names[i] as string}";
|
||||
int heartLevel = Game1.player.getFriendshipHeartLevelForNPC(name);
|
||||
|
@ -448,7 +448,7 @@ namespace stardew_access.Patches
|
|||
{
|
||||
try
|
||||
{
|
||||
int x = Game1.getMouseX(), y = Game1.getMouseY(); // Mouse x and y position
|
||||
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
|
||||
bool isIPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.I);
|
||||
bool isLeftShiftPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftShift);
|
||||
|
||||
|
@ -560,7 +560,7 @@ namespace stardew_access.Patches
|
|||
if (__instance.currentTab != 0 && __instance.currentTab != 4 && __instance.currentTab != 6 && __instance.currentTab != 7)
|
||||
return;
|
||||
|
||||
int x = Game1.getMouseX(), y = Game1.getMouseY(); // Mouse x and y position
|
||||
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
|
||||
|
||||
for (int i = 0; i < __instance.tabs.Count; i++)
|
||||
{
|
||||
|
@ -586,7 +586,7 @@ namespace stardew_access.Patches
|
|||
{
|
||||
try
|
||||
{
|
||||
int x = Game1.getMouseX(), y = Game1.getMouseY(); // Mouse x and y position
|
||||
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
|
||||
|
||||
#region Narrate the treasure recieved on breaking the geode
|
||||
if (__instance.geodeTreasure != null)
|
||||
|
@ -670,7 +670,7 @@ namespace stardew_access.Patches
|
|||
{
|
||||
try
|
||||
{
|
||||
int x = Game1.getMouseX(), y = Game1.getMouseY(); // Mouse x and y position
|
||||
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
|
||||
bool isIPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.I);
|
||||
bool isLeftShiftPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftShift);
|
||||
|
||||
|
@ -934,7 +934,7 @@ namespace stardew_access.Patches
|
|||
{
|
||||
try
|
||||
{
|
||||
int x = Game1.getMouseX(), y = Game1.getMouseY(); // Mouse x and y position
|
||||
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
|
||||
bool isIPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.I);
|
||||
bool isCPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.C);
|
||||
bool isLeftShiftPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftShift);
|
||||
|
@ -1138,7 +1138,7 @@ namespace stardew_access.Patches
|
|||
{
|
||||
try
|
||||
{
|
||||
int x = Game1.getMouseX(), y = Game1.getMouseY(); // Mouse x and y position
|
||||
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
|
||||
|
||||
#region Narrate buttons in the menu
|
||||
if (__instance.inventory.dropItemInvisibleButton != null && __instance.inventory.dropItemInvisibleButton.containsPoint(x, y))
|
||||
|
@ -1326,7 +1326,7 @@ namespace stardew_access.Patches
|
|||
try
|
||||
{
|
||||
int currentItemIndex = Math.Max(0, Math.Min(__instance.options.Count - 7, __instance.currentItemIndex));
|
||||
int x = Game1.getMouseX(), y = Game1.getMouseY();
|
||||
int x = Game1.getMouseX(true), y = Game1.getMouseY(true);
|
||||
for (int i = 0; i < __instance.optionSlots.Count; i++)
|
||||
{
|
||||
if (__instance.optionSlots[i].bounds.Contains(x, y) && currentItemIndex + i < __instance.options.Count && __instance.options[currentItemIndex + i].bounds.Contains(x - __instance.optionSlots[i].bounds.X, y - __instance.optionSlots[i].bounds.Y))
|
||||
|
@ -1379,7 +1379,7 @@ namespace stardew_access.Patches
|
|||
try
|
||||
{
|
||||
if (__instance.exitToTitle.visible &&
|
||||
__instance.exitToTitle.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
|
||||
__instance.exitToTitle.containsPoint(Game1.getMouseX(true), Game1.getMouseY(true)))
|
||||
{
|
||||
string toSpeak = "Exit to Title Button";
|
||||
if (exitPageQueryKey != toSpeak)
|
||||
|
@ -1391,7 +1391,7 @@ namespace stardew_access.Patches
|
|||
return;
|
||||
}
|
||||
if (__instance.exitToDesktop.visible &&
|
||||
__instance.exitToDesktop.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
|
||||
__instance.exitToDesktop.containsPoint(Game1.getMouseX(true), Game1.getMouseY(true)))
|
||||
{
|
||||
string toSpeak = "Exit to Desktop Button";
|
||||
if (exitPageQueryKey != toSpeak)
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace stardew_access.Patches
|
|||
{
|
||||
try
|
||||
{
|
||||
int x = Game1.getMouseX(), y = Game1.getMouseY(); // Mouse x and y position
|
||||
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
|
||||
|
||||
if (__instance.heldItem != null)
|
||||
{
|
||||
|
@ -188,7 +188,7 @@ namespace stardew_access.Patches
|
|||
{
|
||||
try
|
||||
{
|
||||
int x = Game1.getMouseX(), y = Game1.getMouseY(); // Mouse x and y position
|
||||
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
|
||||
|
||||
if (__instance.nextPageButton != null && __instance.nextPageButton.containsPoint(x, y))
|
||||
{
|
||||
|
@ -221,7 +221,7 @@ namespace stardew_access.Patches
|
|||
{
|
||||
try
|
||||
{
|
||||
int x = Game1.getMouseX(), y = Game1.getMouseY(); // Mouse x and y position
|
||||
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
|
||||
for (int i = 0; i < ___elevators.Count; i++)
|
||||
{
|
||||
if (___elevators[i].containsPoint(x, y))
|
||||
|
@ -257,7 +257,7 @@ namespace stardew_access.Patches
|
|||
{
|
||||
try
|
||||
{
|
||||
int x = Game1.getMouseX(), y = Game1.getMouseY();
|
||||
int x = Game1.getMouseX(true), y = Game1.getMouseY(true);
|
||||
|
||||
MainClass.GetScreenReader().SayWithMenuChecker(___message, true);
|
||||
if (__instance.okButton.containsPoint(x, y))
|
||||
|
@ -279,13 +279,9 @@ namespace stardew_access.Patches
|
|||
{
|
||||
try
|
||||
{
|
||||
int x = Game1.getMouseX(), y = Game1.getMouseY();
|
||||
int x = Game1.getMouseX(true), y = Game1.getMouseY(true);
|
||||
string leftProfession = " ", rightProfession = " ", extraInfo = " ", newCraftingRecipe = " ", toSpeak = " ";
|
||||
|
||||
bool isOpenBracketPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.OemOpenBrackets); // for left click
|
||||
bool isLeftCtrlPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftControl);
|
||||
bool isEnterPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Enter);
|
||||
|
||||
if (!__instance.informationUp)
|
||||
{
|
||||
return;
|
||||
|
@ -307,7 +303,7 @@ namespace stardew_access.Patches
|
|||
|
||||
if (__instance.leftProfession.containsPoint(x, y))
|
||||
{
|
||||
if (isOpenBracketPressed || (isLeftCtrlPressed && isEnterPressed && __instance.readyToClose()))
|
||||
if ((MainClass.Config.LeftClickMainKey.JustPressed() || MainClass.Config.LeftClickAlternateKey.JustPressed()) && __instance.readyToClose())
|
||||
{
|
||||
Game1.player.professions.Add(___professionsToChoose[0]);
|
||||
__instance.getImmediateProfessionPerk(___professionsToChoose[0]);
|
||||
|
@ -324,7 +320,7 @@ namespace stardew_access.Patches
|
|||
|
||||
if (__instance.rightProfession.containsPoint(x, y))
|
||||
{
|
||||
if (isOpenBracketPressed || (isLeftCtrlPressed && isEnterPressed && __instance.readyToClose()))
|
||||
if ((MainClass.Config.LeftClickMainKey.JustPressed() || MainClass.Config.LeftClickAlternateKey.JustPressed()) && __instance.readyToClose())
|
||||
{
|
||||
Game1.player.professions.Add(___professionsToChoose[1]);
|
||||
__instance.getImmediateProfessionPerk(___professionsToChoose[1]);
|
||||
|
@ -356,7 +352,7 @@ namespace stardew_access.Patches
|
|||
|
||||
if (__instance.okButton.containsPoint(x, y))
|
||||
{
|
||||
if (isOpenBracketPressed || (isLeftCtrlPressed && isEnterPressed))
|
||||
if (MainClass.Config.LeftClickMainKey.JustPressed() || MainClass.Config.LeftClickAlternateKey.JustPressed())
|
||||
__instance.okButtonClicked();
|
||||
|
||||
toSpeak = $"{___title} {extraInfo} {newCraftingRecipe}. Left click to close.";
|
||||
|
@ -380,18 +376,15 @@ namespace stardew_access.Patches
|
|||
{
|
||||
try
|
||||
{
|
||||
bool isLeftControlPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftControl);
|
||||
bool isOpenBracketPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.OemOpenBrackets); // for left click
|
||||
bool isEnterPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Enter);
|
||||
|
||||
if (__instance.currentPage == -1)
|
||||
{
|
||||
int total = ___categoryTotals[5];
|
||||
string toSpeak;
|
||||
if (__instance.okButton.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
|
||||
if (__instance.okButton.containsPoint(Game1.getMouseX(true), Game1.getMouseY(true)))
|
||||
{
|
||||
// Perform Left Click
|
||||
if (isOpenBracketPressed || (isLeftControlPressed && isEnterPressed))
|
||||
if (MainClass.Config.LeftClickMainKey.JustPressed() || MainClass.Config.LeftClickAlternateKey.JustPressed())
|
||||
{
|
||||
Game1.activeClickableMenu.receiveLeftClick(Game1.getMouseX(true), Game1.getMouseY(true));
|
||||
}
|
||||
|
@ -400,7 +393,7 @@ namespace stardew_access.Patches
|
|||
}
|
||||
for (int i = 0; i < __instance.categories.Count; i++)
|
||||
{
|
||||
if (__instance.categories[i].containsPoint(Game1.getMouseX(), Game1.getMouseY()))
|
||||
if (__instance.categories[i].containsPoint(Game1.getMouseX(true), Game1.getMouseY(true)))
|
||||
{
|
||||
toSpeak = $"Money recieved from {__instance.getCategoryName(i)}: {___categoryTotals[i]}g.";
|
||||
MainClass.GetScreenReader().SayWithChecker(toSpeak, true);
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace stardew_access.Patches
|
|||
{
|
||||
try
|
||||
{
|
||||
int x = Game1.getMouseX(), y = Game1.getMouseY(); // Mouse x and y position
|
||||
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
|
||||
|
||||
if (__instance.acceptLeftQuestButton.visible && __instance.acceptLeftQuestButton.containsPoint(x, y))
|
||||
{
|
||||
|
@ -83,7 +83,7 @@ namespace stardew_access.Patches
|
|||
#region Callender
|
||||
for (int i = 0; i < __instance.calendarDays.Count; i++)
|
||||
{
|
||||
if (__instance.calendarDays[i].containsPoint(Game1.getMouseX(), Game1.getMouseY()))
|
||||
if (__instance.calendarDays[i].containsPoint(Game1.getMouseX(true), Game1.getMouseY(true)))
|
||||
{
|
||||
string toSpeak = $"Day {i + 1}";
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using StardewModdingAPI;
|
||||
using StardewValley;
|
||||
using StardewValley;
|
||||
using StardewValley.Menus;
|
||||
using static StardewValley.Menus.LoadGameMenu;
|
||||
|
||||
|
@ -16,7 +14,7 @@ namespace stardew_access.Patches
|
|||
{
|
||||
try
|
||||
{
|
||||
int x = Game1.getMouseX(), y = Game1.getMouseY();
|
||||
int x = Game1.getMouseX(true), y = Game1.getMouseY(true);
|
||||
string toSpeak = " ";
|
||||
|
||||
#region Join/Host Button (Important! This should be checked before checking other buttons)
|
||||
|
@ -64,7 +62,7 @@ namespace stardew_access.Patches
|
|||
|
||||
__instance.buttons.ForEach(component =>
|
||||
{
|
||||
if (component.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
|
||||
if (component.containsPoint(Game1.getMouseX(true), Game1.getMouseY(true)))
|
||||
{
|
||||
string name = component.name;
|
||||
string label = component.label;
|
||||
|
@ -72,27 +70,27 @@ namespace stardew_access.Patches
|
|||
}
|
||||
});
|
||||
|
||||
if (__instance.muteMusicButton.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
|
||||
if (__instance.muteMusicButton.containsPoint(Game1.getMouseX(true), Game1.getMouseY(true)))
|
||||
{
|
||||
toSpeak = "Mute Music Button";
|
||||
}
|
||||
|
||||
if (__instance.aboutButton.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
|
||||
if (__instance.aboutButton.containsPoint(Game1.getMouseX(true), Game1.getMouseY(true)))
|
||||
{
|
||||
toSpeak = "About Button";
|
||||
}
|
||||
|
||||
if (__instance.languageButton.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
|
||||
if (__instance.languageButton.containsPoint(Game1.getMouseX(true), Game1.getMouseY(true)))
|
||||
{
|
||||
toSpeak = "Language Button";
|
||||
}
|
||||
|
||||
if (__instance.windowedButton.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
|
||||
if (__instance.windowedButton.containsPoint(Game1.getMouseX(true), Game1.getMouseY(true)))
|
||||
{
|
||||
toSpeak = "Fullscreen toggle Button";
|
||||
}
|
||||
|
||||
if (TitleMenu.subMenu != null && __instance.backButton.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
|
||||
if (TitleMenu.subMenu != null && __instance.backButton.containsPoint(Game1.getMouseX(true), Game1.getMouseY(true)))
|
||||
{
|
||||
string text = "Back Button";
|
||||
MainClass.GetScreenReader().SayWithChecker(text, true);
|
||||
|
@ -111,7 +109,7 @@ namespace stardew_access.Patches
|
|||
{
|
||||
try
|
||||
{
|
||||
int x = Game1.getMouseX(), y = Game1.getMouseY();
|
||||
int x = Game1.getMouseX(true), y = Game1.getMouseY(true);
|
||||
if (___menu.slotButtons[i].containsPoint(x, y))
|
||||
{
|
||||
if (__instance.Farmer != null)
|
||||
|
@ -161,13 +159,22 @@ namespace stardew_access.Patches
|
|||
}
|
||||
}
|
||||
|
||||
internal static void NewGameMenuPatch(CharacterCustomization __instance, bool ___skipIntro)
|
||||
internal static void CharacterCustomizationMenuPatch(CharacterCustomization __instance, bool ___skipIntro)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool isNextArrowPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Right);
|
||||
bool isPrevArrowPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Left);
|
||||
|
||||
if (__instance.backButton.containsPoint != null && __instance.backButton.visible && __instance.backButton.containsPoint((int)Game1.getMouseX(true), (int)Game1.getMouseY(true)))
|
||||
{
|
||||
// Perform Left Click
|
||||
if (MainClass.Config.LeftClickMainKey.JustPressed() || MainClass.Config.LeftClickAlternateKey.JustPressed())
|
||||
{
|
||||
Game1.activeClickableMenu.receiveLeftClick(Game1.getMouseX(true), Game1.getMouseY(true));
|
||||
}
|
||||
}
|
||||
|
||||
if (isNextArrowPressed && !isRunning)
|
||||
{
|
||||
_ = CycleThroughItems(true, __instance, ___skipIntro);
|
||||
|
@ -289,7 +296,7 @@ namespace stardew_access.Patches
|
|||
}
|
||||
#endregion
|
||||
|
||||
__instance.skipIntroButton.snapMouseCursor();
|
||||
__instance.skipIntroButton.snapMouseCursorToCenter();
|
||||
toSpeak = (___skipIntro ? "Enabled" : "Disabled") + " Skip Intro Button";
|
||||
}
|
||||
break;
|
||||
|
@ -311,7 +318,7 @@ namespace stardew_access.Patches
|
|||
}
|
||||
#endregion
|
||||
|
||||
__instance.randomButton.snapMouseCursor();
|
||||
__instance.randomButton.snapMouseCursorToCenter();
|
||||
toSpeak = "Random Skin Button";
|
||||
break;
|
||||
}
|
||||
|
@ -333,7 +340,7 @@ namespace stardew_access.Patches
|
|||
}
|
||||
#endregion
|
||||
|
||||
__instance.genderButtons[0].snapMouseCursor();
|
||||
__instance.genderButtons[0].snapMouseCursorToCenter();
|
||||
toSpeak = "Gender Male Button";
|
||||
break;
|
||||
}
|
||||
|
@ -355,7 +362,7 @@ namespace stardew_access.Patches
|
|||
}
|
||||
#endregion
|
||||
|
||||
__instance.genderButtons[1].snapMouseCursor();
|
||||
__instance.genderButtons[1].snapMouseCursorToCenter();
|
||||
toSpeak = "Gender Female Button";
|
||||
break;
|
||||
}
|
||||
|
@ -377,7 +384,7 @@ namespace stardew_access.Patches
|
|||
}
|
||||
#endregion
|
||||
|
||||
__instance.farmTypeButtons[0].snapMouseCursor();
|
||||
__instance.farmTypeButtons[0].snapMouseCursorToCenter();
|
||||
toSpeak = getFarmHoverText(__instance.farmTypeButtons[0]);
|
||||
break;
|
||||
}
|
||||
|
@ -399,7 +406,7 @@ namespace stardew_access.Patches
|
|||
}
|
||||
#endregion
|
||||
|
||||
__instance.farmTypeButtons[1].snapMouseCursor();
|
||||
__instance.farmTypeButtons[1].snapMouseCursorToCenter();
|
||||
toSpeak = getFarmHoverText(__instance.farmTypeButtons[1]);
|
||||
break;
|
||||
}
|
||||
|
@ -421,7 +428,7 @@ namespace stardew_access.Patches
|
|||
}
|
||||
#endregion
|
||||
|
||||
__instance.farmTypeButtons[2].snapMouseCursor();
|
||||
__instance.farmTypeButtons[2].snapMouseCursorToCenter();
|
||||
toSpeak = getFarmHoverText(__instance.farmTypeButtons[2]);
|
||||
break;
|
||||
}
|
||||
|
@ -443,7 +450,7 @@ namespace stardew_access.Patches
|
|||
}
|
||||
#endregion
|
||||
|
||||
__instance.farmTypeButtons[3].snapMouseCursor();
|
||||
__instance.farmTypeButtons[3].snapMouseCursorToCenter();
|
||||
toSpeak = getFarmHoverText(__instance.farmTypeButtons[3]);
|
||||
break;
|
||||
}
|
||||
|
@ -465,7 +472,7 @@ namespace stardew_access.Patches
|
|||
}
|
||||
#endregion
|
||||
|
||||
__instance.farmTypeButtons[4].snapMouseCursor();
|
||||
__instance.farmTypeButtons[4].snapMouseCursorToCenter();
|
||||
toSpeak = getFarmHoverText(__instance.farmTypeButtons[4]);
|
||||
break;
|
||||
}
|
||||
|
@ -487,7 +494,7 @@ namespace stardew_access.Patches
|
|||
}
|
||||
#endregion
|
||||
|
||||
__instance.farmTypeButtons[5].snapMouseCursor();
|
||||
__instance.farmTypeButtons[5].snapMouseCursorToCenter();
|
||||
toSpeak = getFarmHoverText(__instance.farmTypeButtons[5]);
|
||||
break;
|
||||
}
|
||||
|
@ -509,7 +516,7 @@ namespace stardew_access.Patches
|
|||
}
|
||||
#endregion
|
||||
|
||||
__instance.farmTypeButtons[6].snapMouseCursor();
|
||||
__instance.farmTypeButtons[6].snapMouseCursorToCenter();
|
||||
toSpeak = getFarmHoverText(__instance.farmTypeButtons[6]);
|
||||
break;
|
||||
}
|
||||
|
@ -531,7 +538,7 @@ namespace stardew_access.Patches
|
|||
}
|
||||
#endregion
|
||||
|
||||
__instance.farmTypeNextPageButton.snapMouseCursor();
|
||||
__instance.farmTypeNextPageButton.snapMouseCursorToCenter();
|
||||
toSpeak = "Next Farm Type Page Button";
|
||||
break;
|
||||
}
|
||||
|
@ -553,7 +560,7 @@ namespace stardew_access.Patches
|
|||
}
|
||||
#endregion
|
||||
|
||||
__instance.farmTypePreviousPageButton.snapMouseCursor();
|
||||
__instance.farmTypePreviousPageButton.snapMouseCursorToCenter();
|
||||
toSpeak = "Previous Farm Type Page Button";
|
||||
break;
|
||||
}
|
||||
|
@ -575,7 +582,7 @@ namespace stardew_access.Patches
|
|||
}
|
||||
#endregion
|
||||
|
||||
__instance.cabinLayoutButtons[0].snapMouseCursor();
|
||||
__instance.cabinLayoutButtons[0].snapMouseCursorToCenter();
|
||||
toSpeak = "Cabin layout nearby";
|
||||
break;
|
||||
}
|
||||
|
@ -597,7 +604,7 @@ namespace stardew_access.Patches
|
|||
}
|
||||
#endregion
|
||||
|
||||
__instance.cabinLayoutButtons[1].snapMouseCursor();
|
||||
__instance.cabinLayoutButtons[1].snapMouseCursorToCenter();
|
||||
toSpeak = "Cabin layout separate";
|
||||
break;
|
||||
}
|
||||
|
@ -619,7 +626,7 @@ namespace stardew_access.Patches
|
|||
}
|
||||
#endregion
|
||||
|
||||
__instance.okButton.snapMouseCursor();
|
||||
__instance.okButton.snapMouseCursorToCenter();
|
||||
toSpeak = "Ok Button";
|
||||
}
|
||||
break;
|
||||
|
@ -632,7 +639,7 @@ namespace stardew_access.Patches
|
|||
}
|
||||
#endregion
|
||||
|
||||
__instance.backButton.snapMouseCursor();
|
||||
__instance.backButton.snapMouseCursorToCenter();
|
||||
toSpeak = "Back Button";
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"Name": "Stardew Access",
|
||||
"Author": "Mohammad Shoaib",
|
||||
"Version": "1.1.2",
|
||||
"Version": "1.1.3",
|
||||
"Description": "An accessibility mod with screen reader support!",
|
||||
"UniqueID": "shoaib.stardewaccess",
|
||||
"EntryDll": "stardew-access.dll",
|
||||
|
|
Loading…
Reference in New Issue