From 11af820e1ed15d423f839e514f14fef30a5df7b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E6=B0=B4?= <1123993881@qq.com> Date: Sun, 13 Aug 2023 23:16:37 +0800 Subject: [PATCH] fix: organized some configs. --- RotationSolver.Basic/Configuration/Configs.cs | 1 - .../Configuration/PluginConfiguration.cs | 1 - .../Rotations/CustomRotation_Ability.cs | 4 +- .../Rotations/CustomRotation_Actions.cs | 12 +- .../Localization/ConfigTranslation.cs | 1 - RotationSolver/Localization/Localization.json | 9 +- RotationSolver/Localization/Strings.cs | 9 +- RotationSolver/UI/RotationConfigWindowNew.cs | 120 +++---- .../UI/RotationConfigWindowNew_Config.cs | 337 +++++++++++------- .../UI/RotationConfigWindow_Param.cs | 103 +++--- .../UI/SearchableConfigs/AutoHealCheckBox.cs | 114 ++++++ .../UI/SearchableConfigs/CheckBoxSearch.cs | 31 +- .../UI/SearchableConfigs/ColorEditSearch.cs | 1 + .../UI/SearchableConfigs/Searchable.cs | 23 ++ 14 files changed, 488 insertions(+), 278 deletions(-) create mode 100644 RotationSolver/UI/SearchableConfigs/AutoHealCheckBox.cs diff --git a/RotationSolver.Basic/Configuration/Configs.cs b/RotationSolver.Basic/Configuration/Configs.cs index a125eca81..b506cdc74 100644 --- a/RotationSolver.Basic/Configuration/Configs.cs +++ b/RotationSolver.Basic/Configuration/Configs.cs @@ -228,7 +228,6 @@ public enum PluginConfigBool : byte [Default(false)] UseTinctures, [Default(false)] UseHealPotions, - [Default(true)] DrawPositional, [Default(true)] DrawMeleeOffset, [Default(true)] ShowMoveTarget, diff --git a/RotationSolver.Basic/Configuration/PluginConfiguration.cs b/RotationSolver.Basic/Configuration/PluginConfiguration.cs index 6fa866f2c..c47c32628 100644 --- a/RotationSolver.Basic/Configuration/PluginConfiguration.cs +++ b/RotationSolver.Basic/Configuration/PluginConfiguration.cs @@ -61,7 +61,6 @@ public class PluginConfiguration : IPluginConfiguration public bool AddEnemyListToHostile = true; public bool UseTinctures = false; public bool UseHealPotions = false; - public bool DrawPositional = true; public bool DrawMeleeOffset = true; public bool ShowMoveTarget = true; public bool ShowHealthRatio = false; diff --git a/RotationSolver.Basic/Rotations/CustomRotation_Ability.cs b/RotationSolver.Basic/Rotations/CustomRotation_Ability.cs index 4b69b4cd6..ae49736b3 100644 --- a/RotationSolver.Basic/Rotations/CustomRotation_Ability.cs +++ b/RotationSolver.Basic/Rotations/CustomRotation_Ability.cs @@ -1,6 +1,4 @@ -using RotationSolver.Basic.Configuration; - -namespace RotationSolver.Basic.Rotations; +namespace RotationSolver.Basic.Rotations; public abstract partial class CustomRotation { diff --git a/RotationSolver.Basic/Rotations/CustomRotation_Actions.cs b/RotationSolver.Basic/Rotations/CustomRotation_Actions.cs index ac9aad48b..ef9b5ca84 100644 --- a/RotationSolver.Basic/Rotations/CustomRotation_Actions.cs +++ b/RotationSolver.Basic/Rotations/CustomRotation_Actions.cs @@ -222,7 +222,8 @@ internal RoleAction(ActionID actionID, JobRole[] roles, ActionOption option = Ac /// /// public static IBaseAction VariantRaise { get; } = new RoleAction(ActionID.VariantRaise, - new JobRole[] { JobRole.Melee, JobRole.Tank, JobRole.Ranged }, ActionOption.Friendly | ActionOption.DutyAction); + new JobRole[] { JobRole.Melee, JobRole.Tank, JobRole.RangedMagical, JobRole.RangedPhysical, }, + ActionOption.Friendly | ActionOption.DutyAction); /// /// @@ -233,13 +234,14 @@ internal RoleAction(ActionID actionID, JobRole[] roles, ActionOption option = Ac /// /// public static IBaseAction VariantCure { get; } = new RoleAction(ActionID.VariantCure, - new JobRole[] { JobRole.Melee, JobRole.Tank, JobRole.Ranged }, ActionOption.Heal | ActionOption.DutyAction); + new JobRole[] { JobRole.Melee, JobRole.Tank,JobRole.RangedMagical, JobRole.RangedPhysical }, + ActionOption.Heal | ActionOption.DutyAction); /// /// /// public static IBaseAction VariantCure2 { get; } = new RoleAction(ActionID.VariantCure2, - new JobRole[] { JobRole.Melee, JobRole.Tank, JobRole.Ranged }, ActionOption.Heal | ActionOption.DutyAction); + new JobRole[] { JobRole.Melee, JobRole.Tank, JobRole.RangedMagical, JobRole.RangedPhysical }, ActionOption.Heal | ActionOption.DutyAction); /// /// @@ -263,13 +265,13 @@ internal RoleAction(ActionID actionID, JobRole[] roles, ActionOption option = Ac /// /// public static IBaseAction VariantRampart { get; } = new RoleAction(ActionID.VariantRampart, - new JobRole[] { JobRole.Melee, JobRole.Healer, JobRole.Ranged }, ActionOption.Buff | ActionOption.DutyAction); + new JobRole[] { JobRole.Melee, JobRole.Healer, JobRole.RangedMagical, JobRole.RangedPhysical, }, ActionOption.Buff | ActionOption.DutyAction); /// /// /// public static IBaseAction VariantRampart2 { get; } = new RoleAction(ActionID.VariantRampart2, - new JobRole[] { JobRole.Melee, JobRole.Healer, JobRole.Ranged }, ActionOption.Buff | ActionOption.DutyAction); + new JobRole[] { JobRole.Melee, JobRole.Healer, JobRole.RangedMagical, JobRole.RangedPhysical }, ActionOption.Buff | ActionOption.DutyAction); #endregion IBaseAction[] _allBaseActions; diff --git a/RotationSolver/Localization/ConfigTranslation.cs b/RotationSolver/Localization/ConfigTranslation.cs index c24367c18..e0056bfb7 100644 --- a/RotationSolver/Localization/ConfigTranslation.cs +++ b/RotationSolver/Localization/ConfigTranslation.cs @@ -44,7 +44,6 @@ internal static class ConfigTranslation PluginConfigBool.TeachingMode => LocalizationManager.RightLang.ConfigWindow_Param_TeachingMode, PluginConfigBool.ShowMoveTarget => LocalizationManager.RightLang.ConfigWindow_Param_MovingTargetColor, PluginConfigBool.ShowTarget => LocalizationManager.RightLang.ConfigWindow_Param_ShowTarget, - PluginConfigBool.DrawPositional => LocalizationManager.RightLang.ConfigWindow_Param_DrawPositional, PluginConfigBool.DrawMeleeOffset => LocalizationManager.RightLang.ConfigWindow_Param_DrawMeleeOffset, PluginConfigBool.KeyBoardNoise => LocalizationManager.RightLang.ConfigWindow_Param_KeyBoardNoise, PluginConfigBool.ShowInfoOnDtr => LocalizationManager.RightLang.ConfigWindow_Param_ShowInfoOnDtr, diff --git a/RotationSolver/Localization/Localization.json b/RotationSolver/Localization/Localization.json index b7d66d292..53c7a3680 100644 --- a/RotationSolver/Localization/Localization.json +++ b/RotationSolver/Localization/Localization.json @@ -98,7 +98,6 @@ "ConfigWindow_Param_SampleLength": "The sample length of the line.", "ConfigWindow_Param_KeyBoardNoise": "Simulate the effect of pressing", "ConfigWindow_Param_KeyBoardNoiseTimes": "Effect times", - "ConfigWindow_Param_DrawPositional": "Draw Positional on the screen", "ConfigWindow_Param_DrawMeleeOffset": "Draw the offset of melee on the screen", "ConfigWindow_Param_ShowMoveTarget": "Show the target of the move action", "ConfigWindow_Param_ShowTarget": "Show Target", @@ -462,5 +461,11 @@ "ConfigWindow_List_TerritoryEverywhere": "Everywhere", "ConfigWindow_List_AddTerritory": "Territory name or id", "ConfigWindow_List_BeneficialLocations": "Beneficial locations", - "ConfigWindow_List_NoHostilesName": "The name of object that you don't want to attack" + "ConfigWindow_List_NoHostilesName": "The name of object that you don't want to attack", + "ConfigWindow_Basic_AutoSwitch": "Auto Switch", + "ConfigWindow_Basic_Timer": "Timer", + "ConfigWindow_UI_Windows": "Windows", + "ConfigWindow_UI_Overlay": "Overlay", + "ConfigWindow_UI_Information": "Information", + "ConfigWindow_Auto_ActionUsage": "Action Usage" } \ No newline at end of file diff --git a/RotationSolver/Localization/Strings.cs b/RotationSolver/Localization/Strings.cs index 65fddc241..b16599a4e 100644 --- a/RotationSolver/Localization/Strings.cs +++ b/RotationSolver/Localization/Strings.cs @@ -157,7 +157,6 @@ internal partial class Strings public string ConfigWindow_Param_SampleLength { get; set; } = "The sample length of the line."; public string ConfigWindow_Param_KeyBoardNoise { get; set; } = "Simulate the effect of pressing"; public string ConfigWindow_Param_KeyBoardNoiseTimes { get; set; } = "Effect times"; - public string ConfigWindow_Param_DrawPositional { get; set; } = "Draw Positional on the screen"; public string ConfigWindow_Param_DrawMeleeOffset { get; set; } = "Draw the offset of melee on the screen"; public string ConfigWindow_Param_ShowMoveTarget { get; set; } = "Show the target of the move action"; public string ConfigWindow_Param_ShowTarget { get; set; } = "Show Target"; @@ -674,4 +673,12 @@ internal partial class Strings public string ConfigWindow_List_BeneficialLocations { get; set; } = "Beneficial locations"; public string ConfigWindow_List_NoHostilesName { get; set; } = "The name of object that you don't want to attack"; + public string ConfigWindow_Basic_AutoSwitch { get; set; } = "Auto Switch"; + + public string ConfigWindow_Basic_Timer { get; set; } = "Timer"; + public string ConfigWindow_UI_Windows { get; set; } = "Windows"; + public string ConfigWindow_UI_Overlay { get; set; } = "Overlay"; + public string ConfigWindow_UI_Information { get; set; } = "Information"; + public string ConfigWindow_Auto_ActionUsage { get; set; } = "Action Usage"; + } diff --git a/RotationSolver/UI/RotationConfigWindowNew.cs b/RotationSolver/UI/RotationConfigWindowNew.cs index fecc2cc67..13950cbf3 100644 --- a/RotationSolver/UI/RotationConfigWindowNew.cs +++ b/RotationSolver/UI/RotationConfigWindowNew.cs @@ -6,24 +6,17 @@ using ECommons.ExcelServices; using ECommons.GameHelpers; using ECommons.ImGuiMethods; -using F23.StringSimilarity; -using ImGuiNET; using ImGuiScene; using Lumina.Excel.GeneratedSheets; using RotationSolver.ActionSequencer; using RotationSolver.Basic.Configuration; -using RotationSolver.Basic.Data; using RotationSolver.Data; using RotationSolver.Helpers; using RotationSolver.Localization; -using RotationSolver.TextureItems; using RotationSolver.UI.SearchableConfigs; using RotationSolver.UI.SearchableSettings; using RotationSolver.Updaters; -using System; -using System.Collections.Generic; using System.Diagnostics; -using System.Windows.Forms; using GAction = Lumina.Excel.GeneratedSheets.Action; namespace RotationSolver.UI; @@ -502,7 +495,7 @@ private static void DrawAboutCompatibility() var iconSize = 40 * _scale; - if (ImGui.BeginTable("Incompatible plugin", 4, ImGuiTableFlags.Borders + if (ImGui.BeginTable("Incompatible plugin", 4, ImGuiTableFlags.BordersInner | ImGuiTableFlags.Resizable | ImGuiTableFlags.SizingStretchProp)) { @@ -1046,7 +1039,7 @@ private static void DrawRotationsLoaded() .GroupBy(r => r.GetType().Assembly); - if (ImGui.BeginTable("Rotation Solver AssemblyTable", 3, ImGuiTableFlags.Borders + if (ImGui.BeginTable("Rotation Solver AssemblyTable", 3, ImGuiTableFlags.BordersInner | ImGuiTableFlags.Resizable | ImGuiTableFlags.SizingStretchProp)) { @@ -1209,7 +1202,7 @@ private static void DrawRotationsLibraries() } #endregion - #region Ids + #region List private static uint _territoryId = 0; private static TerritoryType[] _allTerritories = null; internal static TerritoryType[] AllTerritories @@ -1271,15 +1264,15 @@ private static void DrawList() private static readonly CollapsingHeaderGroup _idsHeader = new(new() { { () => LocalizationManager.RightLang.ConfigWindow_List_Statuses, DrawActionsStatuses}, - { () => LocalizationManager.RightLang.ConfigWindow_List_Actions, DrawListActions}, + { () => Service.ConfigNew.GetValue(PluginConfigBool.UseDefenseAbility) ? LocalizationManager.RightLang.ConfigWindow_List_Actions : string.Empty, DrawListActions}, { () => LocalizationManager.RightLang.ConfigWindow_List_Territories, DrawListTerritories}, }); private static void DrawActionsStatuses() { - ImGui.SetNextItemWidth(ImGui.GetWindowWidth() - ImGui.GetStyle().WindowPadding.X * 2); + ImGui.SetNextItemWidth(ImGui.GetWindowWidth()); ImGui.InputTextWithHint("##Searching the action", LocalizationManager.RightLang.ConfigWindow_List_StatusNameOrId, ref _statusSearching, 128); - if (ImGui.BeginTable("Rotation Solver List Statuses", 2, ImGuiTableFlags.Borders | ImGuiTableFlags.Resizable | ImGuiTableFlags.SizingStretchSame)) + if (ImGui.BeginTable("Rotation Solver List Statuses", 2, ImGuiTableFlags.BordersInner | ImGuiTableFlags.Resizable | ImGuiTableFlags.SizingStretchSame)) { ImGui.TableSetupScrollFreeze(0, 1); ImGui.TableNextRow(ImGuiTableRowFlags.Headers); @@ -1310,9 +1303,7 @@ private static void DrawStatusList(string name, HashSet statuses, Status[] var popupId = "Rotation Solver Popup" + name; - if (BeginChild("Rotation Solver Child" + name)) - { - var count = Math.Max(1, (int)MathF.Floor(ImGui.GetWindowWidth() / (24 * _scale + ImGui.GetStyle().ItemSpacing.X))); + var count = Math.Max(1, (int)MathF.Floor(ImGui.GetColumnWidth() / (24 * _scale + ImGui.GetStyle().ItemSpacing.X))); var index = 0; if (IconSet.GetTexture(16220, out var text)) @@ -1403,8 +1394,6 @@ private static void DrawStatusList(string name, HashSet statuses, Status[] ImGui.EndPopup(); } - ImGui.EndChild(); - } if (removeId != 0) { @@ -1415,10 +1404,10 @@ private static void DrawStatusList(string name, HashSet statuses, Status[] private static void DrawListActions() { - ImGui.SetNextItemWidth(ImGui.GetWindowWidth() - ImGui.GetStyle().WindowPadding.X * 2); + ImGui.SetNextItemWidth(ImGui.GetWindowWidth()); ImGui.InputTextWithHint("##Searching the action", LocalizationManager.RightLang.ConfigWindow_List_ActionNameOrId, ref _actionSearching, 128); - if (ImGui.BeginTable("Rotation Solver List Actions", 2, ImGuiTableFlags.Borders | ImGuiTableFlags.Resizable | ImGuiTableFlags.SizingStretchSame)) + if (ImGui.BeginTable("Rotation Solver List Actions", 2, ImGuiTableFlags.BordersInner | ImGuiTableFlags.Resizable | ImGuiTableFlags.SizingStretchSame)) { ImGui.TableSetupScrollFreeze(0, 1); ImGui.TableNextRow(ImGuiTableRowFlags.Headers); @@ -1455,67 +1444,63 @@ private static void DrawActionsList(string name, HashSet actions) ImGui.Spacing(); - if (BeginChild("Rotation Solver Child" + name)) + + foreach (var action in actions.Select(a => Service.GetSheet().GetRow(a)) + .Where(a => a != null) + .OrderBy(s => Math.Min(StringComparer.Distance(s.Name, _actionSearching) + , StringComparer.Distance(s.RowId.ToString(), _actionSearching)))) { - foreach (var action in actions.Select(a => Service.GetSheet().GetRow(a)) - .Where(a => a != null) - .OrderBy(s => Math.Min( StringComparer.Distance(s.Name, _actionSearching) - , StringComparer.Distance(s.RowId.ToString(), _actionSearching)))) - { - void Reset() => removeId = action.RowId; + void Reset() => removeId = action.RowId; - var key = "Action" + action.RowId; + var key = "Action" + action.RowId; - if (ImGui.BeginPopup(key)) + if (ImGui.BeginPopup(key)) + { + if (ImGui.BeginTable(key, 2, ImGuiTableFlags.BordersOuter)) { - if (ImGui.BeginTable(key, 2, ImGuiTableFlags.BordersOuter)) - { - Searchable.DrawHotKeys(LocalizationManager.RightLang.ConfigWindow_List_Remove, Reset, "Delete"); - ImGui.EndTable(); - } - - ImGui.EndPopup(); + Searchable.DrawHotKeys(LocalizationManager.RightLang.ConfigWindow_List_Remove, Reset, "Delete"); + ImGui.EndTable(); } - ImGui.Selectable($"{action.Name} ({action.RowId})"); - if (ImGui.IsItemHovered()) + ImGui.EndPopup(); + } + + ImGui.Selectable($"{action.Name} ({action.RowId})"); + if (ImGui.IsItemHovered()) + { + if (ImGui.IsMouseClicked(ImGuiMouseButton.Right) && !ImGui.IsPopupOpen(key)) { - if (ImGui.IsMouseClicked(ImGuiMouseButton.Right) && !ImGui.IsPopupOpen(key)) - { - ImGui.OpenPopup(key); - } - Searchable.ExecuteHotKeys(Reset, Dalamud.Game.ClientState.Keys.VirtualKey.DELETE); + ImGui.OpenPopup(key); } + Searchable.ExecuteHotKeys(Reset, Dalamud.Game.ClientState.Keys.VirtualKey.DELETE); } + } - if (ImGui.BeginPopup(popupId)) - { - ImGui.SetNextItemWidth(200 * _scale); - ImGui.InputTextWithHint("##Searching the action pop up", LocalizationManager.RightLang.ConfigWindow_List_ActionNameOrId, ref _actionSearching, 128); + if (ImGui.BeginPopup(popupId)) + { + ImGui.SetNextItemWidth(200 * _scale); + ImGui.InputTextWithHint("##Searching the action pop up", LocalizationManager.RightLang.ConfigWindow_List_ActionNameOrId, ref _actionSearching, 128); - ImGui.Spacing(); + ImGui.Spacing(); - if (ImGui.BeginChild("Rotation Solver Add action", new Vector2(-1, 400 * _scale))) + if (ImGui.BeginChild("Rotation Solver Add action", new Vector2(-1, 400 * _scale))) + { + foreach (var action in AllActions.OrderBy(s => Math.Min(StringComparer.Distance(s.Name, _actionSearching) + , StringComparer.Distance(s.RowId.ToString(), _actionSearching)))) { - foreach (var action in AllActions.OrderBy(s => Math.Min( StringComparer.Distance(s.Name, _actionSearching) - , StringComparer.Distance(s.RowId.ToString(), _actionSearching)))) + ImGui.Selectable($"{action.Name} ({action.RowId})"); { - ImGui.Selectable($"{action.Name} ({action.RowId})"); - { - actions.Add(action.RowId); - OtherConfiguration.Save(); - ImGui.CloseCurrentPopup(); - } - ImguiTooltips.HoveredTooltip($"{action.Name} ({action.RowId})"); + actions.Add(action.RowId); + OtherConfiguration.Save(); + ImGui.CloseCurrentPopup(); } - ImGui.EndChild(); + ImguiTooltips.HoveredTooltip($"{action.Name} ({action.RowId})"); } - - ImGui.EndPopup(); + ImGui.EndChild(); } - ImGui.EndChild(); + ImGui.EndPopup(); } if (removeId != 0) @@ -1576,7 +1561,7 @@ private static void DrawListTerritories() } ImGui.PopFont(); - if (ImGui.BeginTable("Rotation Solver List Territories", 2, ImGuiTableFlags.Borders | ImGuiTableFlags.Resizable | ImGuiTableFlags.SizingStretchSame)) + if (ImGui.BeginTable("Rotation Solver List Territories", 2, ImGuiTableFlags.BordersInner | ImGuiTableFlags.Resizable | ImGuiTableFlags.SizingStretchSame)) { ImGui.TableSetupScrollFreeze(0, 1); ImGui.TableNextRow(ImGuiTableRowFlags.Headers); @@ -1640,9 +1625,18 @@ private static void DrawListTerritories() { }); + private static readonly ISearchable[] _debugSearchable = new ISearchable[] + { + new CheckBoxSearchPlugin(PluginConfigBool.InDebug), + }; private static void DrawDebug() { ImGui.Text("Debug"); + + foreach (var searchable in _debugSearchable) + { + searchable?.Draw(Job); + } _debugHeader?.Draw(); } diff --git a/RotationSolver/UI/RotationConfigWindowNew_Config.cs b/RotationSolver/UI/RotationConfigWindowNew_Config.cs index 96c83621d..d39f3e573 100644 --- a/RotationSolver/UI/RotationConfigWindowNew_Config.cs +++ b/RotationSolver/UI/RotationConfigWindowNew_Config.cs @@ -1,5 +1,6 @@ using F23.StringSimilarity; using RotationSolver.Basic.Configuration; +using RotationSolver.Basic.Data; using RotationSolver.Localization; using RotationSolver.UI.SearchableConfigs; using RotationSolver.UI.SearchableSettings; @@ -59,58 +60,126 @@ private static ISearchable GetParent(ISearchable searchable) return GetParent(searchable.Parent); } - // 基础参数,不常更改的一些参数,基本设置好都不怎么会在改动的设置 - private static readonly ISearchable[] _basicParamsSearchable = new ISearchable[] + #region Basic + private static void DrawBasic() + { + _baseHeader?.Draw(); + } + + private static readonly CollapsingHeaderGroup _baseHeader = new(new() + { + { () => LocalizationManager.RightLang.ConfigWindow_Basic_Timer, DrawBasicTimer }, + { () => LocalizationManager.RightLang.ConfigWindow_Basic_AutoSwitch, DrawBasicAutoSwitch }, + }); + + + private static void DrawBasicTimer() + { + foreach (var searchable in _basicTimer) + { + searchable?.Draw(Job); + } + } + + private static void DrawBasicAutoSwitch() + { + foreach (var searchable in _basicSwitchTurnOn) + { + searchable?.Draw(Job); + } + + ImGui.Separator(); + + foreach (var searchable in _basicSwitchTurnOff) + { + searchable?.Draw(Job); + } + } + + private static readonly ISearchable[] _basicTimer = new ISearchable[] { - new CheckBoxSearchPlugin(PluginConfigBool.UseWorkTask), - new DragIntSearchJob(JobConfigInt.AddDotGCDCount, 1), new DragFloatSearchPlugin(PluginConfigFloat.ActionAhead, 0.002f), new DragFloatSearchPlugin(PluginConfigFloat.MinLastAbilityAdvanced, 0.002f), - new DragFloatSearchPlugin(PluginConfigFloat.CountDownAhead, 0.002f), new DragFloatSearchPlugin(PluginConfigFloat.SpecialDuration, 1f), + new DragFloatSearchPlugin(PluginConfigFloat.CountDownAhead, 0.002f), new DragFloatSearchPlugin(PluginConfigFloat.MaxPing, 0.002f), - new DragFloatSearchPlugin(PluginConfigFloat.MistakeRatio, 0.002f), new DragFloatRangeSearchPlugin(PluginConfigFloat.WeaponDelayMin, PluginConfigFloat.WeaponDelayMax, 0.002f), + + new DragFloatRangeSearchPlugin(PluginConfigFloat.ClickingDelayMin, PluginConfigFloat.ClickingDelayMax, 0.002f), + + new CheckBoxSearchPlugin(PluginConfigBool.PreventActions, new ISearchable[] + { + new CheckBoxSearchPlugin(PluginConfigBool.PreventActionsDuty), + }), + }; + + private static readonly ISearchable[] _basicParamsSearchable = new ISearchable[] + { + new CheckBoxSearchPlugin(PluginConfigBool.ToggleManual), + + new CheckBoxSearchPlugin(PluginConfigBool.UseWorkTask), + new DragIntSearchJob(JobConfigInt.AddDotGCDCount, 1), + new DragFloatSearchPlugin(PluginConfigFloat.MistakeRatio, 0.002f), + + new DragFloatRangeSearchPlugin(PluginConfigFloat.HostileDelayMin, PluginConfigFloat.HostileDelayMax, 0.002f), new DragFloatRangeSearchPlugin(PluginConfigFloat.InterruptDelayMin, PluginConfigFloat.InterruptDelayMax, 0.002f), new DragFloatRangeSearchPlugin(PluginConfigFloat.DeathDelayMin, PluginConfigFloat.DeathDelayMax, 0.002f), new DragFloatRangeSearchPlugin(PluginConfigFloat.WeakenDelayMin, PluginConfigFloat.WeakenDelayMax, 0.002f), new DragFloatRangeSearchPlugin(PluginConfigFloat.HealDelayMin, PluginConfigFloat.HealDelayMin, 0.002f), - new DragFloatRangeSearchPlugin(PluginConfigFloat.CountdownDelayMin, PluginConfigFloat.CountdownDelayMax, 0.002f), + new DragFloatRangeSearchPlugin(PluginConfigFloat.NotInCombatDelayMin, PluginConfigFloat.NotInCombatDelayMax, 0.002f), - new DragFloatRangeSearchPlugin(PluginConfigFloat.ClickingDelayMin, PluginConfigFloat.ClickingDelayMax, 0.002f), + }; - // 插件整体控制,如自动开关,模式变换啥的 - private static readonly ISearchable[] _basicOtherSearchable = new ISearchable[] + + + private static readonly ISearchable[] _basicSwitchTurnOn = new ISearchable[] { - // 插件开关控制 - new CheckBoxSearchPlugin(PluginConfigBool.StartOnCountdown), + // Turn on + new CheckBoxSearchPlugin(PluginConfigBool.StartOnCountdown, + new DragFloatRangeSearchPlugin(PluginConfigFloat.CountdownDelayMin, PluginConfigFloat.CountdownDelayMax, 0.002f)), new CheckBoxSearchPlugin(PluginConfigBool.StartOnAttackedBySomeone), - new CheckBoxSearchPlugin(PluginConfigBool.ToggleManual), + }; - - // 自动关闭控制 + private static readonly ISearchable[] _basicSwitchTurnOff = new ISearchable[] + { + // Turn off new CheckBoxSearchPlugin(PluginConfigBool.AutoOffBetweenArea), new CheckBoxSearchPlugin(PluginConfigBool.AutoOffCutScene), new CheckBoxSearchPlugin(PluginConfigBool.AutoOffWhenDead), - new DragFloatSearchPlugin(PluginConfigFloat.AutoOffAfterCombat, 1f), + new DragFloatSearchPlugin(PluginConfigFloat.AutoOffAfterCombat, 1f), }; + #endregion - private static readonly CollapsingHeaderGroup _baseHeader = new(new() + #region UI + private static void DrawUI() + { + _UIHeader?.Draw(); + } + + private static readonly CollapsingHeaderGroup _UIHeader = new(new() { - { () => "基础参数设置", () => + { () => LocalizationManager.RightLang.ConfigWindow_UI_Information, () => { - foreach (var searchable in _basicParamsSearchable) + foreach (var searchable in _uiInformationSearchable) { searchable?.Draw(Job); } } }, - { () => "模式及开关设置", () => + { () => LocalizationManager.RightLang.ConfigWindow_UI_Overlay, () => { - foreach (var searchable in _basicOtherSearchable) + foreach (var searchable in _uiOverlaySearchable) + { + searchable?.Draw(Job); + } + } + }, + { () => LocalizationManager.RightLang.ConfigWindow_UI_Windows, () => + { + foreach (var searchable in _uiWindowsSearchable) { searchable?.Draw(Job); } @@ -118,58 +187,48 @@ private static ISearchable GetParent(ISearchable searchable) }, }); - private static void DrawBasic() - { - _baseHeader?.Draw(); - } - - // 提示通知相关的设置 - private static readonly ISearchable[] _uiInfoSearchable = new ISearchable[] + // information + private static readonly ISearchable[] _uiInformationSearchable = new ISearchable[] { new CheckBoxSearchPlugin(PluginConfigBool.ShowInfoOnDtr), new CheckBoxSearchPlugin(PluginConfigBool.ShowInfoOnToast), + new CheckBoxSearchPlugin(PluginConfigBool.ShowToastsAboutDoAction), + + new CheckBoxSearchPlugin(PluginConfigBool.KeyBoardNoise, + new DragIntRangeSearchPlugin(PluginConfigInt.KeyBoardNoiseMin, PluginConfigInt.KeyBoardNoiseMax, 1)), + + new CheckBoxSearchPlugin(PluginConfigBool.SayOutStateChanged), + + new CheckBoxSearchPlugin(PluginConfigBool.ShowTooltips), }; - // 画图,遮罩层相关的设置 - private static readonly ISearchable[] _uiDrawSearchable = new ISearchable[] + // Overlay + private static readonly ISearchable[] _uiOverlaySearchable = new ISearchable[] { - new CheckBoxSearchPlugin(PluginConfigBool.TeachingMode, new ISearchable[] - { + new CheckBoxSearchPlugin(PluginConfigBool.UseOverlayWindow, + new DragFloatSearchPlugin(PluginConfigFloat.DrawingHeight, 0.02f), + new DragFloatSearchPlugin(PluginConfigFloat.SampleLength, 0.001f), + + new CheckBoxSearchPlugin(PluginConfigBool.TeachingMode, new ColorEditSearchPlugin(PluginConfigVector4.TeachingModeColor) - }), - new CheckBoxSearchPlugin(PluginConfigBool.KeyBoardNoise, new ISearchable[] - { - new DragIntRangeSearchPlugin(PluginConfigInt.KeyBoardNoiseMin, PluginConfigInt.KeyBoardNoiseMax, 1) - }), - new CheckBoxSearchPlugin(PluginConfigBool.ShowMoveTarget, new ISearchable[] - { + ), + + new CheckBoxSearchPlugin(PluginConfigBool.ShowMoveTarget, new ColorEditSearchPlugin(PluginConfigVector4.MovingTargetColor) - }), - new CheckBoxSearchPlugin(PluginConfigBool.ShowTarget, new ISearchable[] - { + ), + new CheckBoxSearchPlugin(PluginConfigBool.ShowTarget, new DragFloatSearchPlugin(PluginConfigFloat.TargetIconSize, 0.002f), new ColorEditSearchPlugin(PluginConfigVector4.TargetColor), - new ColorEditSearchPlugin(PluginConfigVector4.SubTargetColor), - }), - new CheckBoxSearchPlugin(PluginConfigBool.DrawPositional, new ISearchable[] - { - new DragFloatSearchPlugin(PluginConfigFloat.DrawingHeight, 0.02f), - new DragFloatSearchPlugin(PluginConfigFloat.SampleLength, 0.001f), - }), - new CheckBoxSearchPlugin(PluginConfigBool.DrawMeleeOffset, new ISearchable[] - { - new DragFloatSearchPlugin(PluginConfigFloat.DrawingHeight, 0.02f), - new DragFloatSearchPlugin(PluginConfigFloat.SampleLength, 0.001f), - }), - + new ColorEditSearchPlugin(PluginConfigVector4.SubTargetColor) + ), + new CheckBoxSearchPlugin(PluginConfigBool.DrawMeleeOffset)), }; - // 悬浮窗设置 - private static readonly ISearchable[] _uiOverlaySearchable = new ISearchable[] + // Windows + private static readonly ISearchable[] _uiWindowsSearchable = new ISearchable[] { - // 只在有敌人或在副本显示 - //new CheckBoxSearchPlugin(PluginConfigBool.OnlyShowWithHostileOrInDuty), + new CheckBoxSearchPlugin(PluginConfigBool.OnlyShowWithHostileOrInDuty), new CheckBoxSearchPlugin(PluginConfigBool.ShowControlWindow, new ISearchable[] { @@ -183,6 +242,7 @@ private static void DrawBasic() new ColorEditSearchPlugin(PluginConfigVector4.ControlWindowUnlockBg), new ColorEditSearchPlugin(PluginConfigVector4.ControlWindowLockBg), }), + new CheckBoxSearchPlugin(PluginConfigBool.ShowNextActionWindow, new ISearchable[] { new CheckBoxSearchPlugin(PluginConfigBool.OnlyShowWithHostileOrInDuty), @@ -191,6 +251,7 @@ private static void DrawBasic() new ColorEditSearchPlugin(PluginConfigVector4.InfoWindowBg), }), + new CheckBoxSearchPlugin(PluginConfigBool.ShowCooldownWindow, new ISearchable[] { new CheckBoxSearchPlugin(PluginConfigBool.OnlyShowWithHostileOrInDuty), @@ -207,88 +268,104 @@ private static void DrawBasic() new ColorEditSearchPlugin(PluginConfigVector4.InfoWindowBg), }), }; + #endregion - private static readonly CollapsingHeaderGroup _UIHeader = new(new() + private static readonly ISearchable[] _autoSearchable = new ISearchable[] { - { () => "通知提示设置", () => + new CheckBoxSearchPlugin(PluginConfigBool.AutoBurst), + new AutoHealCheckBox( + new CheckBoxSearchPlugin(PluginConfigBool.UseHealWhenNotAHealer) { - foreach (var searchable in _uiInfoSearchable) + JobRoles = new JobRole[] { - searchable?.Draw(Job); + JobRole.Tank, + JobRole.Melee, + JobRole.RangedMagical, + JobRole.RangedPhysical, } - } - }, - { () => "绘图遮罩设置", () => + }, + new DragFloatSearchPlugin(PluginConfigFloat.HealthDifference, 0.02f)), + + new CheckBoxSearchPlugin(PluginConfigBool.RaisePlayerByCasting) { - foreach (var searchable in _uiDrawSearchable) + JobRoles = new JobRole[] { - searchable?.Draw(Job); + JobRole.Healer, } - } - }, - { () => "悬浮窗设置", () => + }, + new DragIntSearchPlugin(PluginConfigInt.LessMPNoRaise, 200) { - foreach (var searchable in _uiOverlaySearchable) + JobRoles = new JobRole[] { - searchable?.Draw(Job); + JobRole.Healer, } - } - }, - }); + }, + new CheckBoxSearchPlugin(PluginConfigBool.AutoProvokeForTank) + { + JobRoles = new JobRole[] + { + JobRole.Tank, + } + }, - private static void DrawUI() - { - _UIHeader?.Draw(); - } + new CheckBoxSearchPlugin(PluginConfigBool.InterruptibleMoreCheck) + { + JobRoles = new JobRole[] + { + JobRole.Tank, + JobRole.Melee, + JobRole.RangedPhysical, + } + }, + new CheckBoxSearchPlugin(PluginConfigBool.EsunaAll) + { + JobRoles = new JobRole[] + { + JobRole.Healer, + }, + Jobs = new ECommons.ExcelServices.Job[] + { + ECommons.ExcelServices.Job.BRD, + }, + }, + new CheckBoxSearchPlugin(PluginConfigBool.HealOutOfCombat), + new DragFloatSearchPlugin(PluginConfigFloat.HealWhenNothingTodoBelow, 0.002f), + new DragFloatSearchPlugin(PluginConfigFloat.DistanceForMoving, 1f), + new DragFloatSearchPlugin(PluginConfigFloat.MeleeRangeOffset, 0.02f), + new CheckBoxSearchPlugin(PluginConfigBool.UseDefenseAbility), - private static readonly ISearchable[] _autoSearchable = new ISearchable[] + new DragFloatSearchPlugin(PluginConfigFloat.HealthHealerRatio, 0.02f), + new DragFloatSearchPlugin(PluginConfigFloat.HealthTankRatio, 0.02f), + }; + + private static readonly ISearchable[] _autoActionUsageSearchable = new ISearchable[] { - new CheckBoxSearchPlugin(PluginConfigBool.UseAOEAction, new ISearchable[] + new CheckBoxSearchPlugin(PluginConfigBool.UseAOEAction, new ISearchable[] { new CheckBoxSearchPlugin(PluginConfigBool.UseAOEWhenManual), new CheckBoxSearchPlugin(PluginConfigBool.NoNewHostiles), }), - new CheckBoxSearchPlugin(PluginConfigBool.PreventActions, new ISearchable[] - { - new CheckBoxSearchPlugin(PluginConfigBool.PreventActionsDuty), - }), - new CheckBoxSearchPlugin(PluginConfigBool.AutoBurst), - new CheckBoxSearchPlugin(PluginConfigBool.AutoHeal), + new CheckBoxSearchPlugin(PluginConfigBool.UseTinctures), new CheckBoxSearchPlugin(PluginConfigBool.UseHealPotions), + new CheckBoxSearchPlugin(PluginConfigBool.OnlyHotOnTanks), new CheckBoxSearchPlugin(PluginConfigBool.UseAbility, new ISearchable[] { - new CheckBoxSearchPlugin(PluginConfigBool.UseDefenseAbility), new CheckBoxSearchPlugin(PluginConfigBool.AutoTankStance), - new CheckBoxSearchPlugin(PluginConfigBool.AutoProvokeForTank), new CheckBoxSearchPlugin(PluginConfigBool.AutoUseTrueNorth), new CheckBoxSearchPlugin(PluginConfigBool.RaisePlayerBySwift), new CheckBoxSearchPlugin(PluginConfigBool.AutoSpeedOutOfCombat), - new CheckBoxSearchPlugin(PluginConfigBool.UseGroundBeneficialAbility), + new CheckBoxSearchPlugin(PluginConfigBool.UseGroundBeneficialAbility, + new CheckBoxSearchPlugin(PluginConfigBool.BeneficialAreaOnTarget)), }), - new CheckBoxSearchPlugin(PluginConfigBool.RaisePlayerByCasting), - new CheckBoxSearchPlugin(PluginConfigBool.UseHealWhenNotAHealer), - new DragIntSearchPlugin(PluginConfigInt.LessMPNoRaise, 200), - - new CheckBoxSearchPlugin(PluginConfigBool.InterruptibleMoreCheck), - new CheckBoxSearchPlugin(PluginConfigBool.EsunaAll), - new CheckBoxSearchPlugin(PluginConfigBool.HealOutOfCombat), - new DragFloatSearchPlugin(PluginConfigFloat.HealWhenNothingTodoBelow, 0.002f), - new CheckBoxSearchPlugin(PluginConfigBool.OnlyHotOnTanks), - new CheckBoxSearchPlugin(PluginConfigBool.BeneficialAreaOnTarget), - new DragFloatSearchPlugin(PluginConfigFloat.DistanceForMoving, 1f), - new DragFloatSearchPlugin(PluginConfigFloat.MeleeRangeOffset, 0.02f), - new DragFloatSearchPlugin(PluginConfigFloat.HealthDifference, 0.02f), - new DragFloatSearchPlugin(PluginConfigFloat.HealthHealerRatio, 0.02f), - new DragFloatSearchPlugin(PluginConfigFloat.HealthTankRatio, 0.02f), - }; private static readonly CollapsingHeaderGroup _autoHeader = new(new() { - { () => "通用", () => + { () => LocalizationManager.RightLang.ConfigWindow_Auto_ActionUsage, () => { - foreach (var searchable in _autoSearchable) + ImGui.Text("Which actions RS can use"); + foreach (var searchable in _autoActionUsageSearchable) { searchable?.Draw(Job); } @@ -348,8 +425,6 @@ private static void DrawTarget() private static readonly ISearchable[] _extraSearchable = new ISearchable[] { - new CheckBoxSearchPlugin(PluginConfigBool.SayOutStateChanged), - new CheckBoxSearchPlugin(PluginConfigBool.PoslockCasting, new DragIntSearchPlugin( PluginConfigInt.PoslockModifier, "SHIFT", "CTRL", "ALT", "Left Mouse", "Middle Mouse", "Right Mouse"), new CheckBoxSearchPlugin(PluginConfigBool.PosPassageOfArms) @@ -376,10 +451,7 @@ private static void DrawTarget() new DragFloatSearchPlugin(PluginConfigFloat.HealthRatioDot, 0.02f), }), - new CheckBoxSearchPlugin(PluginConfigBool.ShowTooltips), - new CheckBoxSearchPlugin(PluginConfigBool.InDebug), - // 死亡停止读条,待定 new CheckBoxSearchPlugin(PluginConfigBool.UseStopCasting,new ISearchable[] { new DragFloatRangeSearchPlugin(PluginConfigFloat.StopCastingDelayMin, PluginConfigFloat.StopCastingDelayMin, 0.002f) @@ -417,8 +489,6 @@ private static void DrawEventTab() ImGui.TextWrapped(LocalizationManager.RightLang.ConfigWindow_Events_Description); - ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(0f, 5f)); - ImGui.Text(LocalizationManager.RightLang.ConfigWindow_Events_DutyStart); ImGui.SameLine(); ImGuiHelper.Spacing(); @@ -429,35 +499,32 @@ private static void DrawEventTab() ImGuiHelper.Spacing(); Service.Config.DutyEnd.DisplayMacro(); - if (ImGui.BeginChild("Events List", new Vector2(0f, -1f), true)) + ImGui.Separator(); + + ActionEventInfo remove = null; + foreach (var eve in Service.Config.Events) { - ActionEventInfo remove = null; - foreach (var eve in Service.Config.Events) - { - eve.DisplayEvent(); + eve.DisplayEvent(); - ImGui.SameLine(); - ImGuiHelper.Spacing(); + ImGui.SameLine(); + ImGuiHelper.Spacing(); - if (ImGui.Button($"{LocalizationManager.RightLang.ConfigWindow_Events_RemoveEvent}##RemoveEvent{eve.GetHashCode()}")) - { - remove = eve; - } - ImGui.Separator(); - } - if (remove != null) + if (ImGui.Button($"{LocalizationManager.RightLang.ConfigWindow_Events_RemoveEvent}##RemoveEvent{eve.GetHashCode()}")) { - Service.Config.Events.Remove(remove); - Service.Config.Save(); + remove = eve; } - - ImGui.EndChild(); + ImGui.Separator(); + } + if (remove != null) + { + Service.Config.Events.Remove(remove); + Service.Config.Save(); } - ImGui.PopStyleVar(); } private static void DrawExtra() { + ImGui.TextWrapped("Side features, should be removed"); _extraHeader?.Draw(); } } diff --git a/RotationSolver/UI/RotationConfigWindow_Param.cs b/RotationSolver/UI/RotationConfigWindow_Param.cs index bb220eb1e..3b67964c9 100644 --- a/RotationSolver/UI/RotationConfigWindow_Param.cs +++ b/RotationSolver/UI/RotationConfigWindow_Param.cs @@ -244,9 +244,6 @@ private void DrawParamDisplay() ref Service.Config.SubTargetColor, Service.Default.SubTargetColor); } - DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Param_DrawPositional, - ref Service.Config.DrawPositional, Service.Default.DrawPositional); - DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Param_DrawMeleeOffset, ref Service.Config.DrawMeleeOffset, Service.Default.DrawMeleeOffset); @@ -407,80 +404,80 @@ private void DrawParamCondition() // ref Service.Config.HealthDifference, Service.Default.HealthDifference, //speed * 2, 0, 0.5f); - if (ImGui.BeginTable("Healing things", 3, ImGuiTableFlags.Borders - | ImGuiTableFlags.Resizable - | ImGuiTableFlags.SizingStretchProp)) - { - ImGui.TableSetupScrollFreeze(0, 1); - ImGui.TableNextRow(ImGuiTableRowFlags.Headers); + //if (ImGui.BeginTable("Healing things", 3, ImGuiTableFlags.Borders + // | ImGuiTableFlags.Resizable + // | ImGuiTableFlags.SizingStretchProp)) + //{ + // ImGui.TableSetupScrollFreeze(0, 1); + // ImGui.TableNextRow(ImGuiTableRowFlags.Headers); - ImGui.TableNextColumn(); - ImGui.TableHeader(""); + // ImGui.TableNextColumn(); + // ImGui.TableHeader(""); - ImGui.TableNextColumn(); - ImGui.TableHeader(LocalizationManager.RightLang.ConfigWindow_Param_Normal); + // ImGui.TableNextColumn(); + // ImGui.TableHeader(LocalizationManager.RightLang.ConfigWindow_Param_Normal); - ImGui.TableNextColumn(); - ImGui.TableHeader(LocalizationManager.RightLang.ConfigWindow_Param_HOT); + // ImGui.TableNextColumn(); + // ImGui.TableHeader(LocalizationManager.RightLang.ConfigWindow_Param_HOT); - ImGui.TableNextRow(); - ImGui.TableNextColumn(); - ImGui.Text(LocalizationManager.RightLang.ConfigWindow_Param_HealthAreaAbility); + // ImGui.TableNextRow(); + // ImGui.TableNextColumn(); + // ImGui.Text(LocalizationManager.RightLang.ConfigWindow_Param_HealthAreaAbility); - ImGui.TableNextColumn(); + // ImGui.TableNextColumn(); - DrawFloatNumber("##" + nameof(Service.Config.HealthAreaAbility), - ref Service.Config.HealthAreaAbility, Service.Default.HealthAreaAbility, speed); + // DrawFloatNumber("##" + nameof(Service.Config.HealthAreaAbility), + // ref Service.Config.HealthAreaAbility, Service.Default.HealthAreaAbility, speed); - ImGui.TableNextColumn(); + // ImGui.TableNextColumn(); - DrawFloatNumber("##" + nameof(Service.Config.HealthAreaAbilityHot), - ref Service.Config.HealthAreaAbilityHot, Service.Default.HealthAreaAbilityHot, speed); + // DrawFloatNumber("##" + nameof(Service.Config.HealthAreaAbilityHot), + // ref Service.Config.HealthAreaAbilityHot, Service.Default.HealthAreaAbilityHot, speed); - ImGui.TableNextRow(); - ImGui.TableNextColumn(); - ImGui.Text(LocalizationManager.RightLang.ConfigWindow_Param_HealthAreaSpell); + // ImGui.TableNextRow(); + // ImGui.TableNextColumn(); + // ImGui.Text(LocalizationManager.RightLang.ConfigWindow_Param_HealthAreaSpell); - ImGui.TableNextColumn(); + // ImGui.TableNextColumn(); - DrawFloatNumber("##" + nameof(Service.Config.HealthAreaSpell), - ref Service.Config.HealthAreaSpell, Service.Default.HealthAreaSpell, speed); + // DrawFloatNumber("##" + nameof(Service.Config.HealthAreaSpell), + // ref Service.Config.HealthAreaSpell, Service.Default.HealthAreaSpell, speed); - ImGui.TableNextColumn(); + // ImGui.TableNextColumn(); - DrawFloatNumber("##" + nameof(Service.Config.HealthAreaSpellHot), - ref Service.Config.HealthAreaSpellHot, Service.Default.HealthAreaSpellHot, speed); + // DrawFloatNumber("##" + nameof(Service.Config.HealthAreaSpellHot), + // ref Service.Config.HealthAreaSpellHot, Service.Default.HealthAreaSpellHot, speed); - ImGui.TableNextRow(); - ImGui.TableNextColumn(); - ImGui.Text(LocalizationManager.RightLang.ConfigWindow_Param_HealthSingleAbility); + // ImGui.TableNextRow(); + // ImGui.TableNextColumn(); + // ImGui.Text(LocalizationManager.RightLang.ConfigWindow_Param_HealthSingleAbility); - ImGui.TableNextColumn(); + // ImGui.TableNextColumn(); - DrawFloatNumber("##" + nameof(Service.Config.HealthSingleAbility), - ref Service.Config.HealthSingleAbility, Service.Default.HealthSingleAbility, speed); + // DrawFloatNumber("##" + nameof(Service.Config.HealthSingleAbility), + // ref Service.Config.HealthSingleAbility, Service.Default.HealthSingleAbility, speed); - ImGui.TableNextColumn(); + // ImGui.TableNextColumn(); - DrawFloatNumber("##" + nameof(Service.Config.HealthSingleAbilityHot), - ref Service.Config.HealthSingleAbilityHot, Service.Default.HealthSingleAbilityHot, speed); + // DrawFloatNumber("##" + nameof(Service.Config.HealthSingleAbilityHot), + // ref Service.Config.HealthSingleAbilityHot, Service.Default.HealthSingleAbilityHot, speed); - ImGui.TableNextRow(); - ImGui.TableNextColumn(); - ImGui.Text(LocalizationManager.RightLang.ConfigWindow_Param_HealthSingleSpell); + // ImGui.TableNextRow(); + // ImGui.TableNextColumn(); + // ImGui.Text(LocalizationManager.RightLang.ConfigWindow_Param_HealthSingleSpell); - ImGui.TableNextColumn(); + // ImGui.TableNextColumn(); - DrawFloatNumber("##" + nameof(Service.Config.HealthSingleSpell), - ref Service.Config.HealthSingleSpell, Service.Default.HealthSingleSpell, speed); + // DrawFloatNumber("##" + nameof(Service.Config.HealthSingleSpell), + // ref Service.Config.HealthSingleSpell, Service.Default.HealthSingleSpell, speed); - ImGui.TableNextColumn(); + // ImGui.TableNextColumn(); - DrawFloatNumber("##" + nameof(Service.Config.HealthSingleSpellHot), - ref Service.Config.HealthSingleSpellHot, Service.Default.HealthSingleSpellHot, speed); + // DrawFloatNumber("##" + nameof(Service.Config.HealthSingleSpellHot), + // ref Service.Config.HealthSingleSpellHot, Service.Default.HealthSingleSpellHot, speed); - ImGui.EndTable(); - } + // ImGui.EndTable(); + //} //DrawFloatNumber(LocalizationManager.RightLang.ConfigWindow_Param_HealthHealerRatio, // ref Service.Config.HealthHealerRatio, Service.Default.HealthHealerRatio, speed); diff --git a/RotationSolver/UI/SearchableConfigs/AutoHealCheckBox.cs b/RotationSolver/UI/SearchableConfigs/AutoHealCheckBox.cs new file mode 100644 index 000000000..a955c43eb --- /dev/null +++ b/RotationSolver/UI/SearchableConfigs/AutoHealCheckBox.cs @@ -0,0 +1,114 @@ +using ECommons.ExcelServices; +using RotationSolver.Basic.Configuration; +using RotationSolver.Localization; +using RotationSolver.UI.SearchableSettings; + +namespace RotationSolver.UI.SearchableConfigs; + +internal class AutoHealCheckBox : CheckBoxSearchPlugin +{ + private ISearchable[] _otherChildren; + + public AutoHealCheckBox(params ISearchable[] otherChildren) + : base(PluginConfigBool.AutoHeal, otherChildren.Union(new ISearchable[] + { + _healthAreaAbility, + _healthAreaAbilityHot, + _healthAreaSpell , + _healthAreaSpellHot , + _healthSingleAbility , + _healthSingleAbilityHot , + _healthSingleSpell , + _healthSingleSpellHot , + }).ToArray()) + { + _otherChildren = otherChildren; + } + private const float speed = 0.005f; + + private static readonly DragFloatSearchJob + _healthAreaAbility = new(JobConfigFloat.HealthAreaAbility, speed), + _healthAreaAbilityHot = new(JobConfigFloat.HealthAreaAbilityHot, speed), + _healthAreaSpell = new(JobConfigFloat.HealthAreaSpell, speed), + _healthAreaSpellHot = new(JobConfigFloat.HealthAreaSpellHot, speed), + _healthSingleAbility = new(JobConfigFloat.HealthSingleAbility, speed), + _healthSingleAbilityHot = new(JobConfigFloat.HealthSingleAbilityHot, speed), + _healthSingleSpell = new(JobConfigFloat.HealthSingleSpell, speed), + _healthSingleSpellHot = new(JobConfigFloat.HealthSingleSpellHot, speed); + + protected override void DrawChildren(Job job) + { + foreach (var child in _otherChildren) + { + child.Draw(job); + } + + if (ImGui.BeginTable("Healing things", 3, ImGuiTableFlags.Borders + | ImGuiTableFlags.Resizable + | ImGuiTableFlags.SizingStretchProp)) + { + ImGui.TableSetupScrollFreeze(0, 1); + ImGui.TableNextRow(ImGuiTableRowFlags.Headers); + + ImGui.TableNextColumn(); + ImGui.TableHeader(""); + + ImGui.TableNextColumn(); + ImGui.TableHeader(LocalizationManager.RightLang.ConfigWindow_Param_Normal); + + ImGui.TableNextColumn(); + ImGui.TableHeader(LocalizationManager.RightLang.ConfigWindow_Param_HOT); + + ImGui.TableNextRow(); + ImGui.TableNextColumn(); + ImGui.Text(LocalizationManager.RightLang.ConfigWindow_Param_HealthAreaAbility); + + ImGui.TableNextColumn(); + + _healthAreaAbility?.Draw(job); + + ImGui.TableNextColumn(); + + _healthAreaAbilityHot?.Draw(job); + + ImGui.TableNextRow(); + ImGui.TableNextColumn(); + ImGui.Text(LocalizationManager.RightLang.ConfigWindow_Param_HealthAreaSpell); + + ImGui.TableNextColumn(); + + _healthAreaSpell?.Draw(job); + + + ImGui.TableNextColumn(); + + _healthAreaSpellHot?.Draw(job); + + ImGui.TableNextRow(); + ImGui.TableNextColumn(); + ImGui.Text(LocalizationManager.RightLang.ConfigWindow_Param_HealthSingleAbility); + + ImGui.TableNextColumn(); + + _healthSingleAbility?.Draw(job); + + ImGui.TableNextColumn(); + + _healthSingleAbilityHot?.Draw(job); + + ImGui.TableNextRow(); + ImGui.TableNextColumn(); + ImGui.Text(LocalizationManager.RightLang.ConfigWindow_Param_HealthSingleSpell); + + ImGui.TableNextColumn(); + + _healthSingleSpell?.Draw(job); + + ImGui.TableNextColumn(); + + _healthSingleSpellHot?.Draw(job); + + ImGui.EndTable(); + } + } +} diff --git a/RotationSolver/UI/SearchableConfigs/CheckBoxSearch.cs b/RotationSolver/UI/SearchableConfigs/CheckBoxSearch.cs index 87c4176c8..21bc0288b 100644 --- a/RotationSolver/UI/SearchableConfigs/CheckBoxSearch.cs +++ b/RotationSolver/UI/SearchableConfigs/CheckBoxSearch.cs @@ -13,7 +13,7 @@ internal class CheckBoxSearchPlugin : CheckBoxSearch public override string Name => _config.ToName(); - public override string Description => Action == ActionID.NoMercy ? _config.ToDescription() : Action.ToString(); + public override string Description => Action == ActionID.None ? _config.ToDescription() : Action.ToString(); public override LinkDescription[] Tooltips => _config.ToAction(); @@ -59,6 +59,22 @@ public CheckBoxSearch(params ISearchable[] children) protected abstract bool GetValue(Job job); protected abstract void SetValue(Job job, bool value); + protected virtual void DrawChildren(Job job) + { + var lastIs = false; + foreach (var child in Children) + { + var thisIs = child is CheckBoxSearch c && c.Action != ActionID.None && IconSet.GetTexture(c.Action, out var texture); + if (lastIs && thisIs) + { + ImGui.SameLine(); + } + lastIs = thisIs; + + child.Draw(job); + } + } + protected override void DrawMain(Job job) { var hasChild = Children != null && Children.Length > 0; @@ -101,18 +117,7 @@ protected override void DrawMain(Job job) { ImGui.SetCursorPosX(x); ImGui.BeginGroup(); - var lastIs = false; - foreach (var child in Children) - { - var thisIs = child is CheckBoxSearch c && c.Action != ActionID.None && IconSet.GetTexture(c.Action, out texture); - if (lastIs && thisIs) - { - ImGui.SameLine(); - } - lastIs = thisIs; - - child.Draw(job); - } + DrawChildren(job); ImGui.EndGroup(); ImGui.TreePop(); } diff --git a/RotationSolver/UI/SearchableConfigs/ColorEditSearch.cs b/RotationSolver/UI/SearchableConfigs/ColorEditSearch.cs index c0002c325..87c06748d 100644 --- a/RotationSolver/UI/SearchableConfigs/ColorEditSearch.cs +++ b/RotationSolver/UI/SearchableConfigs/ColorEditSearch.cs @@ -46,6 +46,7 @@ internal abstract class ColorEditSearch : Searchable protected override void DrawMain(Job job) { var value = GetValue(job); + ImGui.SetNextItemWidth(DRAG_WIDTH * 1.5f * Scale); if(ImGui.ColorEdit4($"{Name}##Config_{ID}", ref value)) { SetValue(job, value); diff --git a/RotationSolver/UI/SearchableConfigs/Searchable.cs b/RotationSolver/UI/SearchableConfigs/Searchable.cs index 8b6281a90..29c2bac59 100644 --- a/RotationSolver/UI/SearchableConfigs/Searchable.cs +++ b/RotationSolver/UI/SearchableConfigs/Searchable.cs @@ -22,8 +22,31 @@ internal abstract class Searchable : ISearchable public abstract string ID { get; } private string Popup_Key => "Rotation Solver RightClicking: " + ID; protected virtual bool IsJob => false; + + /// + /// Only these job roles can get this setting. + /// + public JobRole[] JobRoles { get; set; } + public Job[] Jobs { get; set; } + public void Draw(Job job) { + var canDraw = true; + if(JobRoles != null) + { + var role = RotationUpdater.RightNowRotation?.ClassJob?.GetJobRole(); + if (role.HasValue) + { + canDraw = JobRoles.Contains(role.Value); + } + } + + if (Jobs != null) + { + canDraw |= Jobs.Contains(RotationUpdater.Job); + } + + if (!canDraw) return; DrawMain(job); PrepareGroup(Popup_Key, Command, () => ResetToDefault(job));