summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/SGame.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI/Framework/SGame.cs')
-rw-r--r--src/SMAPI/Framework/SGame.cs16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/SMAPI/Framework/SGame.cs b/src/SMAPI/Framework/SGame.cs
index acb3e794..aeaab9ea 100644
--- a/src/SMAPI/Framework/SGame.cs
+++ b/src/SMAPI/Framework/SGame.cs
@@ -161,7 +161,7 @@ namespace StardewModdingAPI.Framework
** Accessors
*********/
/// <summary>SMAPI's content manager.</summary>
- public SContentManager SContentManager { get; }
+ public ContentCore ContentCore { get; }
/// <summary>Whether SMAPI should log more information about the game context.</summary>
public bool VerboseLogging { get; set; }
@@ -190,10 +190,12 @@ namespace StardewModdingAPI.Framework
// override content manager
this.Monitor?.Log("Overriding content manager...", LogLevel.Trace);
- this.SContentManager = new SContentManager(this.Content.ServiceProvider, this.Content.RootDirectory, Thread.CurrentThread.CurrentUICulture, null, this.Monitor, reflection);
- this.Content = new ContentManagerShim(this.SContentManager, "SGame.Content");
- Game1.content = new ContentManagerShim(this.SContentManager, "Game1.content");
- reflection.GetField<LocalizedContentManager>(typeof(Game1), "_temporaryContent").SetValue(new ContentManagerShim(this.SContentManager, "Game1._temporaryContent")); // regenerate value with new content manager
+ this.ContentCore = new ContentCore(this.Content.ServiceProvider, this.Content.RootDirectory, Thread.CurrentThread.CurrentUICulture, null, this.Monitor, reflection);
+ this.Content = this.ContentCore.CreateContentManager("SGame.Content");
+ Game1.content = this.ContentCore.CreateContentManager("Game1.content");
+
+ // replace already-created temporary content managers
+ reflection.GetField<LocalizedContentManager>(typeof(Game1), "_temporaryContent").SetValue(this.ContentCore.CreateContentManager("Game1._temporaryContent")); // regenerate value with new content manager
}
/****
@@ -205,7 +207,7 @@ namespace StardewModdingAPI.Framework
protected override LocalizedContentManager CreateContentManager(IServiceProvider serviceProvider, string rootDirectory)
{
// return default if SMAPI's content manager isn't initialised yet
- if (this.SContentManager == null)
+ if (this.ContentCore == null)
{
this.Monitor?.Log("SMAPI's content manager isn't initialised; skipping content manager interception.", LogLevel.Trace);
return base.CreateContentManager(serviceProvider, rootDirectory);
@@ -216,7 +218,7 @@ namespace StardewModdingAPI.Framework
throw new InvalidOperationException("SMAPI uses a single content manager internally. You can't get a new content manager with a different service provider.");
if (rootDirectory != this.Content.RootDirectory)
throw new InvalidOperationException($"SMAPI uses a single content manager internally. You can't get a new content manager with a different root directory (current is {this.Content.RootDirectory}, requested {rootDirectory}).");
- return new ContentManagerShim(this.SContentManager, "(generated instance)");
+ return this.ContentCore.CreateContentManager("(generated instance)");
}
/// <summary>The method called when the game is updating its state. This happens roughly 60 times per second.</summary>