muffin v7.5.0
This commit is contained in:
parent
afafd5e377
commit
a6481e7b9a
67 changed files with 4281 additions and 2372 deletions
|
|
@ -87,23 +87,32 @@ internal sealed class SavedPresetsComponent
|
|||
|
||||
public void Draw()
|
||||
{
|
||||
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
|
||||
ImGui.TextWrapped("Save your current priority queue as a preset for quick access later. Saved presets are stored in your configuration and persist between sessions.");
|
||||
ImGui.Spacing();
|
||||
DrawSaveSection();
|
||||
ImGui.Spacing();
|
||||
using (ImRaii.IEndObject endObject = ImRaii.Child("SavedPresetsList", new Vector2(-1f, -27f), border: true))
|
||||
ChildDisposable val = ImRaii.Child((ImU8String)"SavedPresetsList", new Vector2(-1f, -27f), true);
|
||||
try
|
||||
{
|
||||
if (endObject)
|
||||
if (ChildDisposable.op_Implicit(val))
|
||||
{
|
||||
DrawSavedPresets();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
((ChildDisposable)(ref val)).Dispose();
|
||||
}
|
||||
DrawBottomButtons();
|
||||
}
|
||||
|
||||
private void DrawSaveSection()
|
||||
{
|
||||
int count = _questController.ManualPriorityQuests.Count;
|
||||
DisabledDisposable val;
|
||||
if (_showSaveDialog)
|
||||
{
|
||||
ImGui.Text("Save Current Priority Queue as Preset:");
|
||||
|
|
@ -113,13 +122,18 @@ internal sealed class SavedPresetsComponent
|
|||
ImGui.SetNextItemWidth(250f);
|
||||
ImGui.InputTextWithHint("##PresetDescription", "Description (optional)...", ref _newPresetDescription, 256);
|
||||
ImGui.SameLine();
|
||||
using (ImRaii.Disabled(string.IsNullOrWhiteSpace(_newPresetName) || count == 0))
|
||||
val = ImRaii.Disabled(string.IsNullOrWhiteSpace(_newPresetName) || count == 0);
|
||||
try
|
||||
{
|
||||
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Save, "Save"))
|
||||
{
|
||||
SaveCurrentPreset();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val)?.Dispose();
|
||||
}
|
||||
ImGui.SameLine();
|
||||
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Times, "Cancel"))
|
||||
{
|
||||
|
|
@ -133,13 +147,18 @@ internal sealed class SavedPresetsComponent
|
|||
}
|
||||
return;
|
||||
}
|
||||
using (ImRaii.Disabled(count == 0))
|
||||
val = ImRaii.Disabled(count == 0);
|
||||
try
|
||||
{
|
||||
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Plus, $"Save Current Queue ({count} quests)"))
|
||||
{
|
||||
_showSaveDialog = true;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val)?.Dispose();
|
||||
}
|
||||
if (count == 0 && ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
|
||||
{
|
||||
ImGui.SetTooltip("Add quests to the priority queue first to save them as a preset.");
|
||||
|
|
@ -173,7 +192,8 @@ internal sealed class SavedPresetsComponent
|
|||
|
||||
private void DrawPresetEntry(string key, Configuration.SavedQuestPreset preset)
|
||||
{
|
||||
using (ImRaii.PushId(key))
|
||||
IdDisposable val = ImRaii.PushId((ImU8String)key, true);
|
||||
try
|
||||
{
|
||||
List<ElementId> availableQuests = GetAvailableQuests(preset.QuestIds);
|
||||
List<ElementId> completedQuests = GetCompletedQuests(preset.QuestIds);
|
||||
|
|
@ -204,8 +224,10 @@ internal sealed class SavedPresetsComponent
|
|||
if (ImGui.CollapsingHeader(label, flag ? ImGuiTreeNodeFlags.DefaultOpen : ImGuiTreeNodeFlags.None))
|
||||
{
|
||||
_expandedPreset = key;
|
||||
using (ImRaii.PushIndent())
|
||||
IndentDisposable val2 = ImRaii.PushIndent(1, true);
|
||||
try
|
||||
{
|
||||
DisabledDisposable val3;
|
||||
if (_renamingPresetKey == key)
|
||||
{
|
||||
ImGui.Text("Name:");
|
||||
|
|
@ -216,13 +238,18 @@ internal sealed class SavedPresetsComponent
|
|||
ImGui.SameLine();
|
||||
ImGui.SetNextItemWidth(300f);
|
||||
ImGui.InputTextWithHint("##EditDescription", "Description (optional)...", ref _renamePresetDescription, 256);
|
||||
using (ImRaii.Disabled(string.IsNullOrWhiteSpace(_renamePresetName)))
|
||||
val3 = ImRaii.Disabled(string.IsNullOrWhiteSpace(_renamePresetName));
|
||||
try
|
||||
{
|
||||
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Check, "Save Changes"))
|
||||
{
|
||||
RenamePreset(key, _renamePresetName, _renamePresetDescription);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val3)?.Dispose();
|
||||
}
|
||||
ImGui.SameLine();
|
||||
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Times, "Cancel"))
|
||||
{
|
||||
|
|
@ -246,13 +273,18 @@ internal sealed class SavedPresetsComponent
|
|||
ImGui.TextColored(in col, text2);
|
||||
}
|
||||
ImGui.Spacing();
|
||||
using (ImRaii.Disabled(availableQuests.Count == 0))
|
||||
val3 = ImRaii.Disabled(availableQuests.Count == 0);
|
||||
try
|
||||
{
|
||||
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Plus, $"Add Available ({availableQuests.Count})"))
|
||||
{
|
||||
AddPresetToPriority(availableQuests);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val3)?.Dispose();
|
||||
}
|
||||
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
|
||||
{
|
||||
if (availableQuests.Count == 0)
|
||||
|
|
@ -269,13 +301,18 @@ internal sealed class SavedPresetsComponent
|
|||
}
|
||||
}
|
||||
ImGui.SameLine();
|
||||
using (ImRaii.Disabled(alreadyPriorityQuests.Count == 0))
|
||||
val3 = ImRaii.Disabled(alreadyPriorityQuests.Count == 0);
|
||||
try
|
||||
{
|
||||
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Minus, $"Remove from Priority ({alreadyPriorityQuests.Count})"))
|
||||
{
|
||||
RemovePresetFromPriority(alreadyPriorityQuests);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val3)?.Dispose();
|
||||
}
|
||||
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
|
||||
{
|
||||
if (alreadyPriorityQuests.Count == 0)
|
||||
|
|
@ -300,7 +337,8 @@ internal sealed class SavedPresetsComponent
|
|||
ImGui.SetTooltip("Export this preset to clipboard for sharing.");
|
||||
}
|
||||
ImGui.SameLine();
|
||||
using (ImRaii.Disabled(_renamingPresetKey != null))
|
||||
val3 = ImRaii.Disabled(_renamingPresetKey != null);
|
||||
try
|
||||
{
|
||||
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Pen, "Edit"))
|
||||
{
|
||||
|
|
@ -309,19 +347,28 @@ internal sealed class SavedPresetsComponent
|
|||
_renamePresetDescription = preset.Description;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val3)?.Dispose();
|
||||
}
|
||||
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
|
||||
{
|
||||
ImGui.SetTooltip("Edit preset name and description.");
|
||||
}
|
||||
ImGui.SameLine();
|
||||
int count = _questController.ManualPriorityQuests.Count;
|
||||
using (ImRaii.Disabled(count == 0))
|
||||
val3 = ImRaii.Disabled(count == 0);
|
||||
try
|
||||
{
|
||||
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Sync, "Update"))
|
||||
{
|
||||
UpdatePresetQuests(key, preset);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val3)?.Dispose();
|
||||
}
|
||||
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
|
||||
{
|
||||
if (count == 0)
|
||||
|
|
@ -338,13 +385,18 @@ internal sealed class SavedPresetsComponent
|
|||
}
|
||||
}
|
||||
ImGui.SameLine();
|
||||
using (ImRaii.Disabled(!ImGui.IsKeyDown(ImGuiKey.ModCtrl)))
|
||||
val3 = ImRaii.Disabled(!ImGui.IsKeyDown(ImGuiKey.ModCtrl));
|
||||
try
|
||||
{
|
||||
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Trash, "Delete"))
|
||||
{
|
||||
_presetToDelete = key;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val3)?.Dispose();
|
||||
}
|
||||
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
|
||||
{
|
||||
ImGui.SetTooltip("Hold CTRL to delete this preset.");
|
||||
|
|
@ -378,6 +430,10 @@ internal sealed class SavedPresetsComponent
|
|||
}
|
||||
ImGui.Spacing();
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val2)?.Dispose();
|
||||
}
|
||||
}
|
||||
else if (_expandedPreset == key)
|
||||
{
|
||||
|
|
@ -390,49 +446,69 @@ internal sealed class SavedPresetsComponent
|
|||
ImGui.EndTooltip();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val)?.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawBottomButtons()
|
||||
{
|
||||
PresetExportData presetExportData = ParseClipboardPreset();
|
||||
List<PresetExportData> list = ParseClipboardAllPresets();
|
||||
using (ImRaii.Disabled(presetExportData == null))
|
||||
DisabledDisposable val = ImRaii.Disabled(presetExportData == null);
|
||||
try
|
||||
{
|
||||
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Download, "Import Preset") && presetExportData != null)
|
||||
{
|
||||
ImportPresetFromClipboard(presetExportData);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val)?.Dispose();
|
||||
}
|
||||
if (presetExportData == null && ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
|
||||
{
|
||||
ImGui.SetTooltip("Copy a valid preset string to clipboard first.");
|
||||
}
|
||||
ImGui.SameLine();
|
||||
using (ImRaii.Disabled(list == null || list.Count == 0))
|
||||
val = ImRaii.Disabled(list == null || list.Count == 0);
|
||||
try
|
||||
{
|
||||
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.FileImport, "Import All" + ((list != null && list.Count > 0) ? $" ({list.Count})" : "")) && list != null)
|
||||
{
|
||||
ImportAllPresetsFromClipboard(list);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val)?.Dispose();
|
||||
}
|
||||
if ((list == null || list.Count == 0) && ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
|
||||
{
|
||||
ImGui.SetTooltip("Copy a valid 'all presets' export string to clipboard first.");
|
||||
}
|
||||
ImGui.SameLine();
|
||||
using (ImRaii.Disabled(_configuration.General.SavedPresets.Count == 0))
|
||||
val = ImRaii.Disabled(_configuration.General.SavedPresets.Count == 0);
|
||||
try
|
||||
{
|
||||
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.FileExport, $"Export All ({_configuration.General.SavedPresets.Count})"))
|
||||
{
|
||||
ExportAllPresetsToClipboard();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val)?.Dispose();
|
||||
}
|
||||
if (_configuration.General.SavedPresets.Count == 0 && ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
|
||||
{
|
||||
ImGui.SetTooltip("No saved presets to export.");
|
||||
}
|
||||
ImGui.SameLine();
|
||||
using (ImRaii.Disabled(_configuration.General.SavedPresets.Count == 0 || !ImGui.IsKeyDown(ImGuiKey.ModCtrl)))
|
||||
val = ImRaii.Disabled(_configuration.General.SavedPresets.Count == 0 || !ImGui.IsKeyDown(ImGuiKey.ModCtrl));
|
||||
try
|
||||
{
|
||||
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Trash, "Clear All"))
|
||||
{
|
||||
|
|
@ -441,6 +517,10 @@ internal sealed class SavedPresetsComponent
|
|||
_logger.LogInformation("Cleared all saved presets");
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val)?.Dispose();
|
||||
}
|
||||
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
|
||||
{
|
||||
if (_configuration.General.SavedPresets.Count == 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue