2024-02-07 07:13:53 +00:00
|
|
|
using System;
|
2024-02-06 22:21:01 +00:00
|
|
|
using System.Numerics;
|
|
|
|
using Dalamud.Interface.Windowing;
|
|
|
|
using ImGuiNET;
|
|
|
|
|
|
|
|
namespace SamplePlugin.Windows;
|
|
|
|
|
|
|
|
public class ConfigWindow : Window, IDisposable
|
|
|
|
{
|
|
|
|
private Configuration Configuration;
|
|
|
|
|
2024-02-07 07:13:53 +00:00
|
|
|
public ConfigWindow(Plugin plugin)
|
|
|
|
: base(
|
|
|
|
"A Wonderful Configuration Window",
|
|
|
|
ImGuiWindowFlags.NoResize
|
|
|
|
| ImGuiWindowFlags.NoCollapse
|
|
|
|
| ImGuiWindowFlags.NoScrollbar
|
|
|
|
| ImGuiWindowFlags.NoScrollWithMouse
|
|
|
|
)
|
2024-02-06 22:21:01 +00:00
|
|
|
{
|
|
|
|
this.Size = new Vector2(232, 75);
|
|
|
|
this.SizeCondition = ImGuiCond.Always;
|
|
|
|
|
2024-02-07 07:13:53 +00:00
|
|
|
this.Configuration = plugin.configuration;
|
2024-02-06 22:21:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void Dispose() { }
|
|
|
|
|
|
|
|
public override void Draw()
|
|
|
|
{
|
|
|
|
// can't ref a property, so use a local copy
|
|
|
|
var configValue = this.Configuration.SomePropertyToBeSavedAndWithADefault;
|
|
|
|
if (ImGui.Checkbox("Random Config Bool", ref configValue))
|
|
|
|
{
|
|
|
|
this.Configuration.SomePropertyToBeSavedAndWithADefault = configValue;
|
|
|
|
// can save immediately on change, if you don't want to provide a "Save and Close" button
|
|
|
|
this.Configuration.Save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|