Bug which prevented from moving or purchasing animals fixed
parent
09001807cb
commit
be8b9a9e41
|
@ -356,7 +356,7 @@ namespace stardew_access
|
|||
|
||||
helper.ConsoleCommands.Add("buildsel", "Select the building index which you want to upgrade/demolish/paint", (string command, string[] args) =>
|
||||
{
|
||||
if ((Game1.activeClickableMenu is not CarpenterMenu && Game1.activeClickableMenu is not PurchaseAnimalsMenu && Game1.activeClickableMenu is not AnimalQueryMenu) || !CarpenterMenuPatch.isOnFarm)
|
||||
if ((Game1.activeClickableMenu is not CarpenterMenu && Game1.activeClickableMenu is not PurchaseAnimalsMenu && Game1.activeClickableMenu is not AnimalQueryMenu) || (!CarpenterMenuPatch.isOnFarm && !PurchaseAnimalsMenuPatch.isOnFarm && !AnimalQueryMenuPatch.isOnFarm))
|
||||
{
|
||||
MainClass.InfoLog($"Cannot select building.");
|
||||
return;
|
||||
|
|
|
@ -241,6 +241,11 @@ namespace stardew_access
|
|||
prefix: new HarmonyMethod(typeof(PurchaseAnimalsMenuPatch), nameof(PurchaseAnimalsMenuPatch.DrawPatch))
|
||||
);
|
||||
|
||||
harmony.Patch(
|
||||
original: AccessTools.Method(typeof(PurchaseAnimalsMenu), nameof(PurchaseAnimalsMenu.receiveKeyPress), new Type[] { typeof(Keys) }),
|
||||
prefix: new HarmonyMethod(typeof(PurchaseAnimalsMenuPatch), nameof(PurchaseAnimalsMenuPatch.RecieveKeyPressPatch))
|
||||
);
|
||||
|
||||
harmony.Patch(
|
||||
original: AccessTools.Method(typeof(AnimalQueryMenu), nameof(AnimalQueryMenu.draw), new Type[] { typeof(SpriteBatch) }),
|
||||
postfix: new HarmonyMethod(typeof(AnimalQueryMenuPatch), nameof(AnimalQueryMenuPatch.DrawPatch))
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace stardew_access.Patches
|
|||
|
||||
if (___onFarm && ___namingAnimal)
|
||||
{
|
||||
narrateNamingMenu(__instance, x, y);
|
||||
narrateNamingMenu(__instance, ___textBox, x, y);
|
||||
}
|
||||
else if (___onFarm && !___namingAnimal)
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ namespace stardew_access.Patches
|
|||
}
|
||||
}
|
||||
|
||||
private static void narrateNamingMenu(PurchaseAnimalsMenu __instance, int x, int y)
|
||||
private static void narrateNamingMenu(PurchaseAnimalsMenu __instance, TextBox ___textBox, int x, int y)
|
||||
{
|
||||
string toSpeak = "";
|
||||
if (__instance.okButton != null && __instance.okButton.containsPoint(x, y))
|
||||
|
@ -60,9 +60,9 @@ namespace stardew_access.Patches
|
|||
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}";
|
||||
string? name = ___textBox.Text;
|
||||
if (name != null)
|
||||
toSpeak = $"{toSpeak}, Value: {name}";
|
||||
}
|
||||
|
||||
if (purchaseAnimalMenuQuery == toSpeak) return;
|
||||
|
@ -103,6 +103,16 @@ namespace stardew_access.Patches
|
|||
MainClass.ScreenReader.Say(toSpeak, true);
|
||||
}
|
||||
|
||||
internal static bool RecieveKeyPressPatch(PurchaseAnimalsMenu __instance, Microsoft.Xna.Framework.Input.Keys key)
|
||||
{
|
||||
if (TextBoxPatch.isAnyTextBoxActive && Game1.options.doesInputListContain(Game1.options.menuButton, key) && __instance.readyToClose())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
internal static void Cleanup()
|
||||
{
|
||||
purchaseAnimalMenuQuery = "";
|
||||
|
|
Loading…
Reference in New Issue