move title menu asset propagation into method

This commit is contained in:
Jesse Plamondon-Willard 2020-09-06 16:39:47 -04:00
parent d7209e438d
commit a627453309
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
1 changed files with 21 additions and 11 deletions

View File

@ -452,17 +452,7 @@ namespace StardewModdingAPI.Metadata
return false; return false;
case "minigames\\titlebuttons": // TitleMenu case "minigames\\titlebuttons": // TitleMenu
{ return this.ReloadTitleButtons(content, key);
if (Game1.activeClickableMenu is TitleMenu titleMenu)
{
Texture2D texture = content.Load<Texture2D>(key);
titleMenu.titleButtonsTexture = texture;
foreach (TemporaryAnimatedSprite bird in titleMenu.birds)
bird.texture = texture;
return true;
}
}
return false;
/**** /****
** Content\TileSheets ** Content\TileSheets
@ -569,6 +559,26 @@ namespace StardewModdingAPI.Metadata
/**** /****
** Reload texture methods ** Reload texture methods
****/ ****/
/// <summary>Reload buttons on the title screen.</summary>
/// <param name="content">The content manager through which to reload the asset.</param>
/// <param name="key">The asset key to reload.</param>
/// <returns>Returns whether any textures were reloaded.</returns>
private bool ReloadTitleButtons(LocalizedContentManager content, string key)
{
if (Game1.activeClickableMenu is TitleMenu titleMenu)
{
Texture2D texture = content.Load<Texture2D>(key);
titleMenu.titleButtonsTexture = texture;
foreach (TemporaryAnimatedSprite bird in titleMenu.birds)
bird.texture = texture;
return true;
}
return false;
}
/// <summary>Reload the sprites for matching pets or horses.</summary> /// <summary>Reload the sprites for matching pets or horses.</summary>
/// <typeparam name="TAnimal">The animal type.</typeparam> /// <typeparam name="TAnimal">The animal type.</typeparam>
/// <param name="content">The content manager through which to reload the asset.</param> /// <param name="content">The content manager through which to reload the asset.</param>