Add synth helper progress bars
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using Craftimizer.Plugin.Utils;
|
using Craftimizer.Plugin.Utils;
|
||||||
using Craftimizer.Utils;
|
using Craftimizer.Utils;
|
||||||
|
using Dalamud.Interface;
|
||||||
using Dalamud.Interface.Windowing;
|
using Dalamud.Interface.Windowing;
|
||||||
using FFXIVClientStructs.FFXIV.Client.Game;
|
using FFXIVClientStructs.FFXIV.Client.Game;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
@@ -16,6 +17,8 @@ public sealed unsafe partial class Craft : Window, IDisposable
|
|||||||
| ImGuiWindowFlags.NoFocusOnAppearing
|
| ImGuiWindowFlags.NoFocusOnAppearing
|
||||||
| ImGuiWindowFlags.NoNavFocus;
|
| ImGuiWindowFlags.NoNavFocus;
|
||||||
|
|
||||||
|
public static readonly Vector2 CraftProgressBarSize = new(300, 15);
|
||||||
|
|
||||||
private static Configuration Config => Service.Configuration;
|
private static Configuration Config => Service.Configuration;
|
||||||
|
|
||||||
private static Random Random { get; } = new();
|
private static Random Random { get; } = new();
|
||||||
@@ -40,6 +43,13 @@ public sealed unsafe partial class Craft : Window, IDisposable
|
|||||||
|
|
||||||
ImGui.SameLine(0, 0);
|
ImGui.SameLine(0, 0);
|
||||||
ImGui.Dummy(default);
|
ImGui.Dummy(default);
|
||||||
|
|
||||||
|
ImGuiHelpers.ScaledDummy(5);
|
||||||
|
|
||||||
|
Simulator.DrawAllProgressBars(SolverLatestState, CraftProgressBarSize);
|
||||||
|
|
||||||
|
ImGuiHelpers.ScaledDummy(5);
|
||||||
|
|
||||||
ImGui.BeginDisabled(!(SolverTask?.IsCompleted ?? true));
|
ImGui.BeginDisabled(!(SolverTask?.IsCompleted ?? true));
|
||||||
if (ImGui.Button("Retry"))
|
if (ImGui.Button("Retry"))
|
||||||
QueueSolve(GetNextState()!.Value);
|
QueueSolve(GetNextState()!.Value);
|
||||||
|
|||||||
@@ -118,24 +118,24 @@ public sealed partial class Simulator : Window, IDisposable
|
|||||||
ImGuiUtils.EndGroupPanel();
|
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())
|
if (ImGui.IsItemHovered())
|
||||||
ImGui.SetTooltip($"Progress: {state.Progress} / {state.Input.Recipe.MaxProgress}");
|
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())
|
if (ImGui.IsItemHovered())
|
||||||
ImGui.SetTooltip($"Quality: {state.Quality} / {state.Input.Recipe.MaxQuality}");
|
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())
|
if (ImGui.IsItemHovered())
|
||||||
ImGui.SetTooltip($"Durability: {state.Durability} / {state.Input.Recipe.MaxDurability}");
|
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())
|
if (ImGui.IsItemHovered())
|
||||||
ImGui.SetTooltip($"CP: {state.CP} / {state.Input.Stats.CP}");
|
ImGui.SetTooltip($"CP: {state.CP} / {state.Input.Stats.CP}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void DrawProgressBarTooltip(int progress, int maxProgress, Vector4 color) =>
|
public static void DrawAllProgressTooltips(SimulationState state) =>
|
||||||
DrawProgressBar(progress, maxProgress, TooltipProgressBarSize, color);
|
DrawAllProgressBars(state, TooltipProgressBarSize);
|
||||||
|
|
||||||
private static void DrawProgressBar(int progress, int maxProgress, Vector2 size, Vector4 color, string overlay = "")
|
private static void DrawProgressBar(int progress, int maxProgress, Vector2 size, Vector4 color, string overlay = "")
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user