Add tooltip for when going above 100% iterations

This commit is contained in:
Asriel Camora
2024-06-19 18:43:25 -07:00
parent 9fc412365e
commit e3e7329fe3
4 changed files with 19 additions and 11 deletions
+1 -1
View File
@@ -137,7 +137,7 @@ public partial class Configuration : IPluginConfiguration
} }
[JsonSerializable(typeof(Configuration))] [JsonSerializable(typeof(Configuration))]
internal partial class JsonContext : JsonSerializerContext { } internal sealed partial class JsonContext : JsonSerializerContext { }
public void Save() public void Save()
{ {
+4 -4
View File
@@ -1253,17 +1253,17 @@ public sealed class MacroEditor : Window, IDisposable
{ {
var percentWidth = ImGui.CalcTextSize("100%").X; var percentWidth = ImGui.CalcTextSize("100%").X;
var progressWidth = availSpace - percentWidth - spacing; var progressWidth = availSpace - percentWidth - spacing;
var fraction = Math.Clamp((float)solver.ProgressValue / solver.ProgressMax, 0, 1); var fraction = (float)solver.ProgressValue / solver.ProgressMax;
var progressColors = Colors.GetSolverProgressColors(solver.ProgressStage); var progressColors = Colors.GetSolverProgressColors(solver.ProgressStage);
using (ImRaii.PushColor(ImGuiCol.FrameBg, progressColors.Background)) using (ImRaii.PushColor(ImGuiCol.FrameBg, progressColors.Background))
using (ImRaii.PushColor(ImGuiCol.PlotHistogram, progressColors.Foreground)) using (ImRaii.PushColor(ImGuiCol.PlotHistogram, progressColors.Foreground))
ImGui.ProgressBar(fraction, new(progressWidth, ImGui.GetFrameHeight()), string.Empty); ImGui.ProgressBar(Math.Clamp(fraction, 0, 1), new(progressWidth, ImGui.GetFrameHeight()), string.Empty);
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGuiUtils.Tooltip($"Solver Progress: {solver.ProgressValue} / {solver.ProgressMax}"); RecipeNote.DrawSolverTooltip(solver);
ImGui.SameLine(0, spacing); ImGui.SameLine(0, spacing);
ImGui.AlignTextToFramePadding(); ImGui.AlignTextToFramePadding();
ImGuiUtils.TextRight($"{fraction * 100:0}%", percentWidth); ImGuiUtils.TextRight($"{fraction * 100:N0}%", percentWidth);
} }
DrawMacroActions(availSpace); DrawMacroActions(availSpace);
} }
+9 -1
View File
@@ -735,6 +735,14 @@ public sealed unsafe class RecipeNote : Window, IDisposable
public Action<IEnumerable<ActionType>>? MacroEditorSetter; public Action<IEnumerable<ActionType>>? MacroEditorSetter;
} }
public static void DrawSolverTooltip(Solver.Solver solver)
{
var tooltip = $"Solver Progress: {solver.ProgressValue:N0} / {solver.ProgressMax:N0}";
if (solver.ProgressValue > solver.ProgressMax)
tooltip += $"\n\nThis is taking longer than expected. Check to see if your gear stats are good and the solver settings are adequate.";
ImGuiUtils.TooltipWrapped(tooltip);
}
private void DrawMacro(in MacroTaskState state, float panelWidth) private void DrawMacro(in MacroTaskState state, float panelWidth)
{ {
var panelTitle = state.Type switch var panelTitle = state.Type switch
@@ -812,7 +820,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable
ImGui.ColorConvertFloat4ToU32(progressColors.Background), ImGui.ColorConvertFloat4ToU32(progressColors.Background),
ImGui.ColorConvertFloat4ToU32(progressColors.Foreground)); ImGui.ColorConvertFloat4ToU32(progressColors.Foreground));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGuiUtils.Tooltip($"Solver Progress: {solver.ProgressValue} / {solver.ProgressMax}"); DrawSolverTooltip(solver);
ImGui.SameLine(0, spacing); ImGui.SameLine(0, spacing);
+4 -4
View File
@@ -411,17 +411,17 @@ public sealed unsafe class SynthHelper : Window, IDisposable
var percentWidth = ImGui.CalcTextSize("100%").X; var percentWidth = ImGui.CalcTextSize("100%").X;
var progressWidth = availSpace - percentWidth - spacing; var progressWidth = availSpace - percentWidth - spacing;
var fraction = Math.Clamp((float)solver.ProgressValue / solver.ProgressMax, 0, 1); var fraction = (float)solver.ProgressValue / solver.ProgressMax;
var progressColors = Colors.GetSolverProgressColors(solver.ProgressStage); var progressColors = Colors.GetSolverProgressColors(solver.ProgressStage);
using (ImRaii.PushColor(ImGuiCol.FrameBg, progressColors.Background)) using (ImRaii.PushColor(ImGuiCol.FrameBg, progressColors.Background))
using (ImRaii.PushColor(ImGuiCol.PlotHistogram, progressColors.Foreground)) using (ImRaii.PushColor(ImGuiCol.PlotHistogram, progressColors.Foreground))
ImGui.ProgressBar(fraction, new(progressWidth, ImGui.GetFrameHeight()), string.Empty); ImGui.ProgressBar(Math.Clamp(fraction, 0, 1), new(progressWidth, ImGui.GetFrameHeight()), string.Empty);
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGuiUtils.Tooltip($"Solver Progress: {solver.ProgressValue} / {solver.ProgressMax}"); RecipeNote.DrawSolverTooltip(solver);
ImGui.SameLine(0, spacing); ImGui.SameLine(0, spacing);
ImGui.AlignTextToFramePadding(); ImGui.AlignTextToFramePadding();
ImGuiUtils.TextRight($"{fraction * 100:0}%", percentWidth); ImGuiUtils.TextRight($"{fraction * 100:N0}%", percentWidth);
} }
private void DrawMacroActions() private void DrawMacroActions()