Determine optional assets availability on startup

This commit is contained in:
Soreepeong 2024-01-21 04:21:26 +09:00
parent 127b91f4b0
commit af1133f999
2 changed files with 12 additions and 0 deletions

View file

@ -69,6 +69,10 @@ namespace Dalamud.CorePlugin
this.Interface.UiBuilder.Draw += this.OnDraw; this.Interface.UiBuilder.Draw += this.OnDraw;
this.Interface.UiBuilder.OpenConfigUi += this.OnOpenConfigUi; this.Interface.UiBuilder.OpenConfigUi += this.OnOpenConfigUi;
this.Interface.UiBuilder.OpenMainUi += this.OnOpenMainUi; this.Interface.UiBuilder.OpenMainUi += this.OnOpenMainUi;
this.Interface.UiBuilder.DefaultFontHandle.ImFontChanged += fc =>
{
Log.Information($"CorePlugin : DefaultFontHandle.ImFontChanged called {fc}");
};
Service<CommandManager>.Get().AddHandler("/coreplug", new(this.OnCommand) { HelpMessage = "Access the plugin." }); Service<CommandManager>.Get().AddHandler("/coreplug", new(this.OnCommand) { HelpMessage = "Access the plugin." });

View file

@ -69,6 +69,14 @@ internal sealed class DalamudAssetManager : IServiceType, IDisposable, IDalamudA
.Select(x => x.ToContentDisposedTask())) .Select(x => x.ToContentDisposedTask()))
.ContinueWith(_ => loadTimings.Dispose()), .ContinueWith(_ => loadTimings.Dispose()),
"Prevent Dalamud from loading more stuff, until we've ensured that all required assets are available."); "Prevent Dalamud from loading more stuff, until we've ensured that all required assets are available.");
Task.WhenAll(
Enum.GetValues<DalamudAsset>()
.Where(x => x is not DalamudAsset.Empty4X4)
.Where(x => x.GetAttribute<DalamudAssetAttribute>()?.Required is false)
.Select(this.CreateStreamAsync)
.Select(x => x.ToContentDisposedTask()))
.ContinueWith(r => Log.Verbose($"Optional assets load state: {r}"));
} }
/// <inheritdoc/> /// <inheritdoc/>