Add synth helper progress bars

This commit is contained in:
Asriel Camora
2023-07-21 21:14:57 +04:00
parent c471d3edf8
commit bac96201d2
2 changed files with 17 additions and 7 deletions
+10
View File
@@ -1,5 +1,6 @@
using Craftimizer.Plugin.Utils;
using Craftimizer.Utils;
using Dalamud.Interface;
using Dalamud.Interface.Windowing;
using FFXIVClientStructs.FFXIV.Client.Game;
using ImGuiNET;
@@ -16,6 +17,8 @@ public sealed unsafe partial class Craft : Window, IDisposable
| ImGuiWindowFlags.NoFocusOnAppearing
| ImGuiWindowFlags.NoNavFocus;
public static readonly Vector2 CraftProgressBarSize = new(300, 15);
private static Configuration Config => Service.Configuration;
private static Random Random { get; } = new();
@@ -40,6 +43,13 @@ public sealed unsafe partial class Craft : Window, IDisposable
ImGui.SameLine(0, 0);
ImGui.Dummy(default);
ImGuiHelpers.ScaledDummy(5);
Simulator.DrawAllProgressBars(SolverLatestState, CraftProgressBarSize);
ImGuiHelpers.ScaledDummy(5);
ImGui.BeginDisabled(!(SolverTask?.IsCompleted ?? true));
if (ImGui.Button("Retry"))
QueueSolve(GetNextState()!.Value);
+7 -7
View File
@@ -118,24 +118,24 @@ public sealed partial class Simulator : Window, IDisposable
ImGuiUtils.EndGroupPanel();
}
public static void DrawAllProgressTooltips(SimulationState state)
public static void DrawAllProgressBars(SimulationState state, Vector2 progressBarSize)
{
DrawProgressBarTooltip(state.Progress, state.Input.Recipe.MaxProgress, ProgressColor);
DrawProgressBar(state.Progress, state.Input.Recipe.MaxProgress, progressBarSize, ProgressColor);
if (ImGui.IsItemHovered())
ImGui.SetTooltip($"Progress: {state.Progress} / {state.Input.Recipe.MaxProgress}");
DrawProgressBarTooltip(state.Quality, state.Input.Recipe.MaxQuality, QualityColor);
DrawProgressBar(state.Quality, state.Input.Recipe.MaxQuality, progressBarSize, QualityColor);
if (ImGui.IsItemHovered())
ImGui.SetTooltip($"Quality: {state.Quality} / {state.Input.Recipe.MaxQuality}");
DrawProgressBarTooltip(state.Durability, state.Input.Recipe.MaxDurability, DurabilityColor);
DrawProgressBar(state.Durability, state.Input.Recipe.MaxDurability, progressBarSize, DurabilityColor);
if (ImGui.IsItemHovered())
ImGui.SetTooltip($"Durability: {state.Durability} / {state.Input.Recipe.MaxDurability}");
DrawProgressBarTooltip(state.CP, state.Input.Stats.CP, CPColor);
DrawProgressBar(state.CP, state.Input.Stats.CP, progressBarSize, CPColor);
if (ImGui.IsItemHovered())
ImGui.SetTooltip($"CP: {state.CP} / {state.Input.Stats.CP}");
}
private static void DrawProgressBarTooltip(int progress, int maxProgress, Vector4 color) =>
DrawProgressBar(progress, maxProgress, TooltipProgressBarSize, color);
public static void DrawAllProgressTooltips(SimulationState state) =>
DrawAllProgressBars(state, TooltipProgressBarSize);
private static void DrawProgressBar(int progress, int maxProgress, Vector2 size, Vector4 color, string overlay = "")
{