Glamaholic/Glamaholic/Ui/Helpers/EditorHelper.cs

38 lines
1.2 KiB
C#
Raw Normal View History

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; }
private string _plateName = string.Empty;
2021-11-19 17:55:07 +00:00
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
2021-11-23 18:41:58 +00:00
if (addon == null || !addon->IsVisible) {
2021-11-19 17:55:07 +00:00
return;
}
2021-11-23 18:41:58 +00:00
HelperUtil.DrawHelper(addon, "glamaholic-editor-helper", false, this.DrawDropdown);
}
2021-11-19 17:55:07 +00:00
2021-11-23 18:41:58 +00:00
private void DrawDropdown() {
if (ImGui.Selectable($"Open {this.Ui.Plugin.Name}")) {
this.Ui.OpenMainInterface();
2021-11-19 17:55:07 +00:00
}
if (HelperUtil.DrawCreatePlateMenu(this.Ui, () => GameFunctions.CurrentPlate, ref this._plateName)) {
this._plateName = string.Empty;
}
2021-11-19 17:55:07 +00:00
}
}
}