From 45ecef04519ee094e2e04da5e1526bf047fcb56b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E6=B0=B4?= <1123993881@qq.com> Date: Wed, 22 Feb 2023 09:07:31 +0800 Subject: [PATCH] fix: add a feature of command desc highlight when in that command. --- .../Attributes/RotationDescAttribute.cs | 47 ++++++++++++++++++- .../Windows/RotationConfigWindow_Help.cs | 2 - 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/RotationSolver/Attributes/RotationDescAttribute.cs b/RotationSolver/Attributes/RotationDescAttribute.cs index 4337e3fcc..87dd8f7f9 100644 --- a/RotationSolver/Attributes/RotationDescAttribute.cs +++ b/RotationSolver/Attributes/RotationDescAttribute.cs @@ -1,7 +1,9 @@ -using ImGuiNET; +using Dalamud.Interface.Colors; +using ImGuiNET; using Lumina.Excel.GeneratedSheets; using RotationSolver.Actions; using RotationSolver.Actions.BaseAction; +using RotationSolver.Commands; using RotationSolver.Data; using RotationSolver.Helpers; using RotationSolver.Localization; @@ -41,6 +43,45 @@ internal class RotationDescAttribute : Attribute _ => 62144, }; + private bool IsOnCommand + { + get + { + var command = RSCommands.SpecialType; + switch(Type) + { + case DescType.BurstActions: + return command == SpecialCommandType.Burst; + + case DescType.HealAreaAbility: + case DescType.HealAreaGCD: + return command == SpecialCommandType.HealArea; + + case DescType.HealSingleAbility: + case DescType.HealSingleGCD: + return command == SpecialCommandType.HealSingle; + + case DescType.DefenseAreaGCD: + case DescType.DefenceAreaAbility: + return command == SpecialCommandType.DefenseArea; + + case DescType.DefenseSingleGCD: + case DescType.DefenceSingleAbility: + return command == SpecialCommandType.DefenseSingle; + + case DescType.MoveForwardGCD: + case DescType.MoveForwardAbility: + return command == SpecialCommandType.MoveForward; + + case DescType.MoveBackAbility: + return command == SpecialCommandType.MoveBack; + + default: + return false; + } + } + } + public RotationDescAttribute(DescType descType) { Type = descType; @@ -77,7 +118,11 @@ public bool Display(ICustomRotation rotation) ImGui.Columns(2, this.GetHashCode().ToString(), false); ImGui.SetColumnWidth(0, 170); ImGui.Image(IconSet.GetTexture(IconID).ImGuiHandle, PIC_SIZE); + + var isOnCommand = IsOnCommand; + if (isOnCommand) ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudYellow); ImGui.Text(" " + Type.ToName()); + if (isOnCommand) ImGui.PopStyleColor(); ImGui.NextColumn(); diff --git a/RotationSolver/Windows/RotationConfigWindow_Help.cs b/RotationSolver/Windows/RotationConfigWindow_Help.cs index 57302af84..6eb0c94ab 100644 --- a/RotationSolver/Windows/RotationConfigWindow_Help.cs +++ b/RotationSolver/Windows/RotationConfigWindow_Help.cs @@ -87,8 +87,6 @@ private void DrawHelpTab() ImGui.Separator(); SpecialCommandType.Burst.DisplayCommandHelp(getHelp: EnumTranslations.ToHelp); - ImGui.Separator(); - ImGui.PopStyleVar(); }