forked from CasualSuperman/OopsAllLalafells
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PluginUI.cs
90 lines (74 loc) · 3.34 KB
/
PluginUI.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
80
81
82
83
84
85
86
87
88
89
90
using ImGuiNET;
using System;
using System.Numerics;
using Dalamud.Game.Text;
namespace OopsAllLalafells
{
public class PluginUI
{
private static Vector4 WHAT_THE_HELL_ARE_YOU_DOING = new Vector4(1, 0, 0, 1);
private readonly Plugin plugin;
private bool enableExperimental;
public PluginUI(Plugin plugin)
{
this.plugin = plugin;
}
public void Draw()
{
if (!this.plugin.SettingsVisible)
{
return;
}
bool settingsVisible = this.plugin.SettingsVisible;
if (ImGui.Begin("Oops, All Lalafells!", ref settingsVisible, ImGuiWindowFlags.AlwaysAutoResize))
{
bool shouldChangeOthers = this.plugin.config.ShouldChangeOthers;
ImGui.Checkbox("Change other players", ref shouldChangeOthers);
if (enableExperimental)
{
Race othersTargetRace = this.plugin.config.ChangeOthersTargetRace;
if (shouldChangeOthers)
{
if (ImGui.BeginCombo("Race", othersTargetRace.GetAttribute<Display>().Value))
{
foreach (Race race in Enum.GetValues(typeof(Race)))
{
ImGui.PushID((byte) race);
if (ImGui.Selectable(race.GetAttribute<Display>().Value, race == othersTargetRace))
{
othersTargetRace = race;
}
if (race == othersTargetRace)
{
ImGui.SetItemDefaultFocus();
}
ImGui.PopID();
}
ImGui.EndCombo();
}
}
this.plugin.UpdateOtherRace(othersTargetRace);
}
else
{
this.plugin.UpdateOtherRace(Race.LALAFELL);
}
this.plugin.ToggleOtherRace(shouldChangeOthers);
ImGui.Separator();
ImGui.Checkbox("Enable Experimental Features", ref this.enableExperimental);
if (enableExperimental)
{
ImGui.Text("Experimental feature configuration will (intentionally) not persist,\n" +
"so you will need to open this settings menu to re-activate\n" +
"them if you disable the plugin or restart your game.");
ImGui.TextColored(WHAT_THE_HELL_ARE_YOU_DOING,
"Experimental features may crash your game, uncat your boy,\nor cause the Eighth Umbral Calamity. YOU HAVE BEEN WARNED!");
ImGui.Text("But seriously, if you do encounter any crashes, please report\nthem to Avaflow#0001 on Discord with whatever details you can get.");
}
ImGui.End();
}
this.plugin.SettingsVisible = settingsVisible;
this.plugin.SaveConfig();
}
}
}