Update for 1.4.5.138, rewrite for it isSnowing field, draw logic sync

This commit is contained in:
yangzhi 2020-02-20 14:09:15 +08:00 committed by Chris
parent 3086a3833c
commit 711845fc29
5 changed files with 58 additions and 46 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.5.137"); internal static ISemanticVersion GameVersion { get; } = new GameVersion("1.4.5.138");
/// <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

@ -24,6 +24,18 @@ namespace StardewModdingAPI.Framework.RewriteFacades
} }
} }
public static bool IsSnowingProp
{
get
{
return WeatherDebrisManager.Instance.isSnowing;
}
set
{
WeatherDebrisManager.Instance.isSnowing = value;
}
}
public static bool IsDebrisWeatherProp public static bool IsDebrisWeatherProp
{ {
get get

View File

@ -1009,6 +1009,7 @@ namespace StardewModdingAPI.Framework
IReflectedMethod DrawAfterMap = this.Reflection.GetMethod(this, "DrawAfterMap", new Type[] { }); IReflectedMethod DrawAfterMap = this.Reflection.GetMethod(this, "DrawAfterMap", new Type[] { });
IReflectedMethod DrawToolbar = this.Reflection.GetMethod(this, "DrawToolbar", new Type[] { }); IReflectedMethod DrawToolbar = this.Reflection.GetMethod(this, "DrawToolbar", new Type[] { });
IReflectedMethod DrawVirtualJoypad = this.Reflection.GetMethod(this, "DrawVirtualJoypad", new Type[] { }); IReflectedMethod DrawVirtualJoypad = this.Reflection.GetMethod(this, "DrawVirtualJoypad", new Type[] { });
IReflectedMethod DrawMenuMouseCursor = this.Reflection.GetMethod(this, "DrawMenuMouseCursor", new Type[] { });
IReflectedMethod DrawFadeToBlackFullScreenRect = this.Reflection.GetMethod(this, "DrawFadeToBlackFullScreenRect", new Type[] { }); IReflectedMethod DrawFadeToBlackFullScreenRect = this.Reflection.GetMethod(this, "DrawFadeToBlackFullScreenRect", new Type[] { });
IReflectedMethod DrawChatBox = this.Reflection.GetMethod(this, "DrawChatBox", new Type[] { }); IReflectedMethod DrawChatBox = this.Reflection.GetMethod(this, "DrawChatBox", new Type[] { });
IReflectedMethod DrawDialogueBoxForPinchZoom = this.Reflection.GetMethod(this, "DrawDialogueBoxForPinchZoom", new Type[] { }); IReflectedMethod DrawDialogueBoxForPinchZoom = this.Reflection.GetMethod(this, "DrawDialogueBoxForPinchZoom", new Type[] { });
@ -1083,8 +1084,8 @@ namespace StardewModdingAPI.Framework
RestoreViewportAndZoom(); RestoreViewportAndZoom();
} }
} }
if (overlayMenu != null) if (overlayMenu == null)
{ return;
BackupViewportAndZoom(false); BackupViewportAndZoom(false);
SetSpriteBatchBeginNextID("B"); SetSpriteBatchBeginNextID("B");
_spriteBatchBegin.Invoke(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, null); _spriteBatchBegin.Invoke(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, null);
@ -1092,8 +1093,6 @@ namespace StardewModdingAPI.Framework
_spriteBatchEnd.Invoke(); _spriteBatchEnd.Invoke();
RestoreViewportAndZoom(); RestoreViewportAndZoom();
} }
return;
}
else else
{ {
base.GraphicsDevice.Clear(Game1.bgColor); base.GraphicsDevice.Clear(Game1.bgColor);
@ -1179,39 +1178,35 @@ namespace StardewModdingAPI.Framework
} }
this.drawOverlays(spriteBatch); this.drawOverlays(spriteBatch);
this.renderScreenBufferTargetScreen(target_screen); this.renderScreenBufferTargetScreen(target_screen);
if (currentMinigame is FishingGame && activeClickableMenu != null) switch (Game1.currentMinigame)
{ {
SetSpriteBatchBeginNextID("A-A"); case FishingGame _ when Game1.activeClickableMenu != null:
Game1.SetSpriteBatchBeginNextID("A-A");
SpriteBatchBegin.Invoke(1f); SpriteBatchBegin.Invoke(1f);
activeClickableMenu.draw(spriteBatch); Game1.activeClickableMenu.draw(Game1.spriteBatch);
_spriteBatchEnd.Invoke(); _spriteBatchEnd.Invoke();
this.drawOverlays(spriteBatch); this.drawOverlays(Game1.spriteBatch, true);
} break;
else case FantasyBoardGame _ when Game1.activeClickableMenu != null:
if (Game1.IsActiveClickableMenuNativeScaled)
{ {
if (!(currentMinigame is FantasyBoardGame) || activeClickableMenu == null) Game1.BackupViewportAndZoom(true);
{ Game1.SetSpriteBatchBeginNextID("A1");
return; SpriteBatchBegin.Invoke(Game1.NativeZoomLevel);
} Game1.activeClickableMenu.draw(Game1.spriteBatch);
if (IsActiveClickableMenuNativeScaled)
{
BackupViewportAndZoom(true);
SetSpriteBatchBeginNextID("A1");
SpriteBatchBegin.Invoke(NativeZoomLevel);
activeClickableMenu.draw(spriteBatch);
_spriteBatchEnd.Invoke(); _spriteBatchEnd.Invoke();
RestoreViewportAndZoom(); Game1.RestoreViewportAndZoom();
break;
} }
else Game1.BackupViewportAndZoom(false);
{ Game1.SetSpriteBatchBeginNextID("A2");
BackupViewportAndZoom(false);
SetSpriteBatchBeginNextID("A2");
SpriteBatchBegin.Invoke(1f); SpriteBatchBegin.Invoke(1f);
activeClickableMenu.draw(spriteBatch); Game1.activeClickableMenu.draw(Game1.spriteBatch);
_spriteBatchEnd.Invoke(); _spriteBatchEnd.Invoke();
RestoreViewportAndZoom(); Game1.RestoreViewportAndZoom();
} break;
} }
DrawVirtualJoypad.Invoke();
} }
else if (showingEndOfNightStuff) else if (showingEndOfNightStuff)
{ {
@ -1885,6 +1880,8 @@ label_168:
{ {
farmEvent.drawAboveEverything(spriteBatch); farmEvent.drawAboveEverything(spriteBatch);
} }
if (Game1.emoteMenu != null && !this.takingMapScreenshot)
Game1.emoteMenu.draw(Game1.spriteBatch);
if (HostPaused) if (HostPaused)
{ {
string s = content.LoadString("Strings\\StringsFromCSFiles:DayTimeMoneyBox.cs.10378"); string s = content.LoadString("Strings\\StringsFromCSFiles:DayTimeMoneyBox.cs.10378");
@ -1916,8 +1913,10 @@ label_168:
_spriteBatchEnd.Invoke(); _spriteBatchEnd.Invoke();
} }
DrawToolbar.Invoke(); DrawToolbar.Invoke();
DrawVirtualJoypad.Invoke(); DrawMenuMouseCursor.Invoke();
} }
if (_drawHUD.GetValue() || Game1.player.CanMove)
DrawVirtualJoypad.Invoke();
DrawFadeToBlackFullScreenRect.Invoke(); DrawFadeToBlackFullScreenRect.Invoke();
SetSpriteBatchBeginNextID("A-E"); SetSpriteBatchBeginNextID("A-E");
SpriteBatchBegin.Invoke(1f); SpriteBatchBegin.Invoke(1f);

