From 9ca5f38d43b4540f6f42852c501e8f1b64914c9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E6=B0=B4?= <1123993881@qq.com> Date: Fri, 31 Mar 2023 20:52:13 +0800 Subject: [PATCH] fix: changed cooldown ui. --- RotationSolver/Localization/Localization.json | 1 + RotationSolver/UI/ControlWindow.cs | 36 +++++++++---------- RotationSolver/UI/CooldownWindow.cs | 2 +- .../UI/RotationConfigWindow_Debug.cs | 9 +++-- 4 files changed, 27 insertions(+), 21 deletions(-) diff --git a/RotationSolver/Localization/Localization.json b/RotationSolver/Localization/Localization.json index 60d6f4ceb..51076b42d 100644 --- a/RotationSolver/Localization/Localization.json +++ b/RotationSolver/Localization/Localization.json @@ -180,6 +180,7 @@ "ConfigWindow_Control_ShowCooldownWindow": "Show Cooldown Window", "ConfigWindow_Control_IsWindowLock": "Lock", "ConfigWindow_Control_ShowItemsCooldown": "Show Items' Cooldown", + "ConfigWindow_Control_UseOriginalCooldown": "Show Original Cooldown", "ConfigWindow_Control_CooldownActionOneLine": "The count of cooldown actions in one line.", "ConfigWindow_Control_BackgroundColor": "Control Window's Background", "ConfigWindow_Control_InfoWindowBg": "Info Window's Background", diff --git a/RotationSolver/UI/ControlWindow.cs b/RotationSolver/UI/ControlWindow.cs index 32749c0c9..6f406290e 100644 --- a/RotationSolver/UI/ControlWindow.cs +++ b/RotationSolver/UI/ControlWindow.cs @@ -56,7 +56,11 @@ public override void PostDraw() public override void Draw() { ImGui.Columns(2, "Control Bolder", false); - ImGui.SetColumnWidth(0, DrawNextAction() + ImGui.GetStyle().ColumnsMinSpacing * 2); + var gcd = Service.Config.ControlWindowGCDSize * Service.Config.ControlWindowNextSizeRatio; + var ability = Service.Config.ControlWindow0GCDSize * Service.Config.ControlWindowNextSizeRatio; + var width = gcd + ability + ImGui.GetStyle().ItemSpacing.X; + + ImGui.SetColumnWidth(0, width + ImGui.GetStyle().ColumnsMinSpacing * 2); DrawCommandAction(61751, StateCommandType.Manual, ImGuiColors.DPSRed); @@ -75,6 +79,8 @@ public override void Draw() ref Service.Config.IsControlWindowLock); ImGui.EndGroup(); + DrawNextAction(gcd, ability, width); + ImGui.NextColumn(); DrawSpecials(); @@ -395,7 +401,7 @@ static void DrawIAction(nint handle, string id, float width, StateCommandType co internal static void DrawIAction(IAction action, float width, float percent) { - DrawIAction(GetTexture(action).ImGuiHandle, width, percent); + DrawIAction(GetTexture(action).ImGuiHandle, width, action == null ? -1 : percent); } static void DrawIAction(nint handle, float width, float percent) @@ -412,9 +418,9 @@ static void DrawIAction(nint handle, float width, float percent) if(cover != null) { - var pixPerUnit = width / 80; + var pixPerUnit = width / 82; - ImGui.SetCursorPos(cursor - new Vector2(pixPerUnit * 4, pixPerUnit * 6)); + ImGui.SetCursorPos(cursor - new Vector2(pixPerUnit * 3, pixPerUnit * 0)); var P = (int)(percent * 81); @@ -423,7 +429,7 @@ static void DrawIAction(nint handle, float width, float percent) var start = new Vector2(P % 9 * step.X, P / 9 * step.Y); //Out Size is 88, 96 - //Inner Size is 80, 80 + //Inner Size is 82, 82 ImGui.Image(cover.ImGuiHandle, new Vector2(pixPerUnit * 88, pixPerUnit * 96), start, start + step); } @@ -434,12 +440,12 @@ static void DrawIAction(nint handle, float width, float percent) if (cover != null) { - var pixPerUnit = width / 80; + var pixPerUnit = width / 82; - ImGui.SetCursorPos(cursor - new Vector2(pixPerUnit * 4, pixPerUnit * 6)); + ImGui.SetCursorPos(cursor - new Vector2(pixPerUnit * 3, pixPerUnit * 4)); //Out Size is 88, 96 - //Inner Size is 80, 80 + //Inner Size is 82, 82 ImGui.Image(cover.ImGuiHandle, new Vector2(pixPerUnit * 88, pixPerUnit * 96), new Vector2(4f / cover.Width, 0f / cover.Height), new Vector2(92f / cover.Width, 96f / cover.Height)); @@ -452,9 +458,9 @@ static void DrawIAction(nint handle, float width, float percent) if (cover != null) { - var pixPerUnit = width / 80; + var pixPerUnit = width / 82; - ImGui.SetCursorPos(cursor - new Vector2(pixPerUnit * 4, pixPerUnit * 0)); + ImGui.SetCursorPos(cursor - new Vector2(pixPerUnit * 3, pixPerUnit * 0)); var P = (int)(percent % 1 * 81); @@ -463,7 +469,7 @@ static void DrawIAction(nint handle, float width, float percent) var start = new Vector2((P % 9 + 9) * step.X, P / 9 * step.Y); //Out Size is 88, 96 - //Inner Size is 80, 80 + //Inner Size is 82, 82 ImGui.Image(cover.ImGuiHandle, new Vector2(pixPerUnit * 88, pixPerUnit * 96), start, start + step); } @@ -473,12 +479,8 @@ static void DrawIAction(nint handle, float width, float percent) ImGui.EndGroup(); } - static unsafe float DrawNextAction() + static unsafe void DrawNextAction(float gcd, float ability, float width) { - var gcd = Service.Config.ControlWindowGCDSize * Service.Config.ControlWindowNextSizeRatio; - var ability = Service.Config.ControlWindow0GCDSize * Service.Config.ControlWindowNextSizeRatio; - var width = gcd + ability + ImGui.GetStyle().ItemSpacing.X; - var str = "Next Action"; ImGui.SetCursorPosX(ImGui.GetCursorPosX() + width / 2 - ImGui.CalcTextSize(str).X / 2); ImGui.TextColored(ImGuiColors.DalamudYellow, str); @@ -491,7 +493,5 @@ static unsafe float DrawNextAction() ImGui.SameLine(); DrawIAction(next, ability, -1); - - return width; } } diff --git a/RotationSolver/UI/CooldownWindow.cs b/RotationSolver/UI/CooldownWindow.cs index b154c6965..e568f318d 100644 --- a/RotationSolver/UI/CooldownWindow.cs +++ b/RotationSolver/UI/CooldownWindow.cs @@ -61,7 +61,7 @@ private static void DrawActionCooldown(IAction act) var r = -1f; if (Service.Config.UseOriginalCooldown) { - r = !act.EnoughLevel ? 0: recast == 0 ? 1 : elapsed / recast; + r = !act.EnoughLevel ? 0: recast == 0 || !act.IsCoolingDown ? 1 : elapsed / recast; } ControlWindow.DrawIAction(act, width, r); var size = ImGui.GetItemRectSize(); diff --git a/RotationSolver/UI/RotationConfigWindow_Debug.cs b/RotationSolver/UI/RotationConfigWindow_Debug.cs index 8eb825d78..1847501e5 100644 --- a/RotationSolver/UI/RotationConfigWindow_Debug.cs +++ b/RotationSolver/UI/RotationConfigWindow_Debug.cs @@ -5,6 +5,7 @@ using RotationSolver.Basic; using RotationSolver.Basic.Data; using RotationSolver.Basic.Helpers; +using RotationSolver.Rotations.CustomRotation; using RotationSolver.Updaters; using System.Numerics; @@ -144,8 +145,12 @@ private void DrawCDEX() private void DrawIcon() { - //ImGui.Image(IconSet.GetTexture(60094).ImGuiHandle, new Vector2(24, 24)); - ImGui.Image(IconSet.GetTexture(16).ImGuiHandle, new Vector2(24, 24)); + //ControlWindow.DrawIAction(CustomRotation.Addle, 256, 1.6f); + for (int i = 0; i <= 200; i++) + { + if (i % 10 != 0) ImGui.SameLine(); + ControlWindow.DrawIAction(CustomRotation.Addle, 48, i / 100f); + } } private static void DrawAction(ActionID id, string type)