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