Add /pal to quickly toggle the config window
This commit is contained in:
parent
b1ccc268d7
commit
89d1c46009
@ -4,6 +4,7 @@ using Dalamud.Game.ClientState.Conditions;
|
|||||||
using Dalamud.Game.ClientState.Objects;
|
using Dalamud.Game.ClientState.Objects;
|
||||||
using Dalamud.Game.ClientState.Objects.Enums;
|
using Dalamud.Game.ClientState.Objects.Enums;
|
||||||
using Dalamud.Game.ClientState.Objects.Types;
|
using Dalamud.Game.ClientState.Objects.Types;
|
||||||
|
using Dalamud.Game.Command;
|
||||||
using Dalamud.Interface.Windowing;
|
using Dalamud.Interface.Windowing;
|
||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
using ECommons;
|
using ECommons;
|
||||||
@ -64,6 +65,10 @@ namespace Pal.Client
|
|||||||
pluginInterface.UiBuilder.OpenConfigUi += OnOpenConfigUi;
|
pluginInterface.UiBuilder.OpenConfigUi += OnOpenConfigUi;
|
||||||
Service.Framework.Update += OnFrameworkUpdate;
|
Service.Framework.Update += OnFrameworkUpdate;
|
||||||
Service.Configuration.Saved += OnConfigSaved;
|
Service.Configuration.Saved += OnConfigSaved;
|
||||||
|
Service.CommandManager.AddHandler("/pal", new CommandInfo(OnCommand)
|
||||||
|
{
|
||||||
|
HelpMessage = "Open the configuration/debug window"
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnOpenConfigUi()
|
public void OnOpenConfigUi()
|
||||||
@ -78,11 +83,23 @@ namespace Pal.Client
|
|||||||
configWindow.IsOpen = true;
|
configWindow.IsOpen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnCommand(string command, string arguments)
|
||||||
|
{
|
||||||
|
if (Service.Configuration.FirstUse)
|
||||||
|
{
|
||||||
|
Service.Chat.PrintError("[Palace Pal] Please finish the first-time setup first.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Service.WindowSystem.GetWindow<ConfigWindow>()?.Toggle();
|
||||||
|
}
|
||||||
|
|
||||||
#region IDisposable Support
|
#region IDisposable Support
|
||||||
protected virtual void Dispose(bool disposing)
|
protected virtual void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (!disposing) return;
|
if (!disposing) return;
|
||||||
|
|
||||||
|
Service.CommandManager.RemoveHandler("/pal");
|
||||||
Service.PluginInterface.UiBuilder.Draw -= Service.WindowSystem.Draw;
|
Service.PluginInterface.UiBuilder.Draw -= Service.WindowSystem.Draw;
|
||||||
Service.PluginInterface.UiBuilder.OpenConfigUi -= OnOpenConfigUi;
|
Service.PluginInterface.UiBuilder.OpenConfigUi -= OnOpenConfigUi;
|
||||||
Service.Framework.Update -= OnFrameworkUpdate;
|
Service.Framework.Update -= OnFrameworkUpdate;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using Dalamud.Game.ClientState;
|
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.Command;
|
||||||
using Dalamud.Game.Gui;
|
using Dalamud.Game.Gui;
|
||||||
using Dalamud.Interface.Windowing;
|
using Dalamud.Interface.Windowing;
|
||||||
using Dalamud.IoC;
|
using Dalamud.IoC;
|
||||||
@ -17,6 +18,7 @@ namespace Pal.Client
|
|||||||
[PluginService] public static ObjectTable ObjectTable { get; private set; } = null!;
|
[PluginService] public static ObjectTable ObjectTable { get; private set; } = null!;
|
||||||
[PluginService] public static Framework Framework { get; set; } = null!;
|
[PluginService] public static Framework Framework { get; set; } = null!;
|
||||||
[PluginService] public static Condition Condition { get; set; } = null!;
|
[PluginService] public static Condition Condition { get; set; } = null!;
|
||||||
|
[PluginService] public static CommandManager CommandManager { get; set; } = null!;
|
||||||
|
|
||||||
public static Plugin Plugin { get; set; } = null!;
|
public static Plugin Plugin { get; set; } = null!;
|
||||||
public static WindowSystem WindowSystem { get; set; } = new(typeof(Service).AssemblyQualifiedName);
|
public static WindowSystem WindowSystem { get; set; } = new(typeof(Service).AssemblyQualifiedName);
|
||||||
|
Loading…
Reference in New Issue
Block a user