1.Fix isRaining and isDebrisWeather.

2.Fix a critical error of SpriteTextMethods.getWidthOfString (infinite self recursion)
This commit is contained in:
yangzhi 2020-02-14 20:09:18 +08:00 committed by ZaneYork
parent e753f87626
commit 304885a101
2 changed files with 27 additions and 3 deletions

View File

@ -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();

View File

@ -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);
}
}
}