From 55cd31f4f7d5122149c02abfaf0f408298503c6a Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 5 Sep 2020 15:41:21 -0400 Subject: minor cleanup --- src/SMAPI/Metadata/CoreAssetPropagator.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src/SMAPI/Metadata/CoreAssetPropagator.cs') diff --git a/src/SMAPI/Metadata/CoreAssetPropagator.cs b/src/SMAPI/Metadata/CoreAssetPropagator.cs index 5c77bf66..41d10cd4 100644 --- a/src/SMAPI/Metadata/CoreAssetPropagator.cs +++ b/src/SMAPI/Metadata/CoreAssetPropagator.cs @@ -34,9 +34,6 @@ namespace StardewModdingAPI.Metadata /// Simplifies access to private game code. private readonly Reflector Reflection; - /// Encapsulates monitoring and logging. - private readonly IMonitor Monitor; - /// Optimized bucket categories for batch reloading assets. private enum AssetBucket { @@ -57,12 +54,10 @@ namespace StardewModdingAPI.Metadata /// Initialize the core asset data. /// Normalizes an asset key to match the cache key and assert that it's valid. /// Simplifies access to private code. - /// Encapsulates monitoring and logging. - public CoreAssetPropagator(Func assertAndNormalizeAssetName, Reflector reflection, IMonitor monitor) + public CoreAssetPropagator(Func assertAndNormalizeAssetName, Reflector reflection) { this.AssertAndNormalizeAssetName = assertAndNormalizeAssetName; this.Reflection = reflection; - this.Monitor = monitor; } /// Reload one of the game's core assets (if applicable). -- cgit From a6274533090053e1c9ccc9ddf282cb672b0e3af5 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 6 Sep 2020 16:39:47 -0400 Subject: move title menu asset propagation into method --- src/SMAPI/Metadata/CoreAssetPropagator.cs | 32 ++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'src/SMAPI/Metadata/CoreAssetPropagator.cs') diff --git a/src/SMAPI/Metadata/CoreAssetPropagator.cs b/src/SMAPI/Metadata/CoreAssetPropagator.cs index 41d10cd4..d7dd9fb9 100644 --- a/src/SMAPI/Metadata/CoreAssetPropagator.cs +++ b/src/SMAPI/Metadata/CoreAssetPropagator.cs @@ -452,17 +452,7 @@ namespace StardewModdingAPI.Metadata return false; case "minigames\\titlebuttons": // TitleMenu - { - if (Game1.activeClickableMenu is TitleMenu titleMenu) - { - Texture2D texture = content.Load(key); - titleMenu.titleButtonsTexture = texture; - foreach (TemporaryAnimatedSprite bird in titleMenu.birds) - bird.texture = texture; - return true; - } - } - return false; + return this.ReloadTitleButtons(content, key); /**** ** Content\TileSheets @@ -569,6 +559,26 @@ namespace StardewModdingAPI.Metadata /**** ** Reload texture methods ****/ + /// Reload buttons on the title screen. + /// The content manager through which to reload the asset. + /// The asset key to reload. + /// Returns whether any textures were reloaded. + private bool ReloadTitleButtons(LocalizedContentManager content, string key) + { + if (Game1.activeClickableMenu is TitleMenu titleMenu) + { + Texture2D texture = content.Load(key); + + titleMenu.titleButtonsTexture = texture; + foreach (TemporaryAnimatedSprite bird in titleMenu.birds) + bird.texture = texture; + + return true; + } + + return false; + } + /// Reload the sprites for matching pets or horses. /// The animal type. /// The content manager through which to reload the asset. -- cgit From 0b21357e37c900774668fdaf3e83e1e7f7df0c38 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 6 Sep 2020 16:40:32 -0400 Subject: fix asset propagation for title menu buttons --- src/SMAPI/Metadata/CoreAssetPropagator.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/SMAPI/Metadata/CoreAssetPropagator.cs') diff --git a/src/SMAPI/Metadata/CoreAssetPropagator.cs b/src/SMAPI/Metadata/CoreAssetPropagator.cs index d7dd9fb9..71199d59 100644 --- a/src/SMAPI/Metadata/CoreAssetPropagator.cs +++ b/src/SMAPI/Metadata/CoreAssetPropagator.cs @@ -563,6 +563,7 @@ namespace StardewModdingAPI.Metadata /// The content manager through which to reload the asset. /// The asset key to reload. /// Returns whether any textures were reloaded. + /// Derived from the constructor and . private bool ReloadTitleButtons(LocalizedContentManager content, string key) { if (Game1.activeClickableMenu is TitleMenu titleMenu) @@ -570,6 +571,11 @@ namespace StardewModdingAPI.Metadata Texture2D texture = content.Load(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; -- cgit