From 1cc83ca959157a4e66d1c69136c143469c99bc50 Mon Sep 17 00:00:00 2001 From: Asriel Camora Date: Sat, 15 Jul 2023 23:58:59 +0400 Subject: [PATCH] Minor ui tweaks --- Craftimizer/Configuration.cs | 1 - Craftimizer/ImGuiUtils.cs | 6 ++--- Craftimizer/Windows/SettingsWindow.cs | 34 ++++++++++++++------------- Solver/Crafty/SolverConfig.cs | 2 +- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/Craftimizer/Configuration.cs b/Craftimizer/Configuration.cs index 825acab..bc0c4b4 100644 --- a/Craftimizer/Configuration.cs +++ b/Craftimizer/Configuration.cs @@ -2,7 +2,6 @@ using Craftimizer.Simulator; using Craftimizer.Simulator.Actions; using Craftimizer.Solver.Crafty; using Dalamud.Configuration; -using Dalamud.Logging; using System; using System.Collections.Generic; diff --git a/Craftimizer/ImGuiUtils.cs b/Craftimizer/ImGuiUtils.cs index 70be522..20a8531 100644 --- a/Craftimizer/ImGuiUtils.cs +++ b/Craftimizer/ImGuiUtils.cs @@ -146,15 +146,13 @@ internal static class ImGuiUtils public static unsafe void Hyperlink(string text, string url) { ImGui.TextUnformatted(text); + UnderlineLastItem(*ImGui.GetStyleColorVec4(ImGuiCol.Button)); if (ImGui.IsItemHovered()) { ImGui.SetMouseCursor(ImGuiMouseCursor.Hand); if (ImGui.IsItemClicked(ImGuiMouseButton.Left)) Process.Start(new ProcessStartInfo { FileName = url, UseShellExecute = true }); - UnderlineLastItem(*ImGui.GetStyleColorVec4(ImGuiCol.Button)); - ImGui.SetTooltip("Open in browser"); + ImGui.SetTooltip("Open in Browser"); } - else - UnderlineLastItem(*ImGui.GetStyleColorVec4(ImGuiCol.Text)); } } diff --git a/Craftimizer/Windows/SettingsWindow.cs b/Craftimizer/Windows/SettingsWindow.cs index b8e7672..d7e2a04 100644 --- a/Craftimizer/Windows/SettingsWindow.cs +++ b/Craftimizer/Windows/SettingsWindow.cs @@ -16,10 +16,11 @@ public class SettingsWindow : Window SizeConstraints = new WindowSizeConstraints() { - MinimumSize = new Vector2(400, 400), + MinimumSize = new Vector2(400, 800), MaximumSize = new Vector2(float.MaxValue, float.MaxValue) }; Size = SizeConstraints.Value.MinimumSize; + SizeCondition = ImGuiCond.Appearing; } private static void DrawOption(string label, string tooltip, bool val, Action setter, ref bool isDirty) @@ -108,7 +109,8 @@ public class SettingsWindow : Window DrawOption( "Condition randomness", - "Allows the simulator condition to fluctuate randomly like a real craft.\nTurns off when generating a macro.", + "Allows the simulator condition to fluctuate randomly like a real craft.\n" + + "Turns off when generating a macro.", Config.ConditionRandomness, v => Config.ConditionRandomness = v, ref isDirty @@ -143,7 +145,7 @@ public class SettingsWindow : Window "The algorithm to use when solving for a macro. Different\n" + "algorithms provide different pros and cons for using them.\n" + "By far, the Stepwise Furcated algorithm provides the best\n" + - "results as soon as possible." + "results, especially for very difficult crafts." ); var config = Config.SolverConfig; @@ -232,16 +234,6 @@ public class SettingsWindow : Window ref isSolverDirty ); - DrawOption( - "Strict Actions", - "When finding the next possible actions to execute, use a heuristic\n" + - "to restrict which actions to attempt taking. This results in a much\n" + - "better macro at the cost of not finding an extremely creative one.", - config.StrictActions, - v => config = config with { StrictActions = v }, - ref isSolverDirty - ); - DrawOption( "Max Rollout Step Count", "The maximum number of crafting steps every iteration can consider.\n" + @@ -252,10 +244,20 @@ public class SettingsWindow : Window ref isSolverDirty ); + DrawOption( + "Strict Actions", + "When finding the next possible actions to execute, use a heuristic\n" + + "to restrict which actions to attempt taking. This results in a much\n" + + "better macro at the cost of not finding an extremely creative one.", + config.StrictActions, + v => config = config with { StrictActions = v }, + ref isSolverDirty + ); + ImGuiUtils.EndGroupPanel(); ImGuiUtils.BeginGroupPanel("Solver Score Weights (Advanced)"); - ImGui.TextWrapped("All values must add up to 1. Otherwise, the Score Storage Threshold must be changed."); + ImGui.TextWrapped("All values should add up to 1. Otherwise, the Score Storage Threshold must be changed."); ImGuiHelpers.ScaledDummy(10); DrawOption( @@ -317,11 +319,11 @@ public class SettingsWindow : Window isSolverDirty = true; } if (ImGui.IsItemHovered()) - ImGui.SetTooltip("Normalize all weights to add up to 1."); + ImGui.SetTooltip("Normalize all weights to add up to 1"); ImGuiUtils.EndGroupPanel(); - if (ImGui.Button("Reset solver defaults")) + if (ImGui.Button("Reset Solver Settings")) { config = new(); isSolverDirty = true; diff --git a/Solver/Crafty/SolverConfig.cs b/Solver/Crafty/SolverConfig.cs index 17a2d9b..0dea5ab 100644 --- a/Solver/Crafty/SolverConfig.cs +++ b/Solver/Crafty/SolverConfig.cs @@ -23,7 +23,7 @@ public readonly record struct SolverConfig public SolverConfig() { - Iterations = 300000; + Iterations = 100000; ScoreStorageThreshold = 1f; MaxScoreWeightingConstant = 0.1f; ExplorationConstant = 4;