diff --git a/RotationSolver.Basic/Data/IconSet.cs b/RotationSolver.Basic/Data/IconSet.cs
index d7e978b0c..f70786c61 100644
--- a/RotationSolver.Basic/Data/IconSet.cs
+++ b/RotationSolver.Basic/Data/IconSet.cs
@@ -124,10 +124,11 @@ public static bool GetTexture(uint id, out IDalamudTextureWrap texture, uint @de
///
///
///
+ ///
///
- public static bool GetTexture(string path, out IDalamudTextureWrap texture)
+ public static bool GetTexture(string path, out IDalamudTextureWrap texture, bool loadingIcon = false)
=> ThreadLoadImageHandler.TryGetTextureWrap(path, out texture)
- || ThreadLoadImageHandler.TryGetTextureWrap("ui/uld/image2.tex", out texture)
+ || loadingIcon && ThreadLoadImageHandler.TryGetTextureWrap("ui/uld/image2.tex", out texture)
|| ThreadLoadImageHandler.TryGetIconTextureWrap(0, false, out texture); // loading pics.
private static readonly Dictionary _actionIcons = new();
diff --git a/RotationSolver.Basic/DataCenter.cs b/RotationSolver.Basic/DataCenter.cs
index 36c45371f..c890a33e9 100644
--- a/RotationSolver.Basic/DataCenter.cs
+++ b/RotationSolver.Basic/DataCenter.cs
@@ -14,6 +14,9 @@ namespace RotationSolver.Basic;
internal static class DataCenter
{
+ ///
+ /// This one never be null.
+ ///
public static MajorConditionSet RightSet
{
get
@@ -30,11 +33,11 @@ public static MajorConditionSet RightSet
Service.Config.SetValue(PluginConfigInt.ActionSequencerIndex, index);
}
- return ConditionSets.ElementAt(index);
+ return ConditionSets[index];
}
}
- internal static IEnumerable ConditionSets { get; set; } = Array.Empty();
+ internal static MajorConditionSet[] ConditionSets { get; set; } = Array.Empty();
///
/// Only recorded 15s hps.
diff --git a/RotationSolver/Localization/Localization.json b/RotationSolver/Localization/Localization.json
index 6ba67eb08..0cc1c0c02 100644
--- a/RotationSolver/Localization/Localization.json
+++ b/RotationSolver/Localization/Localization.json
@@ -560,5 +560,6 @@
"ConfigWindow_Auto_MoveBackConditionSet": "Move Back Forced Condition",
"ConfigWindow_Auto_AntiKnockbackConditionSet": "Anti Knockback Forced Condition",
"ConfigWindow_Auto_BurstConditionSet": "Burst Forced Condition",
- "ConfigWindow_Auto_SpeedConditionSet": "Speed Forced Condition"
+ "ConfigWindow_Auto_SpeedConditionSet": "Speed Forced Condition",
+ "ConfigWindow_ConditionSetDesc": "The Condition set you chose, click to modify."
}
\ No newline at end of file
diff --git a/RotationSolver/Localization/Strings.cs b/RotationSolver/Localization/Strings.cs
index 5caaf61ee..1d18d556c 100644
--- a/RotationSolver/Localization/Strings.cs
+++ b/RotationSolver/Localization/Strings.cs
@@ -783,5 +783,6 @@ internal class Strings
public string ConfigWindow_Auto_AntiKnockbackConditionSet { get; set; } = "Anti Knockback Forced Condition";
public string ConfigWindow_Auto_BurstConditionSet { get; set; } = "Burst Forced Condition";
public string ConfigWindow_Auto_SpeedConditionSet { get; set; } = "Speed Forced Condition";
+ public string ConfigWindow_ConditionSetDesc { get; set; } = "The Condition set you chose, click to modify.";
}
\ No newline at end of file
diff --git a/RotationSolver/UI/ConditionDrawer.cs b/RotationSolver/UI/ConditionDrawer.cs
index 90f8fd8e4..9c4297a71 100644
--- a/RotationSolver/UI/ConditionDrawer.cs
+++ b/RotationSolver/UI/ConditionDrawer.cs
@@ -27,14 +27,14 @@ internal static void DrawCondition(bool? tag)
if (!tag.HasValue)
{
- if (IconSet.GetTexture("ui/uld/image2.tex", out var texture) || IconSet.GetTexture(0u, out texture))
+ if (IconSet.GetTexture("ui/uld/image2.tex", out var texture, true) || IconSet.GetTexture(0u, out texture))
{
ImGui.Image(texture.ImGuiHandle, Vector2.One * size);
}
}
else
{
- if (IconSet.GetTexture("ui/uld/readycheck_hr1.tex", out var texture))
+ if (IconSet.GetTexture("ui/uld/readycheck_hr1.tex", out var texture, true))
{
ImGui.Image(texture.ImGuiHandle, Vector2.One * size,
new Vector2(tag.Value ? 0 : 0.5f, 0),
diff --git a/RotationSolver/UI/RotationConfigWindow.cs b/RotationSolver/UI/RotationConfigWindow.cs
index 200f67b7d..9c29c5b2f 100644
--- a/RotationSolver/UI/RotationConfigWindow.cs
+++ b/RotationSolver/UI/RotationConfigWindow.cs
@@ -113,6 +113,70 @@ public override void Draw()
}
}
+ private void DrawConditionSet()
+ {
+ var set = DataCenter.RightSet;
+
+ const string popUpId = "Right Set Popup";
+ if (ImGui.Selectable(set.Name, false, ImGuiSelectableFlags.None, new Vector2(0, 20)))
+ {
+ ImGui.OpenPopup(popUpId);
+ }
+ ImguiTooltips.HoveredTooltip(LocalizationManager.RightLang.ConfigWindow_ConditionSetDesc);
+
+ using (var popup = ImRaii.Popup(popUpId))
+ {
+ if (popup.Success)
+ {
+ var combos = DataCenter.ConditionSets;
+ for (int i = 0; i < combos.Length; i++)
+ {
+ void DeleteFile()
+ {
+ ActionSequencerUpdater.Delete(combos[i].Name);
+ }
+
+ if (combos[i].Name == set.Name)
+ {
+ ImGuiHelper.SetNextWidthWithName(set.Name);
+ ImGui.InputText("##MajorConditionSet", ref set.Name, 100);
+ }
+ else
+ {
+ var key = "Condition Set At " + i.ToString();
+ ImGuiHelper.DrawHotKeysPopup(key, string.Empty, (LocalizationManager.RightLang.ConfigWindow_List_Remove, DeleteFile, new string[] { "Delete" }));
+
+
+ if (ImGui.Selectable(combos[i].Name))
+ {
+ Service.Config.SetValue(PluginConfigInt.ActionSequencerIndex, i);
+ }
+
+ ImGuiHelper.ExecuteHotKeysPopup(key, string.Empty, string.Empty, false,
+ (DeleteFile, new Dalamud.Game.ClientState.Keys.VirtualKey[] { Dalamud.Game.ClientState.Keys.VirtualKey.DELETE }));
+ }
+ }
+
+ ImGui.PushFont(UiBuilder.IconFont);
+
+ ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.HealerGreen);
+ if (ImGui.Selectable(FontAwesomeIcon.Plus.ToIconString()))
+ {
+ ActionSequencerUpdater.AddNew();
+ }
+ ImGui.PopStyleColor();
+
+ if (ImGui.Selectable(FontAwesomeIcon.FileDownload.ToIconString()))
+ {
+ ActionSequencerUpdater.LoadFiles();
+ }
+
+ ImGui.PopFont();
+ ImguiTooltips.HoveredTooltip(LocalizationManager.RightLang.ActionSequencer_Load);
+ }
+ }
+ }
+
private void DrawSideBar()
{
using var child = ImRaii.Child("Rotation Solver Side bar", -Vector2.One, false, ImGuiWindowFlags.NoScrollbar);
@@ -130,6 +194,11 @@ private void DrawSideBar()
if (wholeWidth > JOB_ICON_WIDTH * Scale)
{
+ DrawConditionSet();
+
+ ImGui.Separator();
+ ImGui.Spacing();
+
ImGui.SetNextItemWidth(wholeWidth);
SearchingBox();
@@ -1307,7 +1376,7 @@ private static unsafe void DrawActions()
ImGui.Separator();
}
- ActionSequencerUpdater.DrawHeader(30 * Scale);
+ ImGui.TextWrapped(LocalizationManager.RightLang.ConfigWindow_Actions_ConditionDescription);
_sequencerList?.Draw();
}
}
diff --git a/RotationSolver/Updaters/ActionSequencerUpdater.cs b/RotationSolver/Updaters/ActionSequencerUpdater.cs
index e77eeebbc..86e009ee1 100644
--- a/RotationSolver/Updaters/ActionSequencerUpdater.cs
+++ b/RotationSolver/Updaters/ActionSequencerUpdater.cs
@@ -1,9 +1,4 @@
-using Dalamud.Interface.Colors;
-using ECommons.ImGuiMethods;
-using RotationSolver.Basic.Configuration;
-using RotationSolver.Basic.Configuration.Conditions;
-using RotationSolver.Localization;
-using RotationSolver.UI;
+using RotationSolver.Basic.Configuration.Conditions;
namespace RotationSolver.Updaters;
@@ -11,9 +6,6 @@ internal class ActionSequencerUpdater
{
static string _actionSequencerFolder;
-
- public static string[] ConditionSetsName => DataCenter.ConditionSets?.Select(s => s.Name).ToArray() ?? Array.Empty();
-
public static void UpdateActionSequencerAction()
{
if (DataCenter.ConditionSets == null) return;
@@ -82,77 +74,17 @@ public static void LoadFiles()
DataCenter.ConditionSets = MajorConditionSet.Read(_actionSequencerFolder);
}
- private static void AddNew()
+ public static void AddNew()
{
if (!DataCenter.ConditionSets.Any(c => c.IsUnnamed))
{
- DataCenter.ConditionSets = DataCenter.ConditionSets.Append(new MajorConditionSet());
+ DataCenter.ConditionSets = DataCenter.ConditionSets.Append(new MajorConditionSet()).ToArray();
}
}
- private static void Delete(string name)
+ public static void Delete(string name)
{
- DataCenter.ConditionSets = DataCenter.ConditionSets.Where(c => c.Name != name);
+ DataCenter.ConditionSets = DataCenter.ConditionSets.Where(c => c.Name != name).ToArray();
File.Delete(_actionSequencerFolder + $"\\{name}.json");
}
-
- public static void DrawHeader(float width)
- {
- var set = DataCenter.RightSet;
- bool hasSet = set != null;
-
- if (hasSet)
- {
- ImGuiHelper.SetNextWidthWithName(set.Name);
- ImGui.InputText("##MajorConditionSet", ref set.Name, 100);
-
- ImGui.SameLine();
- }
-
- var combos = ConditionSetsName;
- ImGui.SetNextItemWidth(width);
-
- if(ImGui.BeginCombo("##MajorConditionCombo", ""))
- {
- for (int i = 0; i < combos.Length; i++)
- {
- void DeleteFile()
- {
- Delete(combos[i]);
- }
-
- var key = "Condition Set At " + i.ToString();
-
- ImGuiHelper.DrawHotKeysPopup(key, string.Empty, (LocalizationManager.RightLang.ConfigWindow_List_Remove, DeleteFile, new string[] { "Delete" }));
-
-
- if (ImGui.Selectable(combos[i]))
- {
- Service.Config.SetValue(PluginConfigInt.ActionSequencerIndex, i);
- }
-
- ImGuiHelper.ExecuteHotKeysPopup(key, string.Empty, string.Empty, false,
- (DeleteFile, new Dalamud.Game.ClientState.Keys.VirtualKey[] { Dalamud.Game.ClientState.Keys.VirtualKey.DELETE }));
- }
-
- ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.HealerGreen);
- ImGui.PushFont(UiBuilder.IconFont);
- if (ImGui.Selectable(FontAwesomeIcon.Plus.ToIconString()))
- {
- AddNew();
- }
- ImGui.PopFont();
- ImGui.PopStyleColor();
- ImGui.EndCombo();
- }
-
- ImGui.SameLine();
- if (ImGuiEx.IconButton(FontAwesomeIcon.FileDownload, "##LoadTheConditions"))
- {
- LoadFiles();
- }
- ImguiTooltips.HoveredTooltip(LocalizationManager.RightLang.ActionSequencer_Load);
-
- ImGui.TextWrapped(LocalizationManager.RightLang.ConfigWindow_Actions_ConditionDescription);
- }
}