2024-02-14 00:05:07 +01:00
|
|
|
|
using CustomResolution.Windows;
|
|
|
|
|
using Dalamud.Interface.Windowing;
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace CustomResolution;
|
|
|
|
|
|
|
|
|
|
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("CustomResolution");
|
|
|
|
|
|
|
|
|
|
public bool SettingsVisible
|
|
|
|
|
{
|
|
|
|
|
get => _configWindow.IsOpen;
|
2024-02-18 22:48:02 +01:00
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_configWindow.IsOpen = value;
|
|
|
|
|
_configWindow.UpdateFromConfig();
|
|
|
|
|
}
|
2024-02-14 00:05:07 +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()
|
|
|
|
|
{
|
2024-02-15 01:41:20 +01:00
|
|
|
|
SettingsVisible = true;
|
2024-02-14 00:05:07 +01:00
|
|
|
|
}
|
|
|
|
|
}
|