TypeFieldToAnotherTypeMethodRewriter, a much more flexible choice to deal with fields changes
This commit is contained in:
parent
d3315ae6b5
commit
0f7cb1e1f6
|
@ -43,7 +43,7 @@ namespace StardewModdingAPI.Framework.ModLoading
|
|||
public static bool IsSameType(Type type, TypeReference reference)
|
||||
{
|
||||
// same namespace & name
|
||||
if (type.Namespace != reference.Namespace || type.Name != reference.Name)
|
||||
if ((type.Namespace != reference.Namespace || type.Name != reference.Name) && !(reference.Namespace == "" && reference.FullName.Replace("/", "+") == type.FullName))
|
||||
return false;
|
||||
|
||||
// same generic parameters
|
||||
|
|
|
@ -53,6 +53,15 @@ namespace StardewModdingAPI.Metadata
|
|||
|
||||
yield return new PropertyToFieldRewriter(typeof(Game1), "toolSpriteSheet", "toolSpriteSheet");
|
||||
|
||||
// Accessibility fix
|
||||
yield return new TypeFieldToAnotherTypeMethodRewriter(typeof(GameMenu), typeof(GameMenuMethods), "hoverText", "GetHoverText");
|
||||
yield return new TypeFieldToAnotherTypeMethodRewriter(typeof(ShopMenu), typeof(ShopMenuMethods), "heldItem", "GetHeldItem");
|
||||
yield return new TypeFieldToAnotherTypeMethodRewriter(typeof(ShopMenu), typeof(ShopMenuMethods), "hoveredItem", "GetHoveredItem");
|
||||
yield return new TypeFieldToAnotherTypeMethodRewriter(typeof(ShopMenu), typeof(ShopMenuMethods), "hoverPrice", "GetHoverPrice");
|
||||
yield return new TypeFieldToAnotherTypeMethodRewriter(typeof(ShopMenu), typeof(ShopMenuMethods), "hoverText", "GetHoverText");
|
||||
yield return new TypeFieldToAnotherTypeMethodRewriter(typeof(ShopMenu), typeof(ShopMenuMethods), "categoriesToSellHere", "GetCategoriesToSellHere");
|
||||
yield return new TypeFieldToAnotherTypeMethodRewriter(typeof(MenuWithInventory), typeof(MenuWithInventoryMethods), "trashCan", "GetTrashCan");
|
||||
|
||||
//Method Rewrites
|
||||
yield return new MethodParentRewriter(typeof(Game1), typeof(Game1Methods));
|
||||
yield return new MethodParentRewriter(typeof(Farmer), typeof(FarmerMethods));
|
||||
|
|
|
@ -226,6 +226,7 @@
|
|||
<Compile Include="Framework\ModLoading\Rewriters\MethodParentRewriter.cs" />
|
||||
<Compile Include="Framework\ModLoading\Rewriters\PropertyToFieldRewriter.cs" />
|
||||
<Compile Include="Framework\ModLoading\Rewriters\StaticFieldToConstantRewriter.cs" />
|
||||
<Compile Include="Framework\ModLoading\Rewriters\TypeFieldToAnotherTypeMethodRewriter.cs" />
|
||||
<Compile Include="Framework\ModLoading\Rewriters\TypeFieldToAnotherTypeFieldRewriter.cs" />
|
||||
<Compile Include="Framework\ModLoading\Rewriters\TypeReferenceRewriter.cs" />
|
||||
<Compile Include="Framework\ModLoading\TypeReferenceComparer.cs" />
|
||||
|
@ -255,12 +256,15 @@
|
|||
<Compile Include="Framework\Reflection\Reflector.cs" />
|
||||
<Compile Include="Framework\RequestExitDelegate.cs" />
|
||||
<Compile Include="Framework\RewriteFacades\DebrisMethods.cs" />
|
||||
<Compile Include="Framework\RewriteFacades\GameMenuMethods.cs" />
|
||||
<Compile Include="Framework\RewriteFacades\ShopMenuMethods.cs" />
|
||||
<Compile Include="Framework\RewriteFacades\FarmerMethods.cs" />
|
||||
<Compile Include="Framework\RewriteFacades\FarmerRenderMethods.cs" />
|
||||
<Compile Include="Framework\RewriteFacades\Game1Methods.cs" />
|
||||
<Compile Include="Framework\RewriteFacades\GameLocationMethods.cs" />
|
||||
<Compile Include="Framework\RewriteFacades\HUDMessageMethods.cs" />
|
||||
<Compile Include="Framework\RewriteFacades\IClickableMenuMethods.cs" />
|
||||
<Compile Include="Framework\RewriteFacades\MenuWithInventoryMethods.cs" />
|
||||
<Compile Include="Framework\RewriteFacades\ItemGrabMenuMethods.cs" />
|
||||
<Compile Include="Framework\RewriteFacades\MapPageMethods.cs" />
|
||||
<Compile Include="Framework\RewriteFacades\NPCMethods.cs" />
|
||||
|
|
Loading…
Reference in New Issue