From 470387a9d55c9d11784353a2fa083f9f774d2a91 Mon Sep 17 00:00:00 2001 From: karashiiro <49822414+karashiiro@users.noreply.github.com> Date: Tue, 28 Apr 2020 14:36:51 -0700 Subject: [PATCH] add ui class --- Plugin.cs | 9 +++++++++ PluginUI.cs | 15 +++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 PluginUI.cs diff --git a/Plugin.cs b/Plugin.cs index 947fae7..c7410a2 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -10,6 +10,7 @@ public class Plugin : IDalamudPlugin { private DalamudPluginInterface pluginInterface; private PluginConfiguration config; + private PluginUI ui; public string Name => "Your Plugin's Display Name"; @@ -21,9 +22,14 @@ public class Plugin : IDalamudPlugin public void Initialize(DalamudPluginInterface pluginInterface) { this.pluginInterface = pluginInterface; + // If your plugin doesn't need a configuration, you can safely remove all references to this variable and class. this.config = (PluginConfiguration)this.pluginInterface.GetPluginConfig() ?? new PluginConfiguration(); + // Likewise here. + this.ui = new PluginUI(); + this.pluginInterface.UiBuilder.OnBuildUi += this.ui.Draw; + AddComandHandlers(); } @@ -85,6 +91,9 @@ protected virtual void Dispose(bool disposing) RemoveCommandHandlers(); // You may not want to save a configuration until after you're done tweaking the class layout. //this.pluginInterface.SavePluginConfig(this.config); + + this.pluginInterface.UiBuilder.OnBuildUi -= this.ui.Draw; + this.pluginInterface.Dispose(); } } diff --git a/PluginUI.cs b/PluginUI.cs new file mode 100644 index 0000000..1512302 --- /dev/null +++ b/PluginUI.cs @@ -0,0 +1,15 @@ +using ImGuiNET; + +namespace DalamudPluginProjectTemplate +{ + public class PluginUI + { + public bool IsVisible { get; set; } + + public void Draw() + { + if (!IsVisible) + return; + } + } +}