DP-VoidBox/VoidBox/PluginUI.cs

47 lines
1006 B
C#
Raw Permalink Normal View History

2024-03-02 01:31:18 +01:00
using VoidBox.Windows;
using Dalamud.Interface.Windowing;
using System;
namespace VoidBox;
public sealed class PluginUI : IDisposable
{
private ConfigWindow _configWindow;
internal PluginUI()
{
Service.PluginInterface.UiBuilder.Draw += Draw;
Service.PluginInterface.UiBuilder.OpenConfigUi += ShowConfigWindow;
WindowSystem.AddWindow(_configWindow = new ConfigWindow());
}
public WindowSystem WindowSystem { get; } = new("VoidBox");
public bool SettingsVisible
{
get => _configWindow.IsOpen;
set => _configWindow.IsOpen = value;
2024-03-02 01:31:18 +01:00
}
public void Dispose()
{
WindowSystem.RemoveAllWindows();
_configWindow.Dispose();
Service.PluginInterface.UiBuilder.Draw -= Draw;
Service.PluginInterface.UiBuilder.OpenConfigUi -= ShowConfigWindow;
}
public void Draw()
{
WindowSystem.Draw();
}
private void ShowConfigWindow()
{
SettingsVisible = true;
}
}