1.Fix isRaining and isDebrisWeather.
2.Fix a critical error of SpriteTextMethods.getWidthOfString (infinite self recursion)
This commit is contained in:
parent
cc92375a9d
commit
f7be556bbf
|
@ -12,6 +12,30 @@ namespace StardewModdingAPI.Framework.RewriteFacades
|
|||
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 bool IsRainingProp
|
||||
{
|
||||
get
|
||||
{
|
||||
return RainManager.Instance.isRaining;
|
||||
}
|
||||
set
|
||||
{
|
||||
RainManager.Instance.isRaining = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsDebrisWeatherProp
|
||||
{
|
||||
get
|
||||
{
|
||||
return WeatherDebrisManager.Instance.isDebrisWeather;
|
||||
}
|
||||
set
|
||||
{
|
||||
WeatherDebrisManager.Instance.isDebrisWeather = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateDebrisWeatherForMovement(List<WeatherDebris> debris)
|
||||
{
|
||||
WeatherDebrisManager.Instance.UpdateDebrisWeatherForMovement();
|
||||
|
|
|
@ -11,12 +11,12 @@ namespace StardewModdingAPI.Framework.RewriteFacades
|
|||
{
|
||||
public static int getWidthOfString(string s, int widthConstraint = 999999)
|
||||
{
|
||||
return getWidthOfString(s);
|
||||
return SpriteText.getWidthOfString(s);
|
||||
}
|
||||
|
||||
public static void drawStringHorizontallyCenteredAt(SpriteBatch b, string s, int x, int y, int characterPosition = 999999, int width = -1, int height = 999999, float alpha = -1f, float layerDepth = 0.088f, bool junimoText = false, int color = -1, int maxWdith = 99999)
|
||||
{
|
||||
drawString(b, s, x - SpriteText.getWidthOfString(s) / 2, y, characterPosition, width, height, alpha, layerDepth, junimoText, -1, "", color);
|
||||
SpriteText.drawString(b, s, x - SpriteText.getWidthOfString(s) / 2, y, characterPosition, width, height, alpha, layerDepth, junimoText, -1, "", color);
|
||||
}
|
||||
|
||||
public static void drawStringWithScrollBackground(SpriteBatch b, string s, int x, int y, string placeHolderWidthText = "", float alpha = 1f, int color = -1, SpriteText.ScrollTextAlignment scroll_text_alignment = SpriteText.ScrollTextAlignment.Left)
|
||||
|
@ -26,7 +26,7 @@ namespace StardewModdingAPI.Framework.RewriteFacades
|
|||
|
||||
public static void drawStringWithScrollBackground(SpriteBatch b, string s, int x, int y, string placeHolderWidthText, float alpha, int color)
|
||||
{
|
||||
drawStringWithScrollBackground(b, s, x, y, placeHolderWidthText, alpha, color, 0.088f);
|
||||
SpriteText.drawStringWithScrollBackground(b, s, x, y, placeHolderWidthText, alpha, color, 0.088f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,9 +43,13 @@ namespace StardewModdingAPI.Metadata
|
|||
// rewrite for crossplatform compatibility
|
||||
yield return new MethodParentRewriter(typeof(SpriteBatch), typeof(SpriteBatchMethods), onlyIfPlatformChanged: true);
|
||||
|
||||
//isRaining and isDebrisWeather fix 75% done.
|
||||
yield return new TypeFieldToAnotherTypeFieldRewriter(typeof(Game1), typeof(RainManager), "isRaining", "Instance", this.Monitor);
|
||||
yield return new TypeFieldToAnotherTypeFieldRewriter(typeof(Game1), typeof(WeatherDebrisManager), "isDebrisWeather", "Instance", this.Monitor);
|
||||
//isRaining and isDebrisWeather fix done.
|
||||
yield return new TypeFieldToAnotherTypePropertyRewriter(typeof(Game1), typeof(Game1Methods), "isRaining", "IsRainingProp");
|
||||
yield return new TypeFieldToAnotherTypePropertyRewriter(typeof(Game1), typeof(Game1Methods), "isDebrisWeather", "IsDebrisWeatherProp");
|
||||
|
||||
// Cause of System.Security.VerificationException : Invalid instruction target
|
||||
//yield return new TypeFieldToAnotherTypeFieldRewriter(typeof(Game1), typeof(RainManager), "isRaining", "Instance", this.Monitor);
|
||||
//yield return new TypeFieldToAnotherTypeFieldRewriter(typeof(Game1), typeof(WeatherDebrisManager), "isDebrisWeather", "Instance", this.Monitor);
|
||||
yield return new TypeFieldToAnotherTypeFieldRewriter(typeof(GameLocation), typeof(DebrisManager), "debris", "Instance", this.Monitor, "debrisNetCollection", false);
|
||||
yield return new TypeFieldToAnotherTypeFieldRewriter(typeof(Game1), typeof(WeatherDebrisManager), "debrisWeather", "Instance", this.Monitor, "weatherDebrisList");
|
||||
yield return new TypeFieldToAnotherTypeFieldRewriter(typeof(Game1), typeof(Game1Methods), "rainDrops", "Instance", this.Monitor, null, false, true);
|
||||
|
|
Loading…
Reference in New Issue