forked from liza/Deliveroo
Add config command
This commit is contained in:
parent
dba5754d40
commit
342564d6bf
@ -7,6 +7,7 @@ using Dalamud.Game.ClientState;
|
|||||||
using Dalamud.Game.ClientState.Conditions;
|
using Dalamud.Game.ClientState.Conditions;
|
||||||
using Dalamud.Game.ClientState.Objects;
|
using Dalamud.Game.ClientState.Objects;
|
||||||
using Dalamud.Game.ClientState.Objects.Types;
|
using Dalamud.Game.ClientState.Objects.Types;
|
||||||
|
using Dalamud.Game.Command;
|
||||||
using Dalamud.Game.Gui;
|
using Dalamud.Game.Gui;
|
||||||
using Dalamud.Interface.Windowing;
|
using Dalamud.Interface.Windowing;
|
||||||
using Dalamud.Logging;
|
using Dalamud.Logging;
|
||||||
@ -33,6 +34,7 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
|
|||||||
private readonly ObjectTable _objectTable;
|
private readonly ObjectTable _objectTable;
|
||||||
private readonly TargetManager _targetManager;
|
private readonly TargetManager _targetManager;
|
||||||
private readonly Condition _condition;
|
private readonly Condition _condition;
|
||||||
|
private readonly CommandManager _commandManager;
|
||||||
|
|
||||||
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
|
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
|
||||||
private readonly Configuration _configuration;
|
private readonly Configuration _configuration;
|
||||||
@ -54,7 +56,7 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
|
|||||||
|
|
||||||
public DeliverooPlugin(DalamudPluginInterface pluginInterface, ChatGui chatGui, GameGui gameGui,
|
public DeliverooPlugin(DalamudPluginInterface pluginInterface, ChatGui chatGui, GameGui gameGui,
|
||||||
Framework framework, ClientState clientState, ObjectTable objectTable, TargetManager targetManager,
|
Framework framework, ClientState clientState, ObjectTable objectTable, TargetManager targetManager,
|
||||||
DataManager dataManager, Condition condition)
|
DataManager dataManager, Condition condition, CommandManager commandManager)
|
||||||
{
|
{
|
||||||
_pluginInterface = pluginInterface;
|
_pluginInterface = pluginInterface;
|
||||||
_chatGui = chatGui;
|
_chatGui = chatGui;
|
||||||
@ -64,6 +66,7 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
|
|||||||
_objectTable = objectTable;
|
_objectTable = objectTable;
|
||||||
_targetManager = targetManager;
|
_targetManager = targetManager;
|
||||||
_condition = condition;
|
_condition = condition;
|
||||||
|
_commandManager = commandManager;
|
||||||
|
|
||||||
var dalamudReflector = new DalamudReflector(_pluginInterface, _framework);
|
var dalamudReflector = new DalamudReflector(_pluginInterface, _framework);
|
||||||
_yesAlreadyIpc = new YesAlreadyIpc(dalamudReflector);
|
_yesAlreadyIpc = new YesAlreadyIpc(dalamudReflector);
|
||||||
@ -79,6 +82,10 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
|
|||||||
_framework.Update += FrameworkUpdate;
|
_framework.Update += FrameworkUpdate;
|
||||||
_pluginInterface.UiBuilder.Draw += _windowSystem.Draw;
|
_pluginInterface.UiBuilder.Draw += _windowSystem.Draw;
|
||||||
_pluginInterface.UiBuilder.OpenConfigUi += _configWindow.Toggle;
|
_pluginInterface.UiBuilder.OpenConfigUi += _configWindow.Toggle;
|
||||||
|
_commandManager.AddHandler("/deliveroo", new CommandInfo(ProcessCommand)
|
||||||
|
{
|
||||||
|
HelpMessage = "Open the configuration"
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name => "Deliveroo";
|
public string Name => "Deliveroo";
|
||||||
@ -233,6 +240,7 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
|
|||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
_commandManager.RemoveHandler("/deliveroo");
|
||||||
_pluginInterface.UiBuilder.OpenConfigUi -= _configWindow.Toggle;
|
_pluginInterface.UiBuilder.OpenConfigUi -= _configWindow.Toggle;
|
||||||
_pluginInterface.UiBuilder.Draw -= _windowSystem.Draw;
|
_pluginInterface.UiBuilder.Draw -= _windowSystem.Draw;
|
||||||
_framework.Update -= FrameworkUpdate;
|
_framework.Update -= FrameworkUpdate;
|
||||||
@ -240,6 +248,8 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
|
|||||||
RestoreYesAlready();
|
RestoreYesAlready();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ProcessCommand(string command, string arguments) => _configWindow.Toggle();
|
||||||
|
|
||||||
private void SaveYesAlready()
|
private void SaveYesAlready()
|
||||||
{
|
{
|
||||||
if (_yesAlreadyState.Saved)
|
if (_yesAlreadyState.Saved)
|
||||||
|
Loading…
Reference in New Issue
Block a user