88 lines
2.3 KiB
C#
88 lines
2.3 KiB
C#
using System.Collections.Generic;
|
|
using Dalamud.Bindings.ImGui;
|
|
using Dalamud.Game.Text;
|
|
using Dalamud.Interface;
|
|
using Dalamud.Interface.Colors;
|
|
using Dalamud.Interface.Utility.Raii;
|
|
using Dalamud.Plugin;
|
|
|
|
namespace Questionable.Windows.ConfigComponents;
|
|
|
|
internal abstract class ConfigComponent
|
|
{
|
|
protected const string DutyClipboardSeparator = ";";
|
|
|
|
protected const string DutyWhitelistPrefix = "+";
|
|
|
|
protected const string DutyBlacklistPrefix = "-";
|
|
|
|
protected readonly string[] SupportedCfcOptions = new string[3]
|
|
{
|
|
$"{SeIconChar.Circle.ToIconChar()} Enabled (Default)",
|
|
$"{SeIconChar.Circle.ToIconChar()} Enabled",
|
|
$"{SeIconChar.Cross.ToIconChar()} Disabled"
|
|
};
|
|
|
|
protected readonly string[] UnsupportedCfcOptions = new string[3]
|
|
{
|
|
$"{SeIconChar.Cross.ToIconChar()} Disabled (Default)",
|
|
$"{SeIconChar.Circle.ToIconChar()} Enabled",
|
|
$"{SeIconChar.Cross.ToIconChar()} Disabled"
|
|
};
|
|
|
|
private readonly IDalamudPluginInterface _pluginInterface;
|
|
|
|
protected Configuration Configuration { get; }
|
|
|
|
protected ConfigComponent(IDalamudPluginInterface pluginInterface, Configuration configuration)
|
|
{
|
|
_pluginInterface = pluginInterface;
|
|
Configuration = configuration;
|
|
}
|
|
|
|
public abstract void DrawTab();
|
|
|
|
protected void Save()
|
|
{
|
|
_pluginInterface.SavePluginConfig(Configuration);
|
|
}
|
|
|
|
protected static string FormatLevel(int level, bool includePrefix = true)
|
|
{
|
|
if (level == 0)
|
|
{
|
|
return string.Empty;
|
|
}
|
|
return $"{(includePrefix ? SeIconChar.LevelEn.ToIconString() : string.Empty)}{FormatLevel(level / 10, includePrefix: false)}{((SeIconChar)(57440 + level % 10)).ToIconChar()}";
|
|
}
|
|
|
|
protected static void DrawNotes(bool enabledByDefault, IEnumerable<string> notes)
|
|
{
|
|
using ImRaii.Color color = new ImRaii.Color();
|
|
color.Push(ImGuiCol.TextDisabled, (!enabledByDefault) ? ImGuiColors.DalamudYellow : ImGuiColors.ParsedBlue);
|
|
ImGui.SameLine();
|
|
using (ImRaii.PushFont(UiBuilder.IconFont))
|
|
{
|
|
if (!enabledByDefault)
|
|
{
|
|
ImGui.TextDisabled(FontAwesomeIcon.ExclamationTriangle.ToIconString());
|
|
}
|
|
else
|
|
{
|
|
ImGui.TextDisabled(FontAwesomeIcon.InfoCircle.ToIconString());
|
|
}
|
|
}
|
|
if (!ImGui.IsItemHovered())
|
|
{
|
|
return;
|
|
}
|
|
using (ImRaii.Tooltip())
|
|
{
|
|
ImGui.TextColored(ImGuiColors.DalamudYellow, "While testing, the following issues have been found:");
|
|
foreach (string note in notes)
|
|
{
|
|
ImGui.BulletText(note);
|
|
}
|
|
}
|
|
}
|
|
}
|