feat(core): add static Plugin.Instance handle for UI helper access
This commit is contained in:
@@ -91,6 +91,13 @@ public sealed class Plugin : IAsyncDalamudPlugin
|
|||||||
public static Configuration Config = null!;
|
public static Configuration Config = null!;
|
||||||
public static FileDialogManager FileDialogManager { get; private set; } = null!;
|
public static FileDialogManager FileDialogManager { get; private set; } = null!;
|
||||||
|
|
||||||
|
// Single static handle to the live Plugin instance. Lets statically-accessed
|
||||||
|
// UI helpers (TabContextMenu) reach instance-only members — SaveConfig(),
|
||||||
|
// AutoTellTabsService, CustomAudioPlayer — without ctor-injection. A per-member
|
||||||
|
// static accessor is impossible: it would collide by name with the instance
|
||||||
|
// property (CS0102). Filled in the post-resolve bridge block below.
|
||||||
|
internal static Plugin Instance = null!;
|
||||||
|
|
||||||
public readonly WindowSystem WindowSystem = new(PluginName);
|
public readonly WindowSystem WindowSystem = new(PluginName);
|
||||||
|
|
||||||
// Phase-2 services are constructed in LoadAsync; null! shape is kept
|
// Phase-2 services are constructed in LoadAsync; null! shape is kept
|
||||||
@@ -289,6 +296,10 @@ public sealed class Plugin : IAsyncDalamudPlugin
|
|||||||
);
|
);
|
||||||
|
|
||||||
_host = PluginHostFactory.Build(this, dependencies);
|
_host = PluginHostFactory.Build(this, dependencies);
|
||||||
|
|
||||||
|
// Bridge the static handle before the instance members below are read.
|
||||||
|
Instance = this;
|
||||||
|
|
||||||
_lifecycle = _host.Services.GetRequiredService<PluginLifecycle>();
|
_lifecycle = _host.Services.GetRequiredService<PluginLifecycle>();
|
||||||
_lifecycle.Host = _host;
|
_lifecycle.Host = _host;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user