42 lines
1.5 KiB
C#
42 lines
1.5 KiB
C#
using Dalamud.Interface.Windowing;
|
|
using QuestShare.Windows.ConfigWindow;
|
|
using QuestShare.Windows.MainWindow;
|
|
|
|
namespace QuestShare.Common
|
|
{
|
|
internal static class WindowManager
|
|
{
|
|
public static WindowSystem WindowSystem = new("SamplePlugin");
|
|
public static ConfigWindow ConfigWindow { get; private set; } = new();
|
|
public static MainWindow MainWindow { get; private set; } = new();
|
|
|
|
public static void Initialize()
|
|
{
|
|
WindowSystem.AddWindow(ConfigWindow);
|
|
WindowSystem.AddWindow(MainWindow);
|
|
|
|
PluginInterface.UiBuilder.Draw += DrawUI;
|
|
|
|
// This adds a button to the plugin installer entry of this plugin which allows
|
|
// to toggle the display status of the configuration ui
|
|
PluginInterface.UiBuilder.OpenConfigUi += ToggleConfigUI;
|
|
|
|
// Adds another button that is doing the same but for the main ui of the plugin
|
|
PluginInterface.UiBuilder.OpenMainUi += ToggleMainUI;
|
|
}
|
|
public static void Dispose()
|
|
{
|
|
WindowSystem.RemoveAllWindows();
|
|
PluginInterface.UiBuilder.Draw -= DrawUI;
|
|
PluginInterface.UiBuilder.OpenConfigUi -= ToggleConfigUI;
|
|
PluginInterface.UiBuilder.OpenMainUi -= ToggleMainUI;
|
|
MainWindow.Dispose();
|
|
ConfigWindow.Dispose();
|
|
}
|
|
|
|
private static void DrawUI() => WindowSystem.Draw();
|
|
public static void ToggleConfigUI() => ConfigWindow.Toggle();
|
|
public static void ToggleMainUI() => MainWindow.Toggle();
|
|
}
|
|
}
|