mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2026-01-03 06:13:45 +01:00
Add initial support for setting temporary mod settings.
This commit is contained in:
parent
e41755ed7e
commit
24452f3c79
22 changed files with 394 additions and 202 deletions
|
|
@ -6,6 +6,7 @@ using ImGuiNET;
|
|||
using OtterGui;
|
||||
using OtterGui.Classes;
|
||||
using OtterGui.Raii;
|
||||
using OtterGui.Text;
|
||||
using OtterGui.Widgets;
|
||||
|
||||
namespace Glamourer.Gui.Tabs.DesignTab;
|
||||
|
|
@ -41,7 +42,7 @@ public class DesignDetailTab
|
|||
|
||||
public void Draw()
|
||||
{
|
||||
using var h = ImRaii.CollapsingHeader("Design Details");
|
||||
using var h = ImUtf8.CollapsingHeaderId("Design Details"u8);
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
|
|
@ -54,19 +55,19 @@ public class DesignDetailTab
|
|||
private void DrawDesignInfoTable()
|
||||
{
|
||||
using var style = ImRaii.PushStyle(ImGuiStyleVar.ButtonTextAlign, new Vector2(0, 0.5f));
|
||||
using var table = ImRaii.Table("Details", 2);
|
||||
using var table = ImUtf8.Table("Details"u8, 2);
|
||||
if (!table)
|
||||
return;
|
||||
|
||||
ImGui.TableSetupColumn("Type", ImGuiTableColumnFlags.WidthFixed, ImGui.CalcTextSize("Reset Advanced Dyes").X);
|
||||
ImGui.TableSetupColumn("Data", ImGuiTableColumnFlags.WidthStretch);
|
||||
ImUtf8.TableSetupColumn("Type"u8, ImGuiTableColumnFlags.WidthFixed, ImUtf8.CalcTextSize("Reset Temporary Settings"u8).X);
|
||||
ImUtf8.TableSetupColumn("Data"u8, ImGuiTableColumnFlags.WidthStretch);
|
||||
|
||||
ImGuiUtil.DrawFrameColumn("Design Name");
|
||||
ImUtf8.DrawFrameColumn("Design Name"u8);
|
||||
ImGui.TableNextColumn();
|
||||
var width = new Vector2(ImGui.GetContentRegionAvail().X, 0);
|
||||
var name = _newName ?? _selector.Selected!.Name;
|
||||
ImGui.SetNextItemWidth(width.X);
|
||||
if (ImGui.InputText("##Name", ref name, 128))
|
||||
if (ImUtf8.InputText("##Name"u8, ref name))
|
||||
{
|
||||
_newName = name;
|
||||
_changeDesign = _selector.Selected;
|
||||
|
|
@ -80,10 +81,10 @@ public class DesignDetailTab
|
|||
}
|
||||
|
||||
var identifier = _selector.Selected!.Identifier.ToString();
|
||||
ImGuiUtil.DrawFrameColumn("Unique Identifier");
|
||||
ImUtf8.DrawFrameColumn("Unique Identifier"u8);
|
||||
ImGui.TableNextColumn();
|
||||
var fileName = _saveService.FileNames.DesignFile(_selector.Selected!);
|
||||
using (var mono = ImRaii.PushFont(UiBuilder.MonoFont))
|
||||
using (ImRaii.PushFont(UiBuilder.MonoFont))
|
||||
{
|
||||
if (ImGui.Button(identifier, width))
|
||||
try
|
||||
|
|
@ -100,14 +101,14 @@ public class DesignDetailTab
|
|||
ImGui.SetClipboardText(identifier);
|
||||
}
|
||||
|
||||
ImGuiUtil.HoverTooltip(
|
||||
ImUtf8.HoverTooltip(
|
||||
$"Open the file\n\t{fileName}\ncontaining this design in the .json-editor of your choice.\n\nRight-Click to copy identifier to clipboard.");
|
||||
|
||||
ImGuiUtil.DrawFrameColumn("Full Selector Path");
|
||||
ImUtf8.DrawFrameColumn("Full Selector Path"u8);
|
||||
ImGui.TableNextColumn();
|
||||
var path = _newPath ?? _selector.SelectedLeaf!.FullName();
|
||||
ImGui.SetNextItemWidth(width.X);
|
||||
if (ImGui.InputText("##Path", ref path, 1024))
|
||||
if (ImUtf8.InputText("##Path"u8, ref path))
|
||||
{
|
||||
_newPath = path;
|
||||
_changeLeaf = _selector.SelectedLeaf!;
|
||||
|
|
@ -125,32 +126,42 @@ public class DesignDetailTab
|
|||
Glamourer.Messager.NotificationMessage(ex, ex.Message, "Could not rename or move design", NotificationType.Error);
|
||||
}
|
||||
|
||||
ImGuiUtil.DrawFrameColumn("Quick Design Bar");
|
||||
ImUtf8.DrawFrameColumn("Quick Design Bar"u8);
|
||||
ImGui.TableNextColumn();
|
||||
if (ImGui.RadioButton("Display##qdb", _selector.Selected.QuickDesign))
|
||||
if (ImUtf8.RadioButton("Display##qdb"u8, _selector.Selected.QuickDesign))
|
||||
_manager.SetQuickDesign(_selector.Selected!, true);
|
||||
var hovered = ImGui.IsItemHovered();
|
||||
ImGui.SameLine();
|
||||
if (ImGui.RadioButton("Hide##qdb", !_selector.Selected.QuickDesign))
|
||||
if (ImUtf8.RadioButton("Hide##qdb"u8, !_selector.Selected.QuickDesign))
|
||||
_manager.SetQuickDesign(_selector.Selected!, false);
|
||||
if (hovered || ImGui.IsItemHovered())
|
||||
ImGui.SetTooltip("Display or hide this design in your quick design bar.");
|
||||
{
|
||||
using var tt = ImUtf8.Tooltip();
|
||||
ImUtf8.Text("Display or hide this design in your quick design bar."u8);
|
||||
}
|
||||
|
||||
var forceRedraw = _selector.Selected!.ForcedRedraw;
|
||||
ImGuiUtil.DrawFrameColumn("Force Redrawing");
|
||||
ImUtf8.DrawFrameColumn("Force Redrawing"u8);
|
||||
ImGui.TableNextColumn();
|
||||
if (ImGui.Checkbox("##ForceRedraw", ref forceRedraw))
|
||||
if (ImUtf8.Checkbox("##ForceRedraw"u8, ref forceRedraw))
|
||||
_manager.ChangeForcedRedraw(_selector.Selected!, forceRedraw);
|
||||
ImGuiUtil.HoverTooltip("Set this design to always force a redraw when it is applied through any means.");
|
||||
ImUtf8.HoverTooltip("Set this design to always force a redraw when it is applied through any means."u8);
|
||||
|
||||
var resetAdvancedDyes = _selector.Selected!.ResetAdvancedDyes;
|
||||
ImGuiUtil.DrawFrameColumn("Reset Advanced Dyes");
|
||||
ImUtf8.DrawFrameColumn("Reset Advanced Dyes"u8);
|
||||
ImGui.TableNextColumn();
|
||||
if (ImGui.Checkbox("##ResetAdvancedDyes", ref resetAdvancedDyes))
|
||||
if (ImUtf8.Checkbox("##ResetAdvancedDyes"u8, ref resetAdvancedDyes))
|
||||
_manager.ChangeResetAdvancedDyes(_selector.Selected!, resetAdvancedDyes);
|
||||
ImGuiUtil.HoverTooltip("Set this design to reset any previously applied advanced dyes when it is applied through any means.");
|
||||
ImUtf8.HoverTooltip("Set this design to reset any previously applied advanced dyes when it is applied through any means."u8);
|
||||
|
||||
ImGuiUtil.DrawFrameColumn("Color");
|
||||
var resetTemporarySettings = _selector.Selected!.ResetTemporarySettings;
|
||||
ImUtf8.DrawFrameColumn("Reset Temporary Settings"u8);
|
||||
ImGui.TableNextColumn();
|
||||
if (ImUtf8.Checkbox("##ResetTemporarySettings"u8, ref resetTemporarySettings))
|
||||
_manager.ChangeResetTemporarySettings(_selector.Selected!, resetTemporarySettings);
|
||||
ImUtf8.HoverTooltip("Set this design to reset any temporary settings previously applied to the associated collection when it is applied through any means."u8);
|
||||
|
||||
ImUtf8.DrawFrameColumn("Color"u8);
|
||||
var colorName = _selector.Selected!.Color.Length == 0 ? DesignColors.AutomaticName : _selector.Selected!.Color;
|
||||
ImGui.TableNextColumn();
|
||||
if (_colorCombo.Draw("##colorCombo", colorName, "Associate a color with this design.\n"
|
||||
|
|
@ -178,18 +189,18 @@ public class DesignDetailTab
|
|||
var size = new Vector2(ImGui.GetFrameHeight());
|
||||
using var font = ImRaii.PushFont(UiBuilder.IconFont);
|
||||
ImGuiUtil.DrawTextButton(FontAwesomeIcon.ExclamationCircle.ToIconString(), size, 0, _colors.MissingColor);
|
||||
ImGuiUtil.HoverTooltip("The color associated with this design does not exist.");
|
||||
ImUtf8.HoverTooltip("The color associated with this design does not exist."u8);
|
||||
}
|
||||
|
||||
ImGuiUtil.DrawFrameColumn("Creation Date");
|
||||
ImUtf8.DrawFrameColumn("Creation Date"u8);
|
||||
ImGui.TableNextColumn();
|
||||
ImGuiUtil.DrawTextButton(_selector.Selected!.CreationDate.LocalDateTime.ToString("F"), width, 0);
|
||||
|
||||
ImGuiUtil.DrawFrameColumn("Last Update Date");
|
||||
ImUtf8.DrawFrameColumn("Last Update Date"u8);
|
||||
ImGui.TableNextColumn();
|
||||
ImGuiUtil.DrawTextButton(_selector.Selected!.LastEdit.LocalDateTime.ToString("F"), width, 0);
|
||||
|
||||
ImGuiUtil.DrawFrameColumn("Tags");
|
||||
ImUtf8.DrawFrameColumn("Tags"u8);
|
||||
ImGui.TableNextColumn();
|
||||
DrawTags();
|
||||
}
|
||||
|
|
@ -219,18 +230,18 @@ public class DesignDetailTab
|
|||
var size = new Vector2(ImGui.GetContentRegionAvail().X, 12 * ImGui.GetTextLineHeightWithSpacing());
|
||||
if (!_editDescriptionMode)
|
||||
{
|
||||
using (var textBox = ImRaii.ListBox("##desc", size))
|
||||
using (var textBox = ImUtf8.ListBox("##desc"u8, size))
|
||||
{
|
||||
ImGuiUtil.TextWrapped(desc);
|
||||
ImUtf8.TextWrapped(desc);
|
||||
}
|
||||
|
||||
if (ImGui.Button("Edit Description"))
|
||||
if (ImUtf8.Button("Edit Description"u8))
|
||||
_editDescriptionMode = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
var edit = _newDescription ?? desc;
|
||||
if (ImGui.InputTextMultiline("##desc", ref edit, (uint)Math.Max(2000, 4 * edit.Length), size))
|
||||
if (ImUtf8.InputMultiLine("##desc"u8, ref edit, size))
|
||||
_newDescription = edit;
|
||||
|
||||
if (ImGui.IsItemDeactivatedAfterEdit())
|
||||
|
|
@ -239,7 +250,7 @@ public class DesignDetailTab
|
|||
_newDescription = null;
|
||||
}
|
||||
|
||||
if (ImGui.Button("Stop Editing"))
|
||||
if (ImUtf8.Button("Stop Editing"u8))
|
||||
_editDescriptionMode = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue