Extra checks for SolverRunning in macro editor

This commit is contained in:
Asriel Camora
2024-06-22 15:33:34 -07:00
parent 8035e68ee0
commit 4204391c4d
2 changed files with 22 additions and 19 deletions
+5 -5
View File
@@ -3,7 +3,7 @@
"Name": "Craftimizer",
"Punchline": "Simulate crafts, create computer-assisted macros, and get mid-craft suggestions from the comfort of your own game!",
"Description": "Allows you to generate macros and simulate all sorts of crafts without having to open another app. Open your crafting log to get started!",
"RepoUrl": "https://github.com/WorkingRobot/craftimizer",
"RepoUrl": "https://github.com/WorkingRobot/Craftimizer",
"InternalName": "Craftimizer",
"ApplicableVersion": "any",
"Tags": [
@@ -21,10 +21,10 @@
"CategoryTags": [
"Jobs"
],
"IconUrl": "https://git.camora.dev/asriel/craftimizer/raw/branch/main/icon.png",
"IconUrl": "https://git.camora.dev/asriel/Craftimizer/raw/branch/main/icon.png",
"ImageUrls": [
"https://git.camora.dev/asriel/craftimizer/raw/branch/main/Images/RecipeNote.png",
"https://git.camora.dev/asriel/craftimizer/raw/branch/main/Images/SynthHelper.png",
"https://git.camora.dev/asriel/craftimizer/raw/branch/main/Images/MacroEditor.png",
"https://git.camora.dev/asriel/Craftimizer/raw/branch/main/Images/RecipeNote.png",
"https://git.camora.dev/asriel/Craftimizer/raw/branch/main/Images/SynthHelper.png",
"https://git.camora.dev/asriel/Craftimizer/raw/branch/main/Images/MacroEditor.png",
]
}
+17 -14
View File
@@ -953,7 +953,7 @@ public sealed class MacroEditor : Window, IDisposable
{
var actionBase = actions[i].Base();
var canUse = actionBase.CanUse(sim);
if (ImGui.ImageButton(actions[i].GetIcon(RecipeData!.ClassJob).ImGuiHandle, new(imageSize), default, Vector2.One, 0, default, !canUse ? new(1, 1, 1, ImGui.GetStyle().DisabledAlpha) : Vector4.One))
if (ImGui.ImageButton(actions[i].GetIcon(RecipeData!.ClassJob).ImGuiHandle, new(imageSize), default, Vector2.One, 0, default, !canUse ? new(1, 1, 1, ImGui.GetStyle().DisabledAlpha) : Vector4.One) && !SolverRunning)
AddStep(actions[i]);
if (!canUse &&
(CharacterStats.Level < actionBase.Level ||
@@ -1223,23 +1223,26 @@ public sealed class MacroEditor : Window, IDisposable
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
ImGuiUtils.Tooltip($"{action.GetName(RecipeData!.ClassJob)}\n{actionBase.GetTooltip(CreateSim(lastState), true)}");
using var _padding = ImRaii.PushStyle(ImGuiStyleVar.WindowPadding, Vector2.Zero);
using (var _source = ImRaii.DragDropSource())
if (!SolverRunning)
{
if (_source)
using var _padding = ImRaii.PushStyle(ImGuiStyleVar.WindowPadding, Vector2.Zero);
using (var _source = ImRaii.DragDropSource())
{
ImGuiExtras.SetDragDropPayload("macroAction", i);
ImGui.ImageButton(action.GetIcon(RecipeData!.ClassJob).ImGuiHandle, new(imageSize));
if (_source)
{
ImGuiExtras.SetDragDropPayload("macroAction", i);
ImGui.ImageButton(action.GetIcon(RecipeData!.ClassJob).ImGuiHandle, new(imageSize));
}
}
}
using (var _target = ImRaii.DragDropTarget())
{
if (_target)
using (var _target = ImRaii.DragDropTarget())
{
if (ImGuiExtras.AcceptDragDropPayload("macroAction", out int j))
Macro.Move(j, i);
else if (ImGuiExtras.AcceptDragDropPayload("macroActionInsert", out ActionType newAction))
Macro.Insert(i, newAction);
if (_target)
{
if (ImGuiExtras.AcceptDragDropPayload("macroAction", out int j))
Macro.Move(j, i);
else if (ImGuiExtras.AcceptDragDropPayload("macroActionInsert", out ActionType newAction))
Macro.Insert(i, newAction);
}
}
}
lastState = state;