mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
feat: inject properties before calling ctor
This commit is contained in:
parent
bed7973a95
commit
48081bba7d
3 changed files with 110 additions and 26 deletions
|
|
@ -2,6 +2,7 @@ using System;
|
|||
|
||||
using Dalamud.Game.Command;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.Logging;
|
||||
using Dalamud.Plugin;
|
||||
|
||||
|
|
@ -17,6 +18,9 @@ namespace Dalamud.CorePlugin
|
|||
|
||||
// private Localization localizationManager;
|
||||
|
||||
[PluginService]
|
||||
public static CommandManager CmdManager { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PluginImpl"/> class.
|
||||
/// </summary>
|
||||
|
|
@ -33,7 +37,9 @@ namespace Dalamud.CorePlugin
|
|||
this.Interface.UiBuilder.Draw += this.OnDraw;
|
||||
this.Interface.UiBuilder.OpenConfigUi += this.OnOpenConfigUi;
|
||||
|
||||
Service<CommandManager>.Get().AddHandler("/di", new(this.OnCommand) { HelpMessage = $"Access the {this.Name} plugin." });
|
||||
CmdManager.AddHandler("/coreplug", new(this.OnCommand) { HelpMessage = $"Access the {this.Name} plugin." });
|
||||
|
||||
PluginLog.Information("CorePlugin ctor!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -52,7 +58,7 @@ namespace Dalamud.CorePlugin
|
|||
/// <inheritdoc/>
|
||||
public void Dispose()
|
||||
{
|
||||
Service<CommandManager>.Get().RemoveHandler("/di");
|
||||
CmdManager.RemoveHandler("/coreplug");
|
||||
|
||||
this.Interface.UiBuilder.Draw -= this.OnDraw;
|
||||
|
||||
|
|
@ -92,6 +98,7 @@ namespace Dalamud.CorePlugin
|
|||
|
||||
private void OnCommand(string command, string args)
|
||||
{
|
||||
PluginLog.Information("Command called!");
|
||||
// this.window.IsOpen = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue