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)