we are free of linting errors
This commit is contained in:
parent
9abcc3bf0f
commit
ccaf9e11ca
3 changed files with 74 additions and 72 deletions
|
@ -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,11 +3,11 @@ 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
|
||||||
|
{
|
||||||
|
private readonly Configuration configuration;
|
||||||
|
|
||||||
public ConfigWindow(Plugin plugin)
|
public ConfigWindow(Plugin plugin)
|
||||||
: base(
|
: base(
|
||||||
|
@ -18,23 +18,27 @@ public class ConfigWindow : Window, IDisposable
|
||||||
| ImGuiWindowFlags.NoScrollWithMouse
|
| ImGuiWindowFlags.NoScrollWithMouse
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.Size = new Vector2(232, 75);
|
Size = new Vector2(232, 75);
|
||||||
this.SizeCondition = ImGuiCond.Always;
|
SizeCondition = ImGuiCond.Always;
|
||||||
|
|
||||||
this.Configuration = plugin.configuration;
|
configuration = plugin.configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose() { }
|
public void Dispose()
|
||||||
|
{
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
|
|
||||||
public override void Draw()
|
public override void Draw()
|
||||||
{
|
{
|
||||||
// can't ref a property, so use a local copy
|
// can't ref a property, so use a local copy
|
||||||
var configValue = this.Configuration.SomePropertyToBeSavedAndWithADefault;
|
var configValue = configuration.SomePropertyToBeSavedAndWithADefault;
|
||||||
if (ImGui.Checkbox("Random Config Bool", ref configValue))
|
if (ImGui.Checkbox("Random Config Bool", ref configValue))
|
||||||
{
|
{
|
||||||
this.Configuration.SomePropertyToBeSavedAndWithADefault = configValue;
|
configuration.SomePropertyToBeSavedAndWithADefault = configValue;
|
||||||
// can save immediately on change, if you don't want to provide a "Save and Close" button
|
// can save immediately on change, if you don't want to provide a "Save and Close" button
|
||||||
this.Configuration.Save();
|
configuration.Save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,12 +4,12 @@ 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;
|
{
|
||||||
|
private readonly IDalamudTextureWrap goatImage;
|
||||||
|
private readonly Plugin plugin;
|
||||||
|
|
||||||
public MainWindow(Plugin plugin, IDalamudTextureWrap goatImage)
|
public MainWindow(Plugin plugin, IDalamudTextureWrap goatImage)
|
||||||
: base(
|
: base(
|
||||||
|
@ -17,40 +17,39 @@ public class MainWindow : Window, IDisposable
|
||||||
ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse
|
ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.SizeConstraints = new WindowSizeConstraints
|
SizeConstraints = new WindowSizeConstraints
|
||||||
{
|
{
|
||||||
MinimumSize = new Vector2(375, 330),
|
MinimumSize = new Vector2(375, 330),
|
||||||
MaximumSize = new Vector2(float.MaxValue, float.MaxValue)
|
MaximumSize = new Vector2(float.MaxValue, float.MaxValue)
|
||||||
};
|
};
|
||||||
|
|
||||||
this.GoatImage = goatImage;
|
this.goatImage = goatImage;
|
||||||
this.Plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
this.GoatImage.Dispose();
|
goatImage.Dispose();
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Draw()
|
public override void Draw()
|
||||||
{
|
{
|
||||||
ImGui.Text(
|
ImGui.Text(
|
||||||
$"The random config bool is {this.Plugin.configuration.SomePropertyToBeSavedAndWithADefault}"
|
$"The random config bool is {plugin.configuration.SomePropertyToBeSavedAndWithADefault}"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (ImGui.Button("Show Settings"))
|
if (ImGui.Button("Show Settings"))
|
||||||
{
|
{
|
||||||
this.Plugin.DrawConfigUI();
|
plugin.DrawConfigUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.Spacing();
|
ImGui.Spacing();
|
||||||
|
|
||||||
ImGui.Text("Have a goat:");
|
ImGui.Text("Have a goat:");
|
||||||
ImGui.Indent(55);
|
ImGui.Indent(55);
|
||||||
ImGui.Image(
|
ImGui.Image(goatImage.ImGuiHandle, new Vector2(goatImage.Width, goatImage.Height));
|
||||||
this.GoatImage.ImGuiHandle,
|
|
||||||
new Vector2(this.GoatImage.Width, this.GoatImage.Height)
|
|
||||||
);
|
|
||||||
ImGui.Unindent(55);
|
ImGui.Unindent(55);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue