diff --git a/stardew-access/ModEntry.cs b/stardew-access/ModEntry.cs
index 3be2ec3..7d09eb8 100644
--- a/stardew-access/ModEntry.cs
+++ b/stardew-access/ModEntry.cs
@@ -4,11 +4,8 @@ using StardewModdingAPI.Events;
using StardewValley;
using HarmonyLib;
using stardew_access.Patches;
-using AutoHotkey.Interop;
-using System.Runtime.InteropServices;
using stardew_access.ScreenReader;
using Microsoft.Xna.Framework;
-using StardewValley.Buildings;
namespace stardew_access
{
diff --git a/stardew-access/Patches/BuildingNAnimalMenuPatches.cs b/stardew-access/Patches/BuildingNAnimalMenuPatches.cs
index da8c0d5..0545344 100644
--- a/stardew-access/Patches/BuildingNAnimalMenuPatches.cs
+++ b/stardew-access/Patches/BuildingNAnimalMenuPatches.cs
@@ -17,27 +17,60 @@ namespace stardew_access.Patches
internal static bool isSayingBlueprintInfo = false;
internal static string prevBlueprintInfo = "";
internal static bool isOnFarm = false, isUpgrading = false, isDemolishing = false, isPainting = false, isConstructing = false, isMoving = false, isMagicalConstruction = false;
+ internal static bool firstTimeInNamingMenu = true;
internal static PurchaseAnimalsMenu? purchaseAnimalsMenu;
- internal static void PurchaseAnimalsMenuPatch(PurchaseAnimalsMenu __instance,
- bool ___onFarm,
- bool ___namingAnimal,
- FarmAnimal ___animalBeingPurchased,
- Building ___newAnimalHome,
- TextBox ___textBox,
- TextBoxEvent ___e,
- int ___priceOfAnimal)
+
+ internal static void PurchaseAnimalsMenuPatch(PurchaseAnimalsMenu __instance, bool ___onFarm, bool ___namingAnimal, TextBox ___textBox)
{
try
{
+ int x = Game1.getMouseX(), y = Game1.getMouseY(); // Mouse x and y position
purchaseAnimalsMenu = __instance;
isOnFarm = ___onFarm;
if (___onFarm && ___namingAnimal)
{
+ string toSpeak = "";
+ if (__instance.okButton != null && __instance.okButton.containsPoint(x, y))
+ {
+ toSpeak = "Cancel Button";
+ }
+ else if (__instance.doneNamingButton != null && __instance.doneNamingButton.containsPoint(x, y))
+ {
+ toSpeak = "OK Button";
+ }
+ else if (__instance.randomButton != null && __instance.randomButton.containsPoint(x, y))
+ {
+ toSpeak = "Random Name Button";
+ }
+ else if (__instance.textBoxCC != null && __instance.textBoxCC.containsPoint(x, y))
+ {
+ toSpeak = "Name Text Box";
+ string? value = ___textBox.Text;
+ if (value != "" && value != null && value != "null")
+ toSpeak = $"{toSpeak}, Value: {value}";
+ }
+
+ if (purchaseAnimalMenuQuery != toSpeak)
+ {
+ purchaseAnimalMenuQuery = toSpeak;
+
+ if (firstTimeInNamingMenu)
+ {
+ toSpeak = $"Enter the name of animal in the name text box. {toSpeak}";
+ firstTimeInNamingMenu = false;
+ }
+
+ MainClass.ScreenReader.Say(toSpeak, true);
+ }
+ }
+ else if (___onFarm && !___namingAnimal)
+ {
+ firstTimeInNamingMenu = true;
}
- else if (___onFarm && !___namingAnimal) { }
else if (!___onFarm && !___namingAnimal)
{
+ firstTimeInNamingMenu = true;
if (__instance.hovered != null)
{
string toSpeak = "";
@@ -377,6 +410,7 @@ namespace stardew_access.Patches
public static string? Contstruct(Vector2 position)
{
string? response = null;
+ // This code is taken from the game's code (CarpenterMenu.cs::874)
Game1.player.team.buildLock.RequestLock(delegate
{
if (isOnFarm && Game1.locationRequest == null)
@@ -427,6 +461,7 @@ namespace stardew_access.Patches
public static string? Paint(Building? toPaint)
{
string? response = null;
+ // This code is taken from the game's code (CarpenterMenu.cs::793)
Farm farm_location = Game1.getFarm();
if (toPaint != null)
{
@@ -465,6 +500,7 @@ namespace stardew_access.Patches
public static string? Move(Building? buildingToMove, Vector2 position)
{
string? response = null;
+ // This code is taken from the game's code (CarpenterMenu.cs::829)
if (buildingToMove != null)
{
string? name = buildingToMove.nameOfIndoorsWithoutUnique;
diff --git a/stardew-access/Patches/MenuPatches.cs b/stardew-access/Patches/MenuPatches.cs
index 7c2998c..f204cf3 100644
--- a/stardew-access/Patches/MenuPatches.cs
+++ b/stardew-access/Patches/MenuPatches.cs
@@ -360,11 +360,14 @@ namespace stardew_access.Patches
BuildingNAnimalMenuPatches.isPainting = false;
BuildingNAnimalMenuPatches.isMoving = false;
BuildingNAnimalMenuPatches.isConstructing = false;
+ BuildingNAnimalMenuPatches.carpenterMenu = null;
}
if (__instance is PurchaseAnimalsMenu)
{
BuildingNAnimalMenuPatches.purchaseAnimalMenuQuery = "";
+ BuildingNAnimalMenuPatches.firstTimeInNamingMenu = true;
+ BuildingNAnimalMenuPatches.purchaseAnimalsMenu = null;
}
GameMenuPatches.hoveredItemQueryKey = "";
diff --git a/stardew-access/ScreenReader/ScreenReaderInterface.cs b/stardew-access/ScreenReader/IScreenReader.cs
similarity index 95%
rename from stardew-access/ScreenReader/ScreenReaderInterface.cs
rename to stardew-access/ScreenReader/IScreenReader.cs
index 3b356cf..177a2ca 100644
--- a/stardew-access/ScreenReader/ScreenReaderInterface.cs
+++ b/stardew-access/ScreenReader/IScreenReader.cs
@@ -2,7 +2,6 @@ namespace stardew_access.ScreenReader
{
public interface IScreenReader
{
-
public string PrevTextTile
{
get;
@@ -12,7 +11,7 @@ namespace stardew_access.ScreenReader
/// Initializes the screen reader.
public void InitializeScreenReader();
- // Closes the screen reader, this is important, call this function when closing the game.
+ /// Closes the screen reader, this is important, call this function when closing the game.
public void CloseScreenReader();
/// Speaks the text via the loaded screen reader (if any).
diff --git a/stardew-access/manifest.json b/stardew-access/manifest.json
index fb7e7be..8eada81 100644
--- a/stardew-access/manifest.json
+++ b/stardew-access/manifest.json
@@ -1,7 +1,7 @@
{
"Name": "Stardew Access",
"Author": "Mohammad Shoaib",
- "Version": "1.0.21-beta",
+ "Version": "1.0.22-beta",
"Description": "An accessibility mod with screen reader support!",
"UniqueID": "shoaib.stardewaccess",
"EntryDll": "stardew-access.dll",
diff --git a/stardew-access/stardew-access.csproj b/stardew-access/stardew-access.csproj
index 78532e0..b723494 100644
--- a/stardew-access/stardew-access.csproj
+++ b/stardew-access/stardew-access.csproj
@@ -12,7 +12,6 @@
-
diff --git a/stardew-access/stardew-access.csproj.bak b/stardew-access/stardew-access.csproj.bak
deleted file mode 100644
index 08a75f1..0000000
--- a/stardew-access/stardew-access.csproj.bak
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
- net452
- stardew_access
- enable
- enable
- preview
- MainClass.ModEntry
-
-
-
-
-
-
-
-