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 committed by Chris
parent a0c838b02a
commit d3315ae6b5
6 changed files with 10 additions and 7 deletions

View File

@ -95,7 +95,7 @@ namespace StardewModdingAPI
internal static string ModsPath { get; set; } internal static string ModsPath { get; set; }
/// <summary>The game's current semantic version.</summary> /// <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> /// <summary>The target game platform.</summary>
internal static Platform Platform { get; } = Platform.Android; internal static Platform Platform { get; } = Platform.Android;

View File

@ -87,9 +87,9 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters
} }
else if (this.RainDropFix && !this.UsingInstance) 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 else
{ {

View File

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

View File

@ -1916,11 +1916,11 @@ label_168:
DrawAfterMap.Invoke(); DrawAfterMap.Invoke();
events.RenderedHud.RaiseEmpty(); events.RenderedHud.RaiseEmpty();
_spriteBatchEnd.Invoke(); _spriteBatchEnd.Invoke();
if (tutorialManager != null) if (TutorialManager.Instance != null)
{ {
SetSpriteBatchBeginNextID("A-D"); SetSpriteBatchBeginNextID("A-D");
SpriteBatchBegin.Invoke(options.zoomLevel); SpriteBatchBegin.Invoke(options.zoomLevel);
tutorialManager.draw(spriteBatch); TutorialManager.Instance.draw(spriteBatch);
_spriteBatchEnd.Invoke(); _spriteBatchEnd.Invoke();
} }
DrawToolbar.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), "rainDrops", "Instance", this.Monitor, null, false, true);
yield return new TypeFieldToAnotherTypeFieldRewriter(typeof(Game1), typeof(Game1Methods), "onScreenMenus", "", 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 //Method Rewrites
yield return new MethodParentRewriter(typeof(Game1), typeof(Game1Methods)); yield return new MethodParentRewriter(typeof(Game1), typeof(Game1Methods));
yield return new MethodParentRewriter(typeof(Farmer), typeof(FarmerMethods)); yield return new MethodParentRewriter(typeof(Farmer), typeof(FarmerMethods));

View File

@ -224,6 +224,7 @@
<Compile Include="Framework\ModLoading\Rewriters\FieldReplaceRewriter.cs" /> <Compile Include="Framework\ModLoading\Rewriters\FieldReplaceRewriter.cs" />
<Compile Include="Framework\ModLoading\Rewriters\FieldToPropertyRewriter.cs" /> <Compile Include="Framework\ModLoading\Rewriters\FieldToPropertyRewriter.cs" />
<Compile Include="Framework\ModLoading\Rewriters\MethodParentRewriter.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\StaticFieldToConstantRewriter.cs" />
<Compile Include="Framework\ModLoading\Rewriters\TypeFieldToAnotherTypeFieldRewriter.cs" /> <Compile Include="Framework\ModLoading\Rewriters\TypeFieldToAnotherTypeFieldRewriter.cs" />
<Compile Include="Framework\ModLoading\Rewriters\TypeReferenceRewriter.cs" /> <Compile Include="Framework\ModLoading\Rewriters\TypeReferenceRewriter.cs" />