diff options
| author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-09-07 13:06:27 -0400 |
|---|---|---|
| committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-09-07 13:06:27 -0400 |
| commit | 5e43bdbf5cd6dbab36c25287c85d42ccfeea2c83 (patch) | |
| tree | 0a42305174eb84561a584549cd685c5e95670f36 /src/SMAPI/Metadata/CoreAssetPropagator.cs | |
| parent | 8da88b8fe5b41739c5cd0df3280b9770fc7f10a4 (diff) | |
| parent | f9fac11028354f15d786d5b854608edb10716f79 (diff) | |
| download | SMAPI-5e43bdbf5cd6dbab36c25287c85d42ccfeea2c83.tar.gz SMAPI-5e43bdbf5cd6dbab36c25287c85d42ccfeea2c83.tar.bz2 SMAPI-5e43bdbf5cd6dbab36c25287c85d42ccfeea2c83.zip | |
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/Metadata/CoreAssetPropagator.cs')
| -rw-r--r-- | src/SMAPI/Metadata/CoreAssetPropagator.cs | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/src/SMAPI/Metadata/CoreAssetPropagator.cs b/src/SMAPI/Metadata/CoreAssetPropagator.cs index 5c77bf66..71199d59 100644 --- a/src/SMAPI/Metadata/CoreAssetPropagator.cs +++ b/src/SMAPI/Metadata/CoreAssetPropagator.cs @@ -34,9 +34,6 @@ namespace StardewModdingAPI.Metadata /// <summary>Simplifies access to private game code.</summary> private readonly Reflector Reflection; - /// <summary>Encapsulates monitoring and logging.</summary> - private readonly IMonitor Monitor; - /// <summary>Optimized bucket categories for batch reloading assets.</summary> private enum AssetBucket { @@ -57,12 +54,10 @@ namespace StardewModdingAPI.Metadata /// <summary>Initialize the core asset data.</summary> /// <param name="assertAndNormalizeAssetName">Normalizes an asset key to match the cache key and assert that it's valid.</param> /// <param name="reflection">Simplifies access to private code.</param> - /// <param name="monitor">Encapsulates monitoring and logging.</param> - public CoreAssetPropagator(Func<string, string> assertAndNormalizeAssetName, Reflector reflection, IMonitor monitor) + public CoreAssetPropagator(Func<string, string> assertAndNormalizeAssetName, Reflector reflection) { this.AssertAndNormalizeAssetName = assertAndNormalizeAssetName; this.Reflection = reflection; - this.Monitor = monitor; } /// <summary>Reload one of the game's core assets (if applicable).</summary> @@ -457,17 +452,7 @@ namespace StardewModdingAPI.Metadata return false; case "minigames\\titlebuttons": // TitleMenu - { - 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; + return this.ReloadTitleButtons(content, key); /**** ** Content\TileSheets @@ -574,6 +559,32 @@ namespace StardewModdingAPI.Metadata /**** ** 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> + /// <remarks>Derived from the <see cref="TitleMenu"/> constructor and <see cref="TitleMenu.setUpIcons"/>.</remarks> + private bool ReloadTitleButtons(LocalizedContentManager content, string key) + { + if (Game1.activeClickableMenu is TitleMenu titleMenu) + { + Texture2D texture = content.Load<Texture2D>(key); + + titleMenu.titleButtonsTexture = texture; + titleMenu.backButton.texture = texture; + titleMenu.aboutButton.texture = texture; + titleMenu.languageButton.texture = texture; + foreach (ClickableTextureComponent button in titleMenu.buttons) + button.texture = titleMenu.titleButtonsTexture; + foreach (TemporaryAnimatedSprite bird in titleMenu.birds) + bird.texture = texture; + + return true; + } + + return false; + } + /// <summary>Reload the sprites for matching pets or horses.</summary> /// <typeparam name="TAnimal">The animal type.</typeparam> /// <param name="content">The content manager through which to reload the asset.</param> |
