Add visibility options for automated design application rules and unobtained item warnings.

This commit is contained in:
Ottermandias 2023-09-27 02:34:44 +02:00
parent 2e9a30427d
commit 38a28871f4
3 changed files with 79 additions and 48 deletions

View file

@ -32,6 +32,8 @@ public class Configuration : IPluginConfiguration, ISavable
public bool EnableGameContextMenu { get; set; } = true; public bool EnableGameContextMenu { get; set; } = true;
public bool HideWindowInCutscene { get; set; } = false; public bool HideWindowInCutscene { get; set; } = false;
public bool ShowAutomationSetEditing { get; set; } = true; public bool ShowAutomationSetEditing { get; set; } = true;
public bool ShowAllAutomatedApplicationRules { get; set; } = true;
public bool ShowUnlockedItemWarnings { get; set; } = true;
public MainWindow.TabType SelectedTab { get; set; } = MainWindow.TabType.Settings; public MainWindow.TabType SelectedTab { get; set; } = MainWindow.TabType.Settings;
public DoubleModifier DeleteDesignModifier { get; set; } = new(ModifierHotkey.Control, ModifierHotkey.Shift); public DoubleModifier DeleteDesignModifier { get; set; } = new(ModifierHotkey.Control, ModifierHotkey.Shift);

View file

@ -107,7 +107,7 @@ public class SetPanel
"Show options to change the name or the associated character or NPC of this design set."); "Show options to change the name or the associated character or NPC of this design set.");
} }
if (_showEditing) if (_config.ShowAutomationSetEditing)
{ {
ImGui.Dummy(Vector2.Zero); ImGui.Dummy(Vector2.Zero);
ImGui.Separator(); ImGui.Separator();
@ -137,33 +137,52 @@ public class SetPanel
private void DrawDesignTable() private void DrawDesignTable()
{ {
var requiredSizeOneLine = (1 + 6 + 2) * ImGui.GetFrameHeight() var (numCheckboxes, numSpacing) = (_config.ShowAllAutomatedApplicationRules, _config.ShowUnlockedItemWarnings) switch
+ (30 + 220 + 10 + 4) * ImGuiHelpers.GlobalScale {
(true, true) => (9, 14),
(true, false) => (7, 10),
(false, true) => (4, 4),
(false, false) => (2, 0),
};
var requiredSizeOneLine = numCheckboxes * ImGui.GetFrameHeight()
+ (30 + 220 + numSpacing) * ImGuiHelpers.GlobalScale
+ 5 * ImGui.GetStyle().CellPadding.X + 5 * ImGui.GetStyle().CellPadding.X
+ 150 * ImGuiHelpers.GlobalScale; + 150 * ImGuiHelpers.GlobalScale;
var singleRow = ImGui.GetContentRegionAvail().X >= requiredSizeOneLine; var singleRow = ImGui.GetContentRegionAvail().X >= requiredSizeOneLine || numSpacing == 0;
using var table = ImRaii.Table("SetTable", singleRow ? 6 : 5, using var table = ImRaii.Table("SetTable", singleRow && _config.ShowUnlockedItemWarnings ? 6 : 5,
ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollX | ImGuiTableFlags.ScrollY); ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollX | ImGuiTableFlags.ScrollY);
if (!table) if (!table)
return; return;
ImGui.TableSetupColumn("##del", ImGuiTableColumnFlags.WidthFixed, ImGui.GetFrameHeight()); ImGui.TableSetupColumn("##del", ImGuiTableColumnFlags.WidthFixed, ImGui.GetFrameHeight());
ImGui.TableSetupColumn("##Index", ImGuiTableColumnFlags.WidthFixed, 30 * ImGuiHelpers.GlobalScale); ImGui.TableSetupColumn("##Index", ImGuiTableColumnFlags.WidthFixed, 30 * ImGuiHelpers.GlobalScale);
if (singleRow) if (singleRow)
{ {
ImGui.TableSetupColumn("Design", ImGuiTableColumnFlags.WidthFixed, 220 * ImGuiHelpers.GlobalScale); ImGui.TableSetupColumn("Design", ImGuiTableColumnFlags.WidthFixed, 220 * ImGuiHelpers.GlobalScale);
ImGui.TableSetupColumn("Application", ImGuiTableColumnFlags.WidthFixed, 6 * ImGui.GetFrameHeight() + 10 * ImGuiHelpers.GlobalScale); if (_config.ShowAllAutomatedApplicationRules)
ImGui.TableSetupColumn("Application", ImGuiTableColumnFlags.WidthFixed,
6 * ImGui.GetFrameHeight() + 10 * ImGuiHelpers.GlobalScale);
else
ImGui.TableSetupColumn("Use", ImGuiTableColumnFlags.WidthFixed, ImGui.CalcTextSize("Use").X);
} }
else else
{ {
ImGui.TableSetupColumn("Design / Job Restrictions", ImGuiTableColumnFlags.WidthFixed, 250 * ImGuiHelpers.GlobalScale); ImGui.TableSetupColumn("Design / Job Restrictions", ImGuiTableColumnFlags.WidthFixed, 250 * ImGuiHelpers.GlobalScale);
ImGui.TableSetupColumn("Application", ImGuiTableColumnFlags.WidthFixed, 3 * ImGui.GetFrameHeight() + 4 * ImGuiHelpers.GlobalScale); if (_config.ShowAllAutomatedApplicationRules)
ImGui.TableSetupColumn("Application", ImGuiTableColumnFlags.WidthFixed,
3 * ImGui.GetFrameHeight() + 4 * ImGuiHelpers.GlobalScale);
else
ImGui.TableSetupColumn("Use", ImGuiTableColumnFlags.WidthFixed, ImGui.CalcTextSize("Use").X);
} }
if (singleRow) if (singleRow)
ImGui.TableSetupColumn("Job Restrictions", ImGuiTableColumnFlags.WidthStretch); ImGui.TableSetupColumn("Job Restrictions", ImGuiTableColumnFlags.WidthStretch);
if (_config.ShowUnlockedItemWarnings)
ImGui.TableSetupColumn(string.Empty, ImGuiTableColumnFlags.WidthFixed, 2 * ImGui.GetFrameHeight() + 4 * ImGuiHelpers.GlobalScale); ImGui.TableSetupColumn(string.Empty, ImGuiTableColumnFlags.WidthFixed, 2 * ImGui.GetFrameHeight() + 4 * ImGuiHelpers.GlobalScale);
ImGui.TableHeadersRow(); ImGui.TableHeadersRow();
foreach (var (design, idx) in Selection.Designs.WithIndex()) foreach (var (design, idx) in Selection.Designs.WithIndex())
@ -197,9 +216,12 @@ public class SetPanel
DrawApplicationTypeBoxes(Selection, design, idx, singleRow); DrawApplicationTypeBoxes(Selection, design, idx, singleRow);
} }
if (_config.ShowUnlockedItemWarnings)
{
ImGui.TableNextColumn(); ImGui.TableNextColumn();
DrawWarnings(design, idx); DrawWarnings(design, idx);
} }
}
ImGui.TableNextColumn(); ImGui.TableNextColumn();
ImGui.TableNextColumn(); ImGui.TableNextColumn();
@ -207,8 +229,7 @@ public class SetPanel
ImGui.TextUnformatted("New"); ImGui.TextUnformatted("New");
ImGui.TableNextColumn(); ImGui.TableNextColumn();
_designCombo.Draw(Selection, null, -1, _selector.IncognitoMode); _designCombo.Draw(Selection, null, -1, _selector.IncognitoMode);
ImGui.TableNextColumn(); ImGui.TableNextRow();
ImGui.TableNextColumn();
_endAction?.Invoke(); _endAction?.Invoke();
_endAction = null; _endAction = null;
@ -334,8 +355,9 @@ public class SetPanel
} }
style.Pop(); style.Pop();
ImGuiUtil.HoverTooltip("Toggle all modes at once."); ImGuiUtil.HoverTooltip("Toggle all application modes at once.");
if (_config.ShowAllAutomatedApplicationRules)
{
void Box(int idx) void Box(int idx)
{ {
var (type, description) = Types[idx]; var (type, description) = Types[idx];
@ -357,6 +379,7 @@ public class SetPanel
Box(3); Box(3);
ImGui.SameLine(); ImGui.SameLine();
Box(4); Box(4);
}
_manager.ChangeApplicationType(set, autoDesignIndex, newType); _manager.ChangeApplicationType(set, autoDesignIndex, newType);
} }

