Minor ui tweaks

This commit is contained in:
Asriel Camora
2023-07-15 23:58:59 +04:00
parent 8417ee4fc5
commit 1cc83ca959
4 changed files with 21 additions and 22 deletions
-1
View File
@@ -2,7 +2,6 @@ using Craftimizer.Simulator;
using Craftimizer.Simulator.Actions; using Craftimizer.Simulator.Actions;
using Craftimizer.Solver.Crafty; using Craftimizer.Solver.Crafty;
using Dalamud.Configuration; using Dalamud.Configuration;
using Dalamud.Logging;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
+3 -5
View File
@@ -146,15 +146,13 @@ internal static class ImGuiUtils
public static unsafe void Hyperlink(string text, string url) public static unsafe void Hyperlink(string text, string url)
{ {
ImGui.TextUnformatted(text); ImGui.TextUnformatted(text);
UnderlineLastItem(*ImGui.GetStyleColorVec4(ImGuiCol.Button));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
{ {
ImGui.SetMouseCursor(ImGuiMouseCursor.Hand); ImGui.SetMouseCursor(ImGuiMouseCursor.Hand);
if (ImGui.IsItemClicked(ImGuiMouseButton.Left)) if (ImGui.IsItemClicked(ImGuiMouseButton.Left))
Process.Start(new ProcessStartInfo { FileName = url, UseShellExecute = true }); 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));
} }
} }
+18 -16
View File
@@ -16,10 +16,11 @@ public class SettingsWindow : Window
SizeConstraints = new WindowSizeConstraints() SizeConstraints = new WindowSizeConstraints()
{ {
MinimumSize = new Vector2(400, 400), MinimumSize = new Vector2(400, 800),
MaximumSize = new Vector2(float.MaxValue, float.MaxValue) MaximumSize = new Vector2(float.MaxValue, float.MaxValue)
}; };
Size = SizeConstraints.Value.MinimumSize; Size = SizeConstraints.Value.MinimumSize;
SizeCondition = ImGuiCond.Appearing;
} }
private static void DrawOption(string label, string tooltip, bool val, Action<bool> setter, ref bool isDirty) private static void DrawOption(string label, string tooltip, bool val, Action<bool> setter, ref bool isDirty)
@@ -108,7 +109,8 @@ public class SettingsWindow : Window
DrawOption( DrawOption(
"Condition randomness", "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, Config.ConditionRandomness,
v => Config.ConditionRandomness = v, v => Config.ConditionRandomness = v,
ref isDirty ref isDirty
@@ -143,7 +145,7 @@ public class SettingsWindow : Window
"The algorithm to use when solving for a macro. Different\n" + "The algorithm to use when solving for a macro. Different\n" +
"algorithms provide different pros and cons for using them.\n" + "algorithms provide different pros and cons for using them.\n" +
"By far, the Stepwise Furcated algorithm provides the best\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; var config = Config.SolverConfig;
@@ -232,16 +234,6 @@ public class SettingsWindow : Window
ref isSolverDirty 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( DrawOption(
"Max Rollout Step Count", "Max Rollout Step Count",
"The maximum number of crafting steps every iteration can consider.\n" + "The maximum number of crafting steps every iteration can consider.\n" +
@@ -252,10 +244,20 @@ public class SettingsWindow : Window
ref isSolverDirty 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.EndGroupPanel();
ImGuiUtils.BeginGroupPanel("Solver Score Weights (Advanced)"); 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); ImGuiHelpers.ScaledDummy(10);
DrawOption( DrawOption(
@@ -317,11 +319,11 @@ public class SettingsWindow : Window
isSolverDirty = true; isSolverDirty = true;
} }
if (ImGui.IsItemHovered()) 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(); ImGuiUtils.EndGroupPanel();
if (ImGui.Button("Reset solver defaults")) if (ImGui.Button("Reset Solver Settings"))
{ {
config = new(); config = new();
isSolverDirty = true; isSolverDirty = true;
+1 -1
View File
@@ -23,7 +23,7 @@ public readonly record struct SolverConfig
public SolverConfig() public SolverConfig()
{ {
Iterations = 300000; Iterations = 100000;
ScoreStorageThreshold = 1f; ScoreStorageThreshold = 1f;
MaxScoreWeightingConstant = 0.1f; MaxScoreWeightingConstant = 0.1f;
ExplorationConstant = 4; ExplorationConstant = 4;