From 1bee5c680b389b0a023ab1ebec2f8ec29835c2e7 Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Sat, 27 Jul 2024 13:59:32 +0200 Subject: [PATCH] Add Facewear to application rules. --- Glamourer/Gui/Tabs/DesignTab/DesignPanel.cs | 60 +++++++++++++++------ 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/Glamourer/Gui/Tabs/DesignTab/DesignPanel.cs b/Glamourer/Gui/Tabs/DesignTab/DesignPanel.cs index b20e00d..3fa8e74 100644 --- a/Glamourer/Gui/Tabs/DesignTab/DesignPanel.cs +++ b/Glamourer/Gui/Tabs/DesignTab/DesignPanel.cs @@ -14,6 +14,7 @@ using ImGuiNET; using OtterGui; using OtterGui.Classes; using OtterGui.Raii; +using OtterGui.Text; using Penumbra.GameData.Enums; using static Glamourer.Gui.Tabs.HeaderDrawer; @@ -250,11 +251,15 @@ public class DesignPanel using (var _ = ImRaii.Group()) { DrawCustomizeApplication(); - ImGui.NewLine(); + ImUtf8.IconDummy(); DrawCrestApplication(); - ImGui.NewLine(); + ImUtf8.IconDummy(); if (_config.UseAdvancedParameters) + { DrawMetaApplication(); + ImUtf8.IconDummy(); + DrawBonusSlotApplication(); + } } ImGui.SameLine(ImGui.GetContentRegionAvail().X / 2); @@ -287,24 +292,38 @@ public class DesignPanel EquipSlot.OffHand, }); - ImGui.NewLine(); + ImUtf8.IconDummy(); ApplyEquip("Armor", ApplicationTypeExtensions.ArmorFlags, false, EquipSlotExtensions.EquipmentSlots); - ImGui.NewLine(); + ImUtf8.IconDummy(); ApplyEquip("Accessories", ApplicationTypeExtensions.AccessoryFlags, false, EquipSlotExtensions.AccessorySlots); - ImGui.NewLine(); + ImUtf8.IconDummy(); ApplyEquip("Dyes", ApplicationTypeExtensions.StainFlags, true, EquipSlotExtensions.FullSlots); - ImGui.NewLine(); + ImUtf8.IconDummy(); if (_config.UseAdvancedParameters) + { DrawParameterApplication(); + } else + { DrawMetaApplication(); + ImUtf8.IconDummy(); + DrawBonusSlotApplication(); + } } } + private static readonly IReadOnlyList MetaLabels = + [ + "Apply Wetness", + "Apply Hat Visibility", + "Apply Visor State", + "Apply Weapon Visibility", + ]; + private void DrawMetaApplication() { using var id = ImRaii.PushId("Meta"); @@ -312,15 +331,7 @@ public class DesignPanel var flags = (uint)_selector.Selected!.Application.Meta; var bigChange = ImGui.CheckboxFlags("Apply All Meta Changes", ref flags, all); - var labels = new[] - { - "Apply Wetness", - "Apply Hat Visibility", - "Apply Visor State", - "Apply Weapon Visibility", - }; - - foreach (var (index, label) in MetaExtensions.AllRelevant.Zip(labels)) + foreach (var (index, label) in MetaExtensions.AllRelevant.Zip(MetaLabels)) { var apply = bigChange ? ((MetaFlag)flags).HasFlag(index.ToFlag()) : _selector.Selected!.DoApplyMeta(index); if (ImGui.Checkbox(label, ref apply) || bigChange) @@ -328,6 +339,25 @@ public class DesignPanel } } + private static readonly IReadOnlyList BonusSlotLabels = + [ + "Apply Facewear", + ]; + + private void DrawBonusSlotApplication() + { + using var id = ImUtf8.PushId("Bonus"u8); + var flags = _selector.Selected!.Application.BonusItem; + var bigChange = BonusExtensions.AllFlags.Count > 1 && ImUtf8.Checkbox("Apply All Bonus Slots"u8, ref flags, BonusExtensions.All); + foreach (var (index, label) in BonusExtensions.AllFlags.Zip(BonusSlotLabels)) + { + var apply = bigChange ? flags.HasFlag(index) : _selector.Selected!.DoApplyBonusItem(index); + if (ImUtf8.Checkbox(label, ref apply) || bigChange) + _manager.ChangeApplyBonusItem(_selector.Selected!, index, apply); + } + } + + private void DrawParameterApplication() { using var id = ImRaii.PushId("Parameter");