Skip to content

Commit

Permalink
add ui class
Browse files Browse the repository at this point in the history
  • Loading branch information
karashiiro committed Apr 28, 2020
1 parent 8ed5156 commit 470387a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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();
}

Expand Down Expand Up @@ -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();
}
}
Expand Down
15 changes: 15 additions & 0 deletions PluginUI.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using ImGuiNET;

namespace DalamudPluginProjectTemplate
{
public class PluginUI
{
public bool IsVisible { get; set; }

public void Draw()
{
if (!IsVisible)
return;
}
}
}

0 comments on commit 470387a

Please sign in to comment.