-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConfigWindow.cs
79 lines (70 loc) · 2.67 KB
/
ConfigWindow.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
using Dalamud.Interface.Utility.Raii;
using Dalamud.Interface.Windowing;
using FFXIVClientStructs.FFXIV.Client.Graphics;
using ImGuiNET;
using System.Numerics;
namespace Interjection;
public class ConfigWindow : Window
{
public ConfigWindow() : base(Plugin.Name + " Configuration")
{
Size = new Vector2(369, 225);
SizeCondition = ImGuiCond.FirstUseEver;
}
private void Tooltip(string tooltip)
{
if (ImGui.IsItemHovered())
{
ImGui.SetTooltip(tooltip);
}
}
private bool ByteColorEdit(string label, ref ByteColor color, ImGuiColorEditFlags flags)
{
Vector4 v = color.ToVector4();
if (ImGui.ColorEdit4(label, ref v, flags))
{
color = v.ToByteColor();
return true;
}
return false;
}
public override void Draw()
{
bool needSave = false;
needSave |= ImGui.Checkbox("Enabled", ref Plugin.Config.Enabled);
ImGui.SameLine();
if (ImGui.Button("Reset Config to Defaults"))
{
Plugin.Config.SetToDefaults();
needSave = true;
}
using (ImRaii.Disabled(!Plugin.Config.Enabled))
{
using (ImRaii.Disabled(!Plugin.Config.OverrideNormalCastColor))
{
needSave |= ByteColorEdit("##ucastcolor", ref Plugin.Config.NormalCastColor, ImGuiColorEditFlags.NoInputs);
ImGui.SameLine();
}
needSave |= ImGui.Checkbox("Recolor Default Castbar", ref Plugin.Config.OverrideNormalCastColor);
Tooltip("Change the enemy list castbar color.");
using (ImRaii.Disabled(!Plugin.Config.OverrideInterruptableCastColor))
{
needSave |= ByteColorEdit("##icastcolor", ref Plugin.Config.InterruptableCastColor, ImGuiColorEditFlags.NoInputs);
ImGui.SameLine();
}
needSave |= ImGui.Checkbox("Recolor Interruptable Castbar", ref Plugin.Config.OverrideInterruptableCastColor);
Tooltip("Change the enemy list castbar color for interruptible spells.");
using (ImRaii.Disabled(!Plugin.Config.OverrideTankTargetEnmityGemColor))
{
needSave |= ByteColorEdit("##tankgemcolor", ref Plugin.Config.TankGemColor, ImGuiColorEditFlags.NoInputs);
ImGui.SameLine();
}
needSave |= ImGui.Checkbox("Recolor Enmity Gem for Tanks", ref Plugin.Config.OverrideTankTargetEnmityGemColor);
Tooltip("Change the enmity gem color when the enemy is targetting a tank that is not you.");
}
if (needSave)
{
Plugin.Config.Save();
}
}
}