View file

@ -119,6 +119,12 @@ public class SettingsTab : ITab
Checkbox("Auto-Open Design Folders", Checkbox("Auto-Open Design Folders",
"Have design folders open or closed as their default state after launching.", _config.OpenFoldersByDefault, "Have design folders open or closed as their default state after launching.", _config.OpenFoldersByDefault,
v => _config.OpenFoldersByDefault = v); v => _config.OpenFoldersByDefault = v);
Checkbox("Show all Application Rule Checkboxes for Automation",
"Show multiple separate application rule checkboxes for automated designs, instead of a single box for enabling or disabling.",
_config.ShowAllAutomatedApplicationRules, v => _config.ShowAllAutomatedApplicationRules = v);
Checkbox("Show Unobtained Item Warnings",
"Show information whether you have unlocked all items and customizations in your automated design or not.",
_config.ShowUnlockedItemWarnings, v => _config.ShowUnlockedItemWarnings = v);
Checkbox("Debug Mode", "Show the debug tab. Only useful for debugging or advanced use. Not recommended in general.", _config.DebugMode, Checkbox("Debug Mode", "Show the debug tab. Only useful for debugging or advanced use. Not recommended in general.", _config.DebugMode,
v => _config.DebugMode = v); v => _config.DebugMode = v);
ImGui.NewLine(); ImGui.NewLine();