diff --git a/src/SMAPI/Framework/ContentCoordinator.cs b/src/SMAPI/Framework/ContentCoordinator.cs index 86415a5f..43c67943 100644 --- a/src/SMAPI/Framework/ContentCoordinator.cs +++ b/src/SMAPI/Framework/ContentCoordinator.cs @@ -412,17 +412,28 @@ namespace StardewModdingAPI.Framework // cached assets foreach (IContentManager contentManager in this.ContentManagers) { +#if SMAPI_FOR_MOBILE + HashSet removingAssets = new HashSet(); +#endif foreach ((string key, object asset) in contentManager.GetCachedAssets()) { if (!predicate(contentManager, key, asset.GetType())) continue; AssetName assetName = this.ParseAssetName(key, allowLocales: true); +#if !SMAPI_FOR_MOBILE contentManager.InvalidateCache(assetName, dispose); +#else + removingAssets.Add(assetName); +#endif if (!invalidatedAssets.ContainsKey(assetName)) invalidatedAssets[assetName] = asset.GetType(); } +#if SMAPI_FOR_MOBILE + foreach (IAssetName assetName in removingAssets) + contentManager.InvalidateCache(assetName, dispose); +#endif } // forget localized flags diff --git a/src/SMAPI/Framework/ModLoading/RewriteFacades/ISoundBankMethods.cs b/src/SMAPI/Framework/ModLoading/RewriteFacades/ISoundBankMethods.cs index 881cc0e9..07e785e0 100644 --- a/src/SMAPI/Framework/ModLoading/RewriteFacades/ISoundBankMethods.cs +++ b/src/SMAPI/Framework/ModLoading/RewriteFacades/ISoundBankMethods.cs @@ -1,9 +1,24 @@ -using Microsoft.Xna.Framework.Audio; +using System.Reflection; +using Microsoft.Xna.Framework.Audio; using StardewValley; namespace StardewModdingAPI.Framework.ModLoading.RewriteFacades; public interface ISoundBankMethods : ISoundBank { - CueDefinition GetCueDefinition(string name); + void AddCue(CueDefinition cueDefinition) + { + SoundBank soundBank = (SoundBank)this.GetType() + .GetField("soundBank", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public) + ?.GetValue(this); + soundBank?.AddCue(cueDefinition); + } + + CueDefinition GetCueDefinition(string name) + { + SoundBank soundBank = (SoundBank)this.GetType() + .GetField("soundBank", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public) + ?.GetValue(this); + return soundBank?.GetCueDefinition(name); + } } diff --git a/src/SMAPI/Metadata/CoreAssetPropagator.cs b/src/SMAPI/Metadata/CoreAssetPropagator.cs index 82deb6b9..39a6e0e6 100644 --- a/src/SMAPI/Metadata/CoreAssetPropagator.cs +++ b/src/SMAPI/Metadata/CoreAssetPropagator.cs @@ -654,25 +654,19 @@ namespace StardewModdingAPI.Metadata { Texture2D texture = content.Load(assetName.BaseName); -#if SMAPI_FOR_MOBILE - this.Reflection.GetField(titleMenu, "titleButtonsTexture").SetValue(texture); - titleMenu.backButton.texture = texture; - titleMenu.aboutButton.texture = texture; - this.Reflection.GetField(titleMenu, "languageButton").SetValue(texture); - foreach (ClickableTextureComponent button in titleMenu.buttons) - button.texture = texture; - foreach (TemporaryAnimatedSprite bird in this.Reflection.GetField>(titleMenu, "birds").GetValue()) - bird.texture = texture; -#else titleMenu.titleButtonsTexture = texture; +#if SMAPI_FOR_MOBILE + if (titleMenu.backButton != null) + titleMenu.backButton.texture = texture; +#else titleMenu.backButton.texture = texture; +#endif titleMenu.aboutButton.texture = texture; titleMenu.languageButton.texture = texture; foreach (ClickableTextureComponent button in titleMenu.buttons) button.texture = texture; foreach (TemporaryAnimatedSprite bird in titleMenu.birds) bird.texture = texture; -#endif return true; }