55 lines
1.7 KiB
C#
Executable File
55 lines
1.7 KiB
C#
Executable File
using System;
|
|
using ImGuiNET;
|
|
|
|
namespace NominaOcculta {
|
|
internal class PluginUi : IDisposable {
|
|
private Plugin Plugin { get; }
|
|
|
|
internal bool Visible;
|
|
|
|
internal PluginUi(Plugin plugin) {
|
|
this.Plugin = plugin;
|
|
|
|
this.Plugin.Interface.UiBuilder.Draw += this.Draw;
|
|
}
|
|
|
|
public void Dispose() {
|
|
this.Plugin.Interface.UiBuilder.Draw -= this.Draw;
|
|
}
|
|
|
|
private void Draw() {
|
|
if (!this.Visible) {
|
|
return;
|
|
}
|
|
|
|
if (!ImGui.Begin(this.Plugin.Name, ref this.Visible)) {
|
|
ImGui.End();
|
|
return;
|
|
}
|
|
|
|
var anyChanged = ImGui.Checkbox("Enabled", ref this.Plugin.Config.Enabled);
|
|
ImGui.Separator();
|
|
anyChanged |= ImGui.Checkbox("Obscure self (full name)", ref this.Plugin.Config.SelfFull);
|
|
ImGui.TreePush();
|
|
anyChanged |= ImGui.Checkbox("First name", ref this.Plugin.Config.SelfFirst);
|
|
anyChanged |= ImGui.Checkbox("Last name", ref this.Plugin.Config.SelfLast);
|
|
ImGui.TreePop();
|
|
anyChanged |= ImGui.Checkbox("Obscure party members", ref this.Plugin.Config.Party);
|
|
anyChanged |= ImGui.Checkbox("Obscure others", ref this.Plugin.Config.Others);
|
|
anyChanged |= ImGui.Checkbox("Exclude friends", ref this.Plugin.Config.ExcludeFriends);
|
|
|
|
if (anyChanged) {
|
|
this.Plugin.SaveConfig();
|
|
}
|
|
|
|
ImGui.Separator();
|
|
|
|
if (ImGui.Button("Reset names")) {
|
|
this.Plugin.NameRepository.Reset();
|
|
}
|
|
|
|
ImGui.End();
|
|
}
|
|
}
|
|
}
|