we are free of linting errors
parent
9abcc3bf0f
commit
ccaf9e11ca
|
@ -1,12 +1,11 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using CommandReference.Windows;
|
||||
using Dalamud.Game.Command;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Dalamud.Utility;
|
||||
using CommandReference.Windows;
|
||||
|
||||
namespace CommandReference
|
||||
{
|
||||
|
@ -72,7 +71,7 @@ namespace CommandReference
|
|||
{
|
||||
windowSystem.RemoveAllWindows();
|
||||
|
||||
ConfigWindow.Dispose();
|
||||
((IDisposable)ConfigWindow).Dispose();
|
||||
MainWindow.Dispose();
|
||||
|
||||
_ = commandManager.RemoveHandler(CommandName);
|
||||
|
|
|
@ -3,38 +3,42 @@ using System.Numerics;
|
|||
using Dalamud.Interface.Windowing;
|
||||
using ImGuiNET;
|
||||
|
||||
namespace CommandReference.Windows;
|
||||
|
||||
public class ConfigWindow : Window, IDisposable
|
||||
namespace CommandReference.Windows
|
||||
{
|
||||
private Configuration Configuration;
|
||||
|
||||
public ConfigWindow(Plugin plugin)
|
||||
: base(
|
||||
"A Wonderful Configuration Window",
|
||||
ImGuiWindowFlags.NoResize
|
||||
| ImGuiWindowFlags.NoCollapse
|
||||
| ImGuiWindowFlags.NoScrollbar
|
||||
| ImGuiWindowFlags.NoScrollWithMouse
|
||||
)
|
||||
public class ConfigWindow : Window, IDisposable
|
||||
{
|
||||
this.Size = new Vector2(232, 75);
|
||||
this.SizeCondition = ImGuiCond.Always;
|
||||
private readonly Configuration configuration;
|
||||
|
||||
this.Configuration = plugin.configuration;
|
||||
}
|
||||
|
||||
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))
|
||||
public ConfigWindow(Plugin plugin)
|
||||
: base(
|
||||
"A Wonderful Configuration Window",
|
||||
ImGuiWindowFlags.NoResize
|
||||
| ImGuiWindowFlags.NoCollapse
|
||||
| ImGuiWindowFlags.NoScrollbar
|
||||
| ImGuiWindowFlags.NoScrollWithMouse
|
||||
)
|
||||
{
|
||||
this.Configuration.SomePropertyToBeSavedAndWithADefault = configValue;
|
||||
// can save immediately on change, if you don't want to provide a "Save and Close" button
|
||||
this.Configuration.Save();
|
||||
Size = new Vector2(232, 75);
|
||||
SizeCondition = ImGuiCond.Always;
|
||||
|
||||
configuration = plugin.configuration;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
public override void Draw()
|
||||
{
|
||||
// can't ref a property, so use a local copy
|
||||
var configValue = configuration.SomePropertyToBeSavedAndWithADefault;
|
||||
if (ImGui.Checkbox("Random Config Bool", ref configValue))
|
||||
{
|
||||
configuration.SomePropertyToBeSavedAndWithADefault = configValue;
|
||||
// can save immediately on change, if you don't want to provide a "Save and Close" button
|
||||
configuration.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,53 +4,52 @@ using Dalamud.Interface.Internal;
|
|||
using Dalamud.Interface.Windowing;
|
||||
using ImGuiNET;
|
||||
|
||||
namespace CommandReference.Windows;
|
||||
|
||||
public class MainWindow : Window, IDisposable
|
||||
namespace CommandReference.Windows
|
||||
{
|
||||
private IDalamudTextureWrap GoatImage;
|
||||
private Plugin Plugin;
|
||||
|
||||
public MainWindow(Plugin plugin, IDalamudTextureWrap goatImage)
|
||||
: base(
|
||||
"My Amazing Window",
|
||||
ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse
|
||||
)
|
||||
public class MainWindow : Window, IDisposable
|
||||
{
|
||||
this.SizeConstraints = new WindowSizeConstraints
|
||||
private readonly IDalamudTextureWrap goatImage;
|
||||
private readonly Plugin plugin;
|
||||
|
||||
public MainWindow(Plugin plugin, IDalamudTextureWrap goatImage)
|
||||
: base(
|
||||
"My Amazing Window",
|
||||
ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse
|
||||
)
|
||||
{
|
||||
MinimumSize = new Vector2(375, 330),
|
||||
MaximumSize = new Vector2(float.MaxValue, float.MaxValue)
|
||||
};
|
||||
SizeConstraints = new WindowSizeConstraints
|
||||
{
|
||||
MinimumSize = new Vector2(375, 330),
|
||||
MaximumSize = new Vector2(float.MaxValue, float.MaxValue)
|
||||
};
|
||||
|
||||
this.GoatImage = goatImage;
|
||||
this.Plugin = plugin;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
this.GoatImage.Dispose();
|
||||
}
|
||||
|
||||
public override void Draw()
|
||||
{
|
||||
ImGui.Text(
|
||||
$"The random config bool is {this.Plugin.configuration.SomePropertyToBeSavedAndWithADefault}"
|
||||
);
|
||||
|
||||
if (ImGui.Button("Show Settings"))
|
||||
{
|
||||
this.Plugin.DrawConfigUI();
|
||||
this.goatImage = goatImage;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
ImGui.Spacing();
|
||||
public void Dispose()
|
||||
{
|
||||
goatImage.Dispose();
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
ImGui.Text("Have a goat:");
|
||||
ImGui.Indent(55);
|
||||
ImGui.Image(
|
||||
this.GoatImage.ImGuiHandle,
|
||||
new Vector2(this.GoatImage.Width, this.GoatImage.Height)
|
||||
);
|
||||
ImGui.Unindent(55);
|
||||
public override void Draw()
|
||||
{
|
||||
ImGui.Text(
|
||||
$"The random config bool is {plugin.configuration.SomePropertyToBeSavedAndWithADefault}"
|
||||
);
|
||||
|
||||
if (ImGui.Button("Show Settings"))
|
||||
{
|
||||
plugin.DrawConfigUI();
|
||||
}
|
||||
|
||||
ImGui.Spacing();
|
||||
|
||||
ImGui.Text("Have a goat:");
|
||||
ImGui.Indent(55);
|
||||
ImGui.Image(goatImage.ImGuiHandle, new Vector2(goatImage.Width, goatImage.Height));
|
||||
ImGui.Unindent(55);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue