Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: changed cooldown ui.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Mar 31, 2023
1 parent 0931f48 commit 9ca5f38
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 21 deletions.
1 change: 1 addition & 0 deletions RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
36 changes: 18 additions & 18 deletions RotationSolver/UI/ControlWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -75,6 +79,8 @@ public override void Draw()
ref Service.Config.IsControlWindowLock);
ImGui.EndGroup();

DrawNextAction(gcd, ability, width);

ImGui.NextColumn();

DrawSpecials();
Expand Down Expand Up @@ -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)
Expand All @@ -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);

Expand All @@ -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);
}
Expand All @@ -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));
Expand All @@ -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);

Expand All @@ -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);
}
Expand All @@ -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);
Expand All @@ -491,7 +493,5 @@ static unsafe float DrawNextAction()

ImGui.SameLine();
DrawIAction(next, ability, -1);

return width;
}
}
2 changes: 1 addition & 1 deletion RotationSolver/UI/CooldownWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
9 changes: 7 additions & 2 deletions RotationSolver/UI/RotationConfigWindow_Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 9ca5f38

Please sign in to comment.