From e595a03be61b36cf64676c223777a81b8bc47187 Mon Sep 17 00:00:00 2001 From: Mohammad Shoaib Khan Date: Tue, 21 Feb 2023 21:41:45 +0530 Subject: [PATCH] Fixed bug for more than 1 text boxes in a menu In this bug, if there were amore than 1 text boxes, then the textBoxQuery was resets to ' ' even if a text box is selected because of the other unselected text boxes --- stardew-access/Patches/TextBoxPatch.cs | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/stardew-access/Patches/TextBoxPatch.cs b/stardew-access/Patches/TextBoxPatch.cs index f940193..eddc5e4 100644 --- a/stardew-access/Patches/TextBoxPatch.cs +++ b/stardew-access/Patches/TextBoxPatch.cs @@ -8,21 +8,20 @@ namespace stardew_access.Patches { try { - bool isEscPressed = StardewValley.Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Escape); // For escaping/unselecting from the animal name text box - string toSpeak = " "; - if (__instance.Selected) - { - MainClass.isAnyTextBoxActive = true; - toSpeak = __instance.Text; - - if (isEscPressed) - { - __instance.Selected = false; - } - } - else + if (!__instance.Selected) { MainClass.isAnyTextBoxActive = false; + return; + } + + MainClass.isAnyTextBoxActive = true; + + bool isEscPressed = StardewValley.Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Escape); + string toSpeak = __instance.Text; + + if (isEscPressed) + { + __instance.Selected = false; } if (textBoxQuery != toSpeak)