From 3086a3833c2ee5fdcc9d0435876a39c6712dccf8 Mon Sep 17 00:00:00 2001
From: yangzhi <@4F!xZpJwly&KbWq>
Date: Thu, 20 Feb 2020 12:17:14 +0800
Subject: [PATCH] Rewrite for AnimalQueryMenu
---
.../RewriteFacades/AnimalQueryMenuMethods.cs | 78 +++++++++++++++++++
src/SMAPI/Metadata/InstructionMetadata.cs | 3 +
src/SMAPI/SMAPI.csproj | 1 +
3 files changed, 82 insertions(+)
create mode 100644 src/SMAPI/Framework/RewriteFacades/AnimalQueryMenuMethods.cs
diff --git a/src/SMAPI/Framework/RewriteFacades/AnimalQueryMenuMethods.cs b/src/SMAPI/Framework/RewriteFacades/AnimalQueryMenuMethods.cs
new file mode 100644
index 00000000..166c5b17
--- /dev/null
+++ b/src/SMAPI/Framework/RewriteFacades/AnimalQueryMenuMethods.cs
@@ -0,0 +1,78 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Xna.Framework;
+using StardewValley;
+using StardewValley.Menus;
+
+namespace StardewModdingAPI.Framework.RewriteFacades
+{
+ public class AnimalQueryMenuMethods : AnimalQueryMenu
+ {
+ public AnimalQueryMenuMethods(FarmAnimal animal) : base(animal)
+ {
+ }
+
+ public ClickableTextureComponent AllowReproductionButtonProp
+ {
+ get
+ {
+ if (this.allowReproductionButton != null)
+ {
+ return new ClickableTextureComponent(this.allowReproductionButton.bounds, Game1.mouseCursors, new Rectangle(0x80, 0x189, 9, 9), this.allowReproductionButton.scale, false);
+ }
+ return null;
+ }
+ set
+ {
+ if (value != null)
+ {
+ this.allowReproductionButton = new ClickableComponent(value.bounds, "reproButton");
+ }
+ this.allowReproductionButton = null;
+ }
+ }
+
+ public ClickableTextureComponent SellButtonProp
+ {
+ get
+ {
+ if (this.sellButton != null)
+ {
+ return new ClickableTextureComponent(this.sellButton.bounds, Game1.mouseCursors, new Rectangle(0, 0x180, 0x10, 0x10), this.sellButton.scale, false);
+ }
+ return null;
+ }
+ set
+ {
+ if (value != null)
+ {
+ this.sellButton = new ClickableComponent(value.bounds, "sellButton");
+ }
+ this.sellButton = null;
+ }
+ }
+
+ public ClickableTextureComponent MoveHomeButtonProp
+ {
+ get
+ {
+ if (this.moveHomeButton != null)
+ {
+ return new ClickableTextureComponent(this.moveHomeButton.bounds, Game1.mouseCursors, new Rectangle(0x10, 0x180, 0x10, 0x10), this.moveHomeButton.scale, false);
+ }
+ return null;
+ }
+ set
+ {
+ if (value != null)
+ {
+ this.moveHomeButton = new ClickableComponent(value.bounds, "moveHomeButton");
+ }
+ this.moveHomeButton = null;
+ }
+ }
+
+ }
+}
diff --git a/src/SMAPI/Metadata/InstructionMetadata.cs b/src/SMAPI/Metadata/InstructionMetadata.cs
index 14f03a49..a524829c 100644
--- a/src/SMAPI/Metadata/InstructionMetadata.cs
+++ b/src/SMAPI/Metadata/InstructionMetadata.cs
@@ -68,6 +68,9 @@ namespace StardewModdingAPI.Metadata
yield return new TypeFieldToAnotherTypePropertyRewriter(typeof(ShopMenu), typeof(ShopMenuMethods), "forSale", "ForSaleProp");
yield return new TypeFieldToAnotherTypePropertyRewriter(typeof(MenuWithInventory), typeof(MenuWithInventoryMethods), "trashCan", "TrashCanProp");
yield return new TypeFieldToAnotherTypePropertyRewriter(typeof(ItemGrabMenu), typeof(ItemGrabMenuMethods), "fillStacksButton", "FillStacksButtonProp");
+ yield return new TypeFieldToAnotherTypePropertyRewriter(typeof(AnimalQueryMenu), typeof(AnimalQueryMenuMethods), "allowReproductionButton", "AllowReproductionButtonProp");
+ yield return new TypeFieldToAnotherTypePropertyRewriter(typeof(AnimalQueryMenu), typeof(AnimalQueryMenuMethods), "sellButton", "SellButtonProp");
+ yield return new TypeFieldToAnotherTypePropertyRewriter(typeof(AnimalQueryMenu), typeof(AnimalQueryMenuMethods), "moveHomeButton", "MoveHomeButtonProp");
// Rewrite Missing Type
yield return new TypeReferenceRewriter("StardewValley.Menus.CraftingPage", typeof(CraftingPageMobile));
diff --git a/src/SMAPI/SMAPI.csproj b/src/SMAPI/SMAPI.csproj
index 3113edc5..f1787c59 100644
--- a/src/SMAPI/SMAPI.csproj
+++ b/src/SMAPI/SMAPI.csproj
@@ -262,6 +262,7 @@
+