View File

@ -45,6 +45,7 @@ namespace StardewModdingAPI.Metadata
//isRaining and isDebrisWeather fix done. //isRaining and isDebrisWeather fix done.
yield return new TypeFieldToAnotherTypePropertyRewriter(typeof(Game1), typeof(Game1Methods), "isRaining", "IsRainingProp"); yield return new TypeFieldToAnotherTypePropertyRewriter(typeof(Game1), typeof(Game1Methods), "isRaining", "IsRainingProp");
yield return new TypeFieldToAnotherTypePropertyRewriter(typeof(Game1), typeof(Game1Methods), "isSnowing", "IsSnowingProp");
yield return new TypeFieldToAnotherTypePropertyRewriter(typeof(Game1), typeof(Game1Methods), "isDebrisWeather", "IsDebrisWeatherProp"); yield return new TypeFieldToAnotherTypePropertyRewriter(typeof(Game1), typeof(Game1Methods), "isDebrisWeather", "IsDebrisWeatherProp");
// Cause of System.Security.VerificationException : Invalid instruction target // Cause of System.Security.VerificationException : Invalid instruction target

View File

@ -42,10 +42,10 @@
<HintPath>..\..\..\..\..\AndroidStudioProjects\SMAPI Android Installer\app\src\main\assets\Stardew\0Harmony.dll</HintPath> <HintPath>..\..\..\..\..\AndroidStudioProjects\SMAPI Android Installer\app\src\main\assets\Stardew\0Harmony.dll</HintPath>
</Reference> </Reference>
<Reference Include="Google.Android.Vending.Expansion.Downloader"> <Reference Include="Google.Android.Vending.Expansion.Downloader">
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.137\assemblies\Google.Android.Vending.Expansion.Downloader.dll</HintPath> <HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.138\assemblies\Google.Android.Vending.Expansion.Downloader.dll</HintPath>
</Reference> </Reference>
<Reference Include="Google.Android.Vending.Licensing"> <Reference Include="Google.Android.Vending.Licensing">
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.137\assemblies\Google.Android.Vending.Licensing.dll</HintPath> <HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.138\assemblies\Google.Android.Vending.Licensing.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="Mono.Android" /> <Reference Include="Mono.Android" />
@ -53,7 +53,7 @@
<HintPath>..\..\..\..\..\AndroidStudioProjects\SMAPI Android Installer\app\src\main\assets\Stardew\Mono.Cecil.dll</HintPath> <HintPath>..\..\..\..\..\AndroidStudioProjects\SMAPI Android Installer\app\src\main\assets\Stardew\Mono.Cecil.dll</HintPath>
</Reference> </Reference>
<Reference Include="MonoGame.Framework"> <Reference Include="MonoGame.Framework">
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.137\assemblies\MonoGame.Framework.dll</HintPath> <HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.138\assemblies\MonoGame.Framework.dll</HintPath>
</Reference> </Reference>
<Reference Include="MonoMod.RuntimeDetour"> <Reference Include="MonoMod.RuntimeDetour">
<HintPath>..\..\..\..\..\AndroidStudioProjects\SMAPI Android Installer\app\src\main\assets\Stardew\MonoMod.RuntimeDetour.dll</HintPath> <HintPath>..\..\..\..\..\AndroidStudioProjects\SMAPI Android Installer\app\src\main\assets\Stardew\MonoMod.RuntimeDetour.dll</HintPath>
@ -68,10 +68,10 @@
<HintPath>..\SMAPI.Toolkit\bin\Debug\net4.5\SMAPI.Toolkit.dll</HintPath> <HintPath>..\SMAPI.Toolkit\bin\Debug\net4.5\SMAPI.Toolkit.dll</HintPath>
</Reference> </Reference>
<Reference Include="StardewValley"> <Reference Include="StardewValley">
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.137\assemblies\StardewValley.dll</HintPath> <HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.138\assemblies\StardewValley.dll</HintPath>
</Reference> </Reference>
<Reference Include="StardewValley.GameData"> <Reference Include="StardewValley.GameData">
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.137\assemblies\StardewValley.GameData.dll</HintPath> <HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.138\assemblies\StardewValley.GameData.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />