2021-11-23 17:54:44 +00:00
|
|
|
|
using FFXIVClientStructs.FFXIV.Component.GUI;
|
2021-11-19 17:55:07 +00:00
|
|
|
|
using ImGuiNET;
|
|
|
|
|
|
|
|
|
|
namespace Glamaholic.Ui.Helpers {
|
|
|
|
|
internal class EditorHelper {
|
|
|
|
|
private PluginUi Ui { get; }
|
|
|
|
|
|
|
|
|
|
internal EditorHelper(PluginUi ui) {
|
|
|
|
|
this.Ui = ui;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal unsafe void Draw() {
|
|
|
|
|
if (!this.Ui.Plugin.Config.ShowEditorMenu || !Util.IsEditingPlate(this.Ui.Plugin.GameGui)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var addon = (AtkUnitBase*) this.Ui.Plugin.GameGui.GetAddonByName(Util.PlateAddon, 1);
|
|
|
|
|
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
|
|
|
|
if (addon != null && addon->IsVisible) {
|
|
|
|
|
this.DrawInner(addon);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private unsafe void DrawInner(AtkUnitBase* addon) {
|
|
|
|
|
var drawPos = HelperUtil.DrawPosForAddon(addon);
|
|
|
|
|
if (drawPos == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 17:54:44 +00:00
|
|
|
|
using (new HelperUtil.HelperStyles()) {
|
|
|
|
|
ImGui.SetNextWindowPos(drawPos.Value, ImGuiCond.Appearing);
|
|
|
|
|
if (!ImGui.Begin("##glamaholic-helper-open", HelperUtil.HelperWindowFlags)) {
|
|
|
|
|
ImGui.End();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2021-11-19 17:55:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 17:54:44 +00:00
|
|
|
|
ImGui.SetNextItemWidth(HelperUtil.DropdownWidth());
|
2021-11-19 17:55:07 +00:00
|
|
|
|
if (ImGui.BeginCombo("##glamaholic-helper-examine-combo", this.Ui.Plugin.Name)) {
|
|
|
|
|
if (ImGui.Selectable($"Open {this.Ui.Plugin.Name}")) {
|
|
|
|
|
this.Ui.OpenMainInterface();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ImGui.EndCombo();
|
|
|
|
|
}
|
2021-11-23 17:54:44 +00:00
|
|
|
|
|
|
|
|
|
ImGui.SetNextWindowPos(drawPos.Value);
|
2021-11-19 17:55:07 +00:00
|
|
|
|
|
|
|
|
|
ImGui.End();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|