Adapt to 1.4.4.128 game version, onScreenMenus rewrite bug fix, PropertyToFieldRewriter

This commit is contained in:
yangzhi 2020-02-08 15:40:17 +08:00
parent 56c17a2106
commit fdf249c853
6 changed files with 22 additions and 13 deletions

View File

@ -95,7 +95,7 @@ namespace StardewModdingAPI
internal static string ModsPath { get; set; }
/// <summary>The game's current semantic version.</summary>
internal static ISemanticVersion GameVersion { get; } = new GameVersion("1.4.4.122");
internal static ISemanticVersion GameVersion { get; } = new GameVersion("1.4.4.128");
/// <summary>The target game platform.</summary>
internal static Platform Platform { get; } = Platform.Android;

View File

@ -87,9 +87,9 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
}
else if (this.RainDropFix && !this.UsingInstance)
{
FieldReference field = module.ImportReference(this.ToType.GetField(this.FieldName));
MethodReference getter = module.ImportReference(this.ToType.GetMethod($"get_{this.FieldName}"));
cil.Replace(instruction, cil.Create(OpCodes.Ldsfld, field));
cil.Replace(instruction, cil.Create(OpCodes.Call, getter));
}
else
{

View File

@ -9,8 +9,8 @@ namespace StardewModdingAPI.Framework.RewriteFacades
{
public class Game1Methods : Game1
{
public RainDrop[] rainDrops = (typeof(RainManager).GetField("_rainDropList", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(RainManager.Instance) as List<RainDrop>).ToArray();
public new IList<IClickableMenu> onScreenMenus = Game1.onScreenMenus;
public static RainDrop[] rainDrops => (typeof(RainManager).GetField("_rainDropList", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(RainManager.Instance) as List<RainDrop>).ToArray();
public static new IList<IClickableMenu> onScreenMenus => Game1.onScreenMenus;
public static void updateDebrisWeatherForMovement(List<WeatherDebris> debris)
{

View File

@ -1916,11 +1916,11 @@ label_168:
DrawAfterMap.Invoke();
events.RenderedHud.RaiseEmpty();
_spriteBatchEnd.Invoke();
if (tutorialManager != null)
if (TutorialManager.Instance != null)
{
SetSpriteBatchBeginNextID("A-D");
SpriteBatchBegin.Invoke(options.zoomLevel);
tutorialManager.draw(spriteBatch);
TutorialManager.Instance.draw(spriteBatch);
_spriteBatchEnd.Invoke();
}
DrawToolbar.Invoke();

View File

@ -51,6 +51,8 @@ namespace StardewModdingAPI.Metadata
yield return new TypeFieldToAnotherTypeFieldRewriter(typeof(Game1), typeof(Game1Methods), "rainDrops", "Instance", this.Monitor, null, false, true);
yield return new TypeFieldToAnotherTypeFieldRewriter(typeof(Game1), typeof(Game1Methods), "onScreenMenus", "", this.Monitor, null, false, true);
yield return new PropertyToFieldRewriter(typeof(Game1), "toolSpriteSheet", "toolSpriteSheet");
//Method Rewrites
yield return new MethodParentRewriter(typeof(Game1), typeof(Game1Methods));
yield return new MethodParentRewriter(typeof(Farmer), typeof(FarmerMethods));

View File

@ -37,15 +37,21 @@
<WarningLevel>4</WarningLevel>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Net.Compilers" Version="3.3.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>..\..\..\..\..\AndroidStudioProjects\SMAPI Android Installer\app\src\main\assets\Stardew\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Google.Android.Vending.Expansion.Downloader">
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.4.122\assemblies\Google.Android.Vending.Expansion.Downloader.dll</HintPath>
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.4.128\assemblies\Google.Android.Vending.Expansion.Downloader.dll</HintPath>
</Reference>
<Reference Include="Google.Android.Vending.Licensing">
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.4.122\assemblies\Google.Android.Vending.Licensing.dll</HintPath>
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.4.128\assemblies\Google.Android.Vending.Licensing.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Mono.Android" />
@ -53,7 +59,7 @@
<HintPath>..\..\..\..\..\AndroidStudioProjects\SMAPI Android Installer\app\src\main\assets\Stardew\Mono.Cecil.dll</HintPath>
</Reference>
<Reference Include="MonoGame.Framework">
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.4.122\assemblies\MonoGame.Framework.dll</HintPath>
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.4.128\assemblies\MonoGame.Framework.dll</HintPath>
</Reference>
<Reference Include="MonoMod.RuntimeDetour">
<HintPath>..\..\..\..\..\AndroidStudioProjects\SMAPI Android Installer\app\src\main\assets\Stardew\MonoMod.RuntimeDetour.dll</HintPath>
@ -71,10 +77,10 @@
<HintPath>..\SMAPI.Toolkit.CoreInterfaces\bin\Debug\net4.5\SMAPI.Toolkit.CoreInterfaces.dll</HintPath>
</Reference>
<Reference Include="StardewValley">
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.4.122\assemblies\StardewValley.dll</HintPath>
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.4.128\assemblies\StardewValley.dll</HintPath>
</Reference>
<Reference Include="StardewValley.GameData">
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.4.122\assemblies\StardewValley.GameData.dll</HintPath>
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.4.128\assemblies\StardewValley.GameData.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@ -227,6 +233,7 @@
<Compile Include="Framework\ModLoading\Rewriters\FieldReplaceRewriter.cs" />
<Compile Include="Framework\ModLoading\Rewriters\FieldToPropertyRewriter.cs" />
<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\TypeFieldToAnotherTypeFieldRewriter.cs" />
<Compile Include="Framework\ModLoading\Rewriters\TypeReferenceRewriter.cs" />
@ -397,4 +404,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>