bug fix in the game saving menu and fixed typo
parent
a34ba8f41d
commit
683afea823
|
@ -286,7 +286,7 @@ namespace stardew_access
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Tile marking
|
#region Tile marking
|
||||||
helper.ConsoleCommands.Add("mark", "Marks the player's position for use in building cunstruction in Carpenter Menu.", (string commmand, string[] args) =>
|
helper.ConsoleCommands.Add("mark", "Marks the player's position for use in building construction in Carpenter Menu.", (string commmand, string[] args) =>
|
||||||
{
|
{
|
||||||
if (Game1.currentLocation is not Farm)
|
if (Game1.currentLocation is not Farm)
|
||||||
{
|
{
|
||||||
|
|
|
@ -82,7 +82,7 @@ namespace stardew_access
|
||||||
/// <summary>Returns the Screen Reader class for other mods to use.</summary>
|
/// <summary>Returns the Screen Reader class for other mods to use.</summary>
|
||||||
public override object GetApi()
|
public override object GetApi()
|
||||||
{
|
{
|
||||||
return new ScreenReaderController().Initialize();
|
return new ScreenReaderAPI();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onUpdateTicked(object? sender, UpdateTickedEventArgs? e)
|
private void onUpdateTicked(object? sender, UpdateTickedEventArgs? e)
|
||||||
|
|
|
@ -209,7 +209,7 @@ namespace stardew_access.Patches
|
||||||
|
|
||||||
if (__instance.okButton != null && __instance.okButton.containsPoint(x, y))
|
if (__instance.okButton != null && __instance.okButton.containsPoint(x, y))
|
||||||
{
|
{
|
||||||
string toSpeak = "Cunstruct Building" + (___blueprints[___currentBlueprintIndex].doesFarmerHaveEnoughResourcesToBuild() ? "" : ", cannot cunstrut building, not enough resources to build.");
|
string toSpeak = "Construct Building" + (___blueprints[___currentBlueprintIndex].doesFarmerHaveEnoughResourcesToBuild() ? "" : ", cannot cunstrut building, not enough resources to build.");
|
||||||
if (carpenterMenuQuery != toSpeak)
|
if (carpenterMenuQuery != toSpeak)
|
||||||
{
|
{
|
||||||
carpenterMenuQuery = toSpeak;
|
carpenterMenuQuery = toSpeak;
|
||||||
|
@ -511,7 +511,7 @@ namespace stardew_access.Patches
|
||||||
if ((int)buildingToMove.daysOfConstructionLeft > 0)
|
if ((int)buildingToMove.daysOfConstructionLeft > 0)
|
||||||
{
|
{
|
||||||
buildingToMove = null;
|
buildingToMove = null;
|
||||||
return "Building under cunstruction, cannot move";
|
return "Building under construction, cannot move";
|
||||||
}
|
}
|
||||||
if (!carpenterMenu.hasPermissionsToMove(buildingToMove))
|
if (!carpenterMenu.hasPermissionsToMove(buildingToMove))
|
||||||
{
|
{
|
||||||
|
|
|
@ -135,13 +135,17 @@ namespace stardew_access.Patches
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void LevelUpMenuPatch(LevelUpMenu __instance, List<int> ___professionsToChoose, List<string> ___leftProfessionDescription, List<string> ___rightProfessionDescription, List<string> ___extraInfoForLevel, List<CraftingRecipe> ___newCraftingRecipes, string ___title)
|
internal static void LevelUpMenuPatch(LevelUpMenu __instance, List<int> ___professionsToChoose, List<string> ___leftProfessionDescription, List<string> ___rightProfessionDescription, List<string> ___extraInfoForLevel, List<CraftingRecipe> ___newCraftingRecipes, string ___title, bool ___isActive, bool ___isProfessionChooser)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int x = Game1.getMouseX(), y = Game1.getMouseY();
|
int x = Game1.getMouseX(), y = Game1.getMouseY();
|
||||||
string leftProfession = " ", rightProfession = " ", extraInfo = " ", newCraftingRecipe = " ", toSpeak = " ";
|
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)
|
if (!__instance.informationUp)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -162,10 +166,38 @@ namespace stardew_access.Patches
|
||||||
}
|
}
|
||||||
|
|
||||||
if (__instance.leftProfession.containsPoint(x, y))
|
if (__instance.leftProfession.containsPoint(x, y))
|
||||||
|
{
|
||||||
|
if (isOpenBracketPressed || (isLeftCtrlPressed && isEnterPressed && __instance.readyToClose()))
|
||||||
|
{
|
||||||
|
Game1.player.professions.Add(___professionsToChoose[0]);
|
||||||
|
__instance.getImmediateProfessionPerk(___professionsToChoose[0]);
|
||||||
|
___isActive = false;
|
||||||
|
__instance.informationUp = false;
|
||||||
|
___isProfessionChooser = false;
|
||||||
|
__instance.RemoveLevelFromLevelList();
|
||||||
|
__instance.exitThisMenu();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
toSpeak = $"Selected: {leftProfession} Left click to choose.";
|
toSpeak = $"Selected: {leftProfession} Left click to choose.";
|
||||||
|
}
|
||||||
|
|
||||||
if (__instance.rightProfession.containsPoint(x, y))
|
if (__instance.rightProfession.containsPoint(x, y))
|
||||||
|
{
|
||||||
|
if (isOpenBracketPressed || (isLeftCtrlPressed && isEnterPressed && __instance.readyToClose()))
|
||||||
|
{
|
||||||
|
Game1.player.professions.Add(___professionsToChoose[1]);
|
||||||
|
__instance.getImmediateProfessionPerk(___professionsToChoose[1]);
|
||||||
|
___isActive = false;
|
||||||
|
__instance.informationUp = false;
|
||||||
|
___isProfessionChooser = false;
|
||||||
|
__instance.RemoveLevelFromLevelList();
|
||||||
|
__instance.exitThisMenu();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
toSpeak = $"Selected: {rightProfession} Left click to choose.";
|
toSpeak = $"Selected: {rightProfession} Left click to choose.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -180,11 +212,14 @@ namespace stardew_access.Patches
|
||||||
|
|
||||||
newCraftingRecipe += $"{message}, ";
|
newCraftingRecipe += $"{message}, ";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (__instance.okButton.containsPoint(x, y))
|
if (__instance.okButton.containsPoint(x, y))
|
||||||
{
|
{
|
||||||
toSpeak = $"{___title} {extraInfo} {newCraftingRecipe}. Left click to close.";
|
if (isOpenBracketPressed || (isLeftCtrlPressed && isEnterPressed))
|
||||||
}
|
__instance.okButtonClicked();
|
||||||
|
|
||||||
|
toSpeak = $"{___title} {extraInfo} {newCraftingRecipe}. Left click to close.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toSpeak != " ")
|
if (toSpeak != " ")
|
||||||
|
@ -205,12 +240,21 @@ namespace stardew_access.Patches
|
||||||
{
|
{
|
||||||
try
|
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)
|
if (__instance.currentPage == -1)
|
||||||
{
|
{
|
||||||
int total = ___categoryTotals[5];
|
int total = ___categoryTotals[5];
|
||||||
string toSpeak;
|
string toSpeak;
|
||||||
if (__instance.okButton.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
|
if (__instance.okButton.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
|
||||||
{
|
{
|
||||||
|
// Perform Left Click
|
||||||
|
if (isOpenBracketPressed || (isLeftControlPressed && isEnterPressed))
|
||||||
|
{
|
||||||
|
Game1.activeClickableMenu.receiveLeftClick(Game1.getMouseX(true), Game1.getMouseY(true));
|
||||||
|
}
|
||||||
toSpeak = $"{total}g in total. Press left mouse button to save.";
|
toSpeak = $"{total}g in total. Press left mouse button to save.";
|
||||||
MainClass.ScreenReader.SayWithChecker(toSpeak, true);
|
MainClass.ScreenReader.SayWithChecker(toSpeak, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
namespace stardew_access.ScreenReader
|
||||||
|
{
|
||||||
|
public class ScreenReaderAPI
|
||||||
|
{
|
||||||
|
|
||||||
|
public ScreenReaderAPI()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CloseScreenReader()
|
||||||
|
{
|
||||||
|
if (MainClass.ScreenReader == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
MainClass.ScreenReader.CloseScreenReader();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Say(String text, Boolean interrupt)
|
||||||
|
{
|
||||||
|
if (MainClass.ScreenReader == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
MainClass.ScreenReader.Say(text, interrupt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SayWithChecker(String text, Boolean interrupt)
|
||||||
|
{
|
||||||
|
if (MainClass.ScreenReader == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
MainClass.ScreenReader.SayWithChecker(text, interrupt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SayWithMenuChecker(String text, Boolean interrupt)
|
||||||
|
{
|
||||||
|
if (MainClass.ScreenReader == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
MainClass.ScreenReader.SayWithMenuChecker(text, interrupt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SayWithChatChecker(String text, Boolean interrupt)
|
||||||
|
{
|
||||||
|
if (MainClass.ScreenReader == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
MainClass.ScreenReader.SayWithChatChecker(text, interrupt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SayWithTileQuery(String text, int x, int y, Boolean interrupt)
|
||||||
|
{
|
||||||
|
if (MainClass.ScreenReader == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
MainClass.ScreenReader.SayWithTileQuery(text, x, y, interrupt);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"Name": "Stardew Access",
|
"Name": "Stardew Access",
|
||||||
"Author": "Mohammad Shoaib",
|
"Author": "Mohammad Shoaib",
|
||||||
"Version": "1.0.22-beta",
|
"Version": "1.0.23-beta",
|
||||||
"Description": "An accessibility mod with screen reader support!",
|
"Description": "An accessibility mod with screen reader support!",
|
||||||
"UniqueID": "shoaib.stardewaccess",
|
"UniqueID": "shoaib.stardewaccess",
|
||||||
"EntryDll": "stardew-access.dll",
|
"EntryDll": "stardew-access.dll",
|
||||||
|
|
Loading…
Reference in New Issue