Removed previous text box code from other places

master
Mohammad Shoaib Khan 2023-02-21 21:49:22 +05:30
parent e595a03be6
commit c9c62d4fa9
No known key found for this signature in database
GPG Key ID: D8040D966320B620
5 changed files with 24 additions and 59 deletions

View File

@ -218,21 +218,21 @@ namespace stardew_access
#region Mouse Click Simulation #region Mouse Click Simulation
// Main Keybinds // Main Keybinds
if (Config.LeftClickMainKey.JustPressed()) if (!isAnyTextBoxActive && Config.LeftClickMainKey.JustPressed())
{ {
Game1.activeClickableMenu.receiveLeftClick(Game1.getMouseX(true), Game1.getMouseY(true)); Game1.activeClickableMenu.receiveLeftClick(Game1.getMouseX(true), Game1.getMouseY(true));
} }
if (Config.RightClickMainKey.JustPressed()) if (!isAnyTextBoxActive && Config.RightClickMainKey.JustPressed())
{ {
Game1.activeClickableMenu.receiveRightClick(Game1.getMouseX(true), Game1.getMouseY(true)); Game1.activeClickableMenu.receiveRightClick(Game1.getMouseX(true), Game1.getMouseY(true));
} }
// Alternate Keybinds // Alternate Keybinds
if (!isCustomizingCharacter && !isAnyTextBoxActive && Config.LeftClickAlternateKey.JustPressed()) // Excluding the character creation menu if (!isAnyTextBoxActive && Config.LeftClickAlternateKey.JustPressed()) // Excluding the character creation menu
{ {
Game1.activeClickableMenu.receiveLeftClick(Game1.getMouseX(true), Game1.getMouseY(true)); Game1.activeClickableMenu.receiveLeftClick(Game1.getMouseX(true), Game1.getMouseY(true));
} }
if (!isCustomizingCharacter && Game1.activeClickableMenu is not AnimalQueryMenu && Config.RightClickAlternateKey.JustPressed()) // Excluding the character creation menu if (!isAnyTextBoxActive && Config.RightClickAlternateKey.JustPressed()) // Excluding the character creation menu
{ {
Game1.activeClickableMenu.receiveRightClick(Game1.getMouseX(true), Game1.getMouseY(true)); Game1.activeClickableMenu.receiveRightClick(Game1.getMouseX(true), Game1.getMouseY(true));
} }

View File

@ -91,6 +91,8 @@ namespace stardew_access.Patches
{ {
try try
{ {
if (MainClass.isAnyTextBoxActive) return;
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
purchaseAnimalsMenu = __instance; purchaseAnimalsMenu = __instance;
isOnFarm = ___onFarm; isOnFarm = ___onFarm;
@ -114,9 +116,9 @@ namespace stardew_access.Patches
else if (__instance.textBoxCC != null && __instance.textBoxCC.containsPoint(x, y)) else if (__instance.textBoxCC != null && __instance.textBoxCC.containsPoint(x, y))
{ {
toSpeak = "Name Text Box"; toSpeak = "Name Text Box";
string? value = ___textBox.Text; // string? value = ___textBox.Text;
if (value != "" && value != null && value != "null") // if (value != "" && value != null && value != "null")
toSpeak = $"{toSpeak}, Value: {value}"; // toSpeak = $"{toSpeak}, Value: {value}";
} }
if (purchaseAnimalMenuQuery != toSpeak) if (purchaseAnimalMenuQuery != toSpeak)

View File

@ -34,6 +34,8 @@ namespace stardew_access.Patches {
{ {
try try
{ {
if (MainClass.isAnyTextBoxActive) return;
bool isEscPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Escape); // For escaping/unselecting from the animal name text box bool isEscPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Escape); // For escaping/unselecting from the animal name text box
string toSpeak = ""; string toSpeak = "";
if (characterDesignToggleShouldSpeak) if (characterDesignToggleShouldSpeak)
@ -44,34 +46,7 @@ namespace stardew_access.Patches {
string itemsToSpeak = ""; string itemsToSpeak = "";
string changesToSpeak = ""; string changesToSpeak = "";
if (___nameBox.Selected) if (MainClass.Config.CharacterCreationMenuNextKey.JustPressed() && !isRunning)
{
toSpeak = ___nameBox.Text;
if (isEscPressed)
{
___nameBox.Selected = false;
}
}
else if (___farmnameBox.Selected)
{
toSpeak = ___farmnameBox.Text;
if (isEscPressed)
{
___farmnameBox.Selected = false;
}
}
else if (___favThingBox.Selected)
{
toSpeak = ___favThingBox.Text;
if (isEscPressed)
{
___favThingBox.Selected = false;
}
}
else if (MainClass.Config.CharacterCreationMenuNextKey.JustPressed() && !isRunning)
{ {
isRunning = true; isRunning = true;
itemsToSpeak =CycleThroughItems(true, __instance, ___skipIntro, ___startingCabinsLabel, ___difficultyModifierLabel, ___nameBox, ___farmnameBox, ___favThingBox); itemsToSpeak =CycleThroughItems(true, __instance, ___skipIntro, ___startingCabinsLabel, ___difficultyModifierLabel, ___nameBox, ___farmnameBox, ___favThingBox);

View File

@ -1,5 +1,4 @@
using StardewValley; using StardewValley.Menus;
using StardewValley.Menus;
namespace stardew_access.Patches namespace stardew_access.Patches
{ {

View File

@ -420,35 +420,24 @@ namespace stardew_access.Patches
{ {
try try
{ {
string toSpeak = "";
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
bool isEscPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Escape); // For escaping/unselecting from the animal name text box
if (firstTimeInNamingMenu) if (firstTimeInNamingMenu)
{ {
firstTimeInNamingMenu = false; firstTimeInNamingMenu = false;
___textBox.Selected = false; ___textBox.Selected = false;
} }
if (___textBox.Selected) if (MainClass.isAnyTextBoxActive) return;
{
___textBox.Update();
toSpeak = ___textBox.Text;
if (isEscPressed) string toSpeak = "";
{ int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
___textBox.Selected = false; bool isEscPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Escape); // For escaping/unselecting from the animal name text box
}
} if (__instance.textBoxCC != null && __instance.textBoxCC.containsPoint(x, y))
else toSpeak = $"{___title} text box";
{ else if (__instance.doneNamingButton != null && __instance.doneNamingButton.containsPoint(x, y))
if (__instance.textBoxCC != null && __instance.textBoxCC.containsPoint(x, y)) toSpeak = $"Done naming button";
toSpeak = $"{___title} text box"; else if (__instance.randomButton != null && __instance.randomButton.containsPoint(x, y))
else if (__instance.doneNamingButton != null && __instance.doneNamingButton.containsPoint(x, y)) toSpeak = $"Random button";
toSpeak = $"Done naming button";
else if (__instance.randomButton != null && __instance.randomButton.containsPoint(x, y))
toSpeak = $"Random button";
}
if (toSpeak != "") if (toSpeak != "")
MainClass.ScreenReader.SayWithChecker(toSpeak, true); MainClass.ScreenReader.SayWithChecker(toSpeak, true);