Add macro duration to macro editor
This commit is contained in:
@@ -24,6 +24,7 @@ using Sim = Craftimizer.Simulator.Simulator;
|
||||
using SimNoRandom = Craftimizer.Simulator.SimulatorNoRandom;
|
||||
using Recipe = Lumina.Excel.Sheets.Recipe;
|
||||
using Dalamud.Utility;
|
||||
using Craftimizer.Solver;
|
||||
|
||||
namespace Craftimizer.Windows;
|
||||
|
||||
@@ -1121,15 +1122,29 @@ public sealed class MacroEditor : Window, IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
using (var panel = ImRaii2.GroupPanel("Buffs", -1, out _))
|
||||
using (var barsTable = ImRaii.Table("buffBars", 2, ImGuiTableFlags.SizingStretchSame))
|
||||
{
|
||||
if (barsTable)
|
||||
{
|
||||
ImGui.TableSetupColumn("col1", ImGuiTableColumnFlags.WidthStretch, 3);
|
||||
ImGui.TableSetupColumn("col2", ImGuiTableColumnFlags.WidthStretch, 1);
|
||||
|
||||
var buffIconHeight = ImGui.GetFrameHeight() * 1.75f;
|
||||
var buffDurationShift = buffIconHeight * .2f;
|
||||
var buffHeight = buffIconHeight + ImGui.GetStyle().ItemSpacing.Y + ImGui.GetTextLineHeight() - buffDurationShift;
|
||||
|
||||
var infoHeight = 3 * ImGui.GetTextLineHeightWithSpacing();
|
||||
|
||||
var panelHeight = Math.Max(buffHeight, infoHeight);
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
using (ImRaii2.GroupPanel("Buffs", -1, out _))
|
||||
{
|
||||
using var _font = AxisFont.Push();
|
||||
|
||||
var iconHeight = ImGui.GetFrameHeight() * 1.75f;
|
||||
var durationShift = iconHeight * .2f;
|
||||
|
||||
ImGui.Dummy(new(0, iconHeight + ImGui.GetStyle().ItemSpacing.Y + ImGui.GetTextLineHeight() - durationShift));
|
||||
ImGui.Dummy(new(0, panelHeight));
|
||||
ImGui.SameLine(0, 0);
|
||||
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + (panelHeight - buffHeight) / 2f);
|
||||
|
||||
var effects = State.ActiveEffects;
|
||||
foreach (var effect in Enum.GetValues<EffectType>())
|
||||
@@ -1140,12 +1155,12 @@ public sealed class MacroEditor : Window, IDisposable
|
||||
using (var group = ImRaii.Group())
|
||||
{
|
||||
var icon = effect.GetIcon(effects.GetStrength(effect));
|
||||
var size = new Vector2(iconHeight * (icon.AspectRatio ?? 1), iconHeight);
|
||||
var size = new Vector2(buffIconHeight * (icon.AspectRatio ?? 1), buffIconHeight);
|
||||
|
||||
ImGui.Image(icon.ImGuiHandle, size);
|
||||
if (!effect.IsIndefinite())
|
||||
{
|
||||
ImGui.SetCursorPosY(ImGui.GetCursorPosY() - durationShift);
|
||||
ImGui.SetCursorPosY(ImGui.GetCursorPosY() - buffDurationShift);
|
||||
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + 1);
|
||||
ImGuiUtils.TextCentered($"{effects.GetDuration(effect)}", size.X);
|
||||
}
|
||||
@@ -1159,6 +1174,33 @@ public sealed class MacroEditor : Window, IDisposable
|
||||
ImGui.SameLine();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
using (ImRaii2.GroupPanel("Info", -1, out _))
|
||||
{
|
||||
var actions = Macro.Actions.ToArray();
|
||||
var waitTime = actions.Sum(a => a.Base().MacroWaitTime);
|
||||
var waitTimeOptimal = waitTime - actions.Length * 0.1f;
|
||||
var delineationCount = actions.Count(SolverConfig.SpecialistActions.Contains);
|
||||
|
||||
var height = (delineationCount == 0 ? 2 : 3) * ImGui.GetTextLineHeightWithSpacing();
|
||||
|
||||
ImGui.Dummy(new(0, panelHeight));
|
||||
ImGui.SameLine(0, 0);
|
||||
|
||||
using (ImRaii.Group())
|
||||
{
|
||||
ImGui.SetCursorPosY(ImGui.GetCursorPos().Y + (panelHeight - height) / 2f);
|
||||
ImGuiUtils.TextCentered($"{actions.Length} Step{(actions.Length != 1 ? "s" : string.Empty)}");
|
||||
ImGuiUtils.TextCentered($"{waitTime} sec");
|
||||
if (ImGui.IsItemHovered())
|
||||
ImGuiUtils.Tooltip($"Optimal Time: {waitTimeOptimal:0.#} sec");
|
||||
if (delineationCount != 0)
|
||||
ImGuiUtils.TextCentered($"{delineationCount} Delineation{(delineationCount != 1 ? "s" : string.Empty)}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawMacro()
|
||||
|
||||
Reference in New Issue
Block a user