mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-22 08:29:20 +01:00
UI for crests.
This commit is contained in:
parent
512d0a1a5f
commit
cd0196ddb4
4 changed files with 132 additions and 35 deletions
|
|
@ -77,4 +77,22 @@ public static class CrestExtensions
|
||||||
CrestFlag.LFinger => EquipSlot.LFinger,
|
CrestFlag.LFinger => EquipSlot.LFinger,
|
||||||
_ => 0,
|
_ => 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public static string ToLabel(this CrestFlag flag)
|
||||||
|
=> flag switch
|
||||||
|
{
|
||||||
|
CrestFlag.Head => "Head",
|
||||||
|
CrestFlag.Body => "Chest",
|
||||||
|
CrestFlag.Hands => "Gauntlets",
|
||||||
|
CrestFlag.Legs => "Pants",
|
||||||
|
CrestFlag.Feet => "Boot",
|
||||||
|
CrestFlag.Ears => "Earrings",
|
||||||
|
CrestFlag.Neck => "Necklace",
|
||||||
|
CrestFlag.Wrists => "Bracelet",
|
||||||
|
CrestFlag.RFinger => "Right Ring",
|
||||||
|
CrestFlag.LFinger => "Left Ring",
|
||||||
|
CrestFlag.MainHand => "Weapon",
|
||||||
|
CrestFlag.OffHand => "Shield",
|
||||||
|
_ => string.Empty,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ using Dalamud.Interface;
|
||||||
using Dalamud.Interface.Internal.Notifications;
|
using Dalamud.Interface.Internal.Notifications;
|
||||||
using Dalamud.Plugin.Services;
|
using Dalamud.Plugin.Services;
|
||||||
using FFXIVClientStructs.FFXIV.Client.Game;
|
using FFXIVClientStructs.FFXIV.Client.Game;
|
||||||
|
using FFXIVClientStructs.FFXIV.Client.Graphics.Render;
|
||||||
using Glamourer.Automation;
|
using Glamourer.Automation;
|
||||||
using Glamourer.Customization;
|
using Glamourer.Customization;
|
||||||
using Glamourer.Designs;
|
using Glamourer.Designs;
|
||||||
|
|
@ -157,14 +158,33 @@ public class ActorPanel(ActorSelector _selector, StateManager _stateManager, Cus
|
||||||
_equipmentDrawer.DrawWeapons(mainhand, offhand, GameMain.IsInGPose());
|
_equipmentDrawer.DrawWeapons(mainhand, offhand, GameMain.IsInGPose());
|
||||||
|
|
||||||
ImGui.Dummy(new Vector2(ImGui.GetTextLineHeight() / 2));
|
ImGui.Dummy(new Vector2(ImGui.GetTextLineHeight() / 2));
|
||||||
EquipmentDrawer.DrawMetaToggle(ToggleDrawData.FromState(ActorState.MetaIndex.HatState, _stateManager, _state));
|
DrawEquipmentMetaToggles();
|
||||||
ImGui.SameLine();
|
|
||||||
EquipmentDrawer.DrawMetaToggle(ToggleDrawData.FromState(ActorState.MetaIndex.VisorState, _stateManager, _state));
|
|
||||||
ImGui.SameLine();
|
|
||||||
EquipmentDrawer.DrawMetaToggle(ToggleDrawData.FromState(ActorState.MetaIndex.WeaponState, _stateManager, _state));
|
|
||||||
ImGui.Dummy(new Vector2(ImGui.GetTextLineHeight() / 2));
|
ImGui.Dummy(new Vector2(ImGui.GetTextLineHeight() / 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DrawEquipmentMetaToggles()
|
||||||
|
{
|
||||||
|
using (var _ = ImRaii.Group())
|
||||||
|
{
|
||||||
|
EquipmentDrawer.DrawMetaToggle(ToggleDrawData.FromState(ActorState.MetaIndex.HatState, _stateManager, _state!));
|
||||||
|
EquipmentDrawer.DrawMetaToggle(ToggleDrawData.CrestFromState(EquipSlot.Head, _stateManager, _state!));
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.SameLine();
|
||||||
|
using (var _ = ImRaii.Group())
|
||||||
|
{
|
||||||
|
EquipmentDrawer.DrawMetaToggle(ToggleDrawData.FromState(ActorState.MetaIndex.VisorState, _stateManager, _state!));
|
||||||
|
EquipmentDrawer.DrawMetaToggle(ToggleDrawData.CrestFromState(EquipSlot.Body, _stateManager, _state!));
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.SameLine();
|
||||||
|
using (var _ = ImRaii.Group())
|
||||||
|
{
|
||||||
|
EquipmentDrawer.DrawMetaToggle(ToggleDrawData.FromState(ActorState.MetaIndex.WeaponState, _stateManager, _state!));
|
||||||
|
EquipmentDrawer.DrawMetaToggle(ToggleDrawData.CrestFromState(EquipSlot.OffHand, _stateManager, _state!));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void DrawMonsterPanel()
|
private void DrawMonsterPanel()
|
||||||
{
|
{
|
||||||
var names = _identification.AwaitedService.ModelCharaNames(_state!.ModelData.ModelId);
|
var names = _identification.AwaitedService.ModelCharaNames(_state!.ModelData.ModelId);
|
||||||
|
|
|
||||||
|
|
@ -109,12 +109,26 @@ public class DesignPanel(DesignFileSystemSelector _selector, CustomizationDrawer
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawEquipmentMetaToggles()
|
private void DrawEquipmentMetaToggles()
|
||||||
|
{
|
||||||
|
using (var _ = ImRaii.Group())
|
||||||
{
|
{
|
||||||
EquipmentDrawer.DrawMetaToggle(ToggleDrawData.FromDesign(ActorState.MetaIndex.HatState, _manager, _selector.Selected!));
|
EquipmentDrawer.DrawMetaToggle(ToggleDrawData.FromDesign(ActorState.MetaIndex.HatState, _manager, _selector.Selected!));
|
||||||
|
EquipmentDrawer.DrawMetaToggle(ToggleDrawData.CrestFromDesign(EquipSlot.Head, _manager, _selector.Selected!));
|
||||||
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
using (var _ = ImRaii.Group())
|
||||||
|
{
|
||||||
EquipmentDrawer.DrawMetaToggle(ToggleDrawData.FromDesign(ActorState.MetaIndex.VisorState, _manager, _selector.Selected!));
|
EquipmentDrawer.DrawMetaToggle(ToggleDrawData.FromDesign(ActorState.MetaIndex.VisorState, _manager, _selector.Selected!));
|
||||||
|
EquipmentDrawer.DrawMetaToggle(ToggleDrawData.CrestFromDesign(EquipSlot.Body, _manager, _selector.Selected!));
|
||||||
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
using (var _ = ImRaii.Group())
|
||||||
|
{
|
||||||
EquipmentDrawer.DrawMetaToggle(ToggleDrawData.FromDesign(ActorState.MetaIndex.WeaponState, _manager, _selector.Selected!));
|
EquipmentDrawer.DrawMetaToggle(ToggleDrawData.FromDesign(ActorState.MetaIndex.WeaponState, _manager, _selector.Selected!));
|
||||||
|
EquipmentDrawer.DrawMetaToggle(ToggleDrawData.CrestFromDesign(EquipSlot.OffHand, _manager, _selector.Selected!));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawCustomize()
|
private void DrawCustomize()
|
||||||
|
|
@ -140,12 +154,7 @@ public class DesignPanel(DesignFileSystemSelector _selector, CustomizationDrawer
|
||||||
ImGui.Dummy(new Vector2(ImGui.GetTextLineHeight() / 2));
|
ImGui.Dummy(new Vector2(ImGui.GetTextLineHeight() / 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawApplicationRules()
|
private void DrawCustomizeApplication()
|
||||||
{
|
|
||||||
if (!ImGui.CollapsingHeader("Application Rules"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
using (var _ = ImRaii.Group())
|
|
||||||
{
|
{
|
||||||
var set = _selector.Selected!.CustomizationSet;
|
var set = _selector.Selected!.CustomizationSet;
|
||||||
var available = set.SettingAvailable | CustomizeFlag.Clan | CustomizeFlag.Gender;
|
var available = set.SettingAvailable | CustomizeFlag.Clan | CustomizeFlag.Gender;
|
||||||
|
|
@ -176,6 +185,31 @@ public class DesignPanel(DesignFileSystemSelector _selector, CustomizationDrawer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DrawCrestApplication()
|
||||||
|
{
|
||||||
|
var flags = (uint)_selector.Selected!.ApplyCrest;
|
||||||
|
var bigChange = ImGui.CheckboxFlags("Apply All Crests", ref flags, (uint)CrestExtensions.AllRelevant);
|
||||||
|
foreach (var flag in CrestExtensions.AllRelevantSet)
|
||||||
|
{
|
||||||
|
var slot = flag.ToSlot();
|
||||||
|
var apply = bigChange ? ((CrestFlag)flags & flag) == flag : _selector.Selected!.DoApplyCrest(slot);
|
||||||
|
if (ImGui.Checkbox($"Apply {flag.ToLabel()} Crest", ref apply) || bigChange)
|
||||||
|
_manager.ChangeApplyCrest(_selector.Selected!, slot, apply);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawApplicationRules()
|
||||||
|
{
|
||||||
|
if (!ImGui.CollapsingHeader("Application Rules"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
using (var _ = ImRaii.Group())
|
||||||
|
{
|
||||||
|
DrawCustomizeApplication();
|
||||||
|
ImGui.NewLine();
|
||||||
|
DrawCrestApplication();
|
||||||
|
}
|
||||||
|
|
||||||
ImGui.SameLine(ImGui.GetContentRegionAvail().X / 2);
|
ImGui.SameLine(ImGui.GetContentRegionAvail().X / 2);
|
||||||
using (var _ = ImRaii.Group())
|
using (var _ = ImRaii.Group())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
using Glamourer.Designs;
|
using Glamourer.Designs;
|
||||||
using Glamourer.Events;
|
using Glamourer.Events;
|
||||||
using Glamourer.State;
|
using Glamourer.State;
|
||||||
|
using Glamourer.Structs;
|
||||||
|
using Penumbra.GameData.Enums;
|
||||||
|
|
||||||
namespace Glamourer.Gui;
|
namespace Glamourer.Gui;
|
||||||
|
|
||||||
|
|
@ -50,6 +52,29 @@ public ref struct ToggleDrawData
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ToggleDrawData CrestFromDesign(EquipSlot slot, DesignManager manager, Design design)
|
||||||
|
=> new()
|
||||||
|
{
|
||||||
|
Label = $"{slot.ToCrestFlag().ToLabel()} Crest",
|
||||||
|
Tooltip = string.Empty,
|
||||||
|
Locked = design.WriteProtected(),
|
||||||
|
DisplayApplication = true,
|
||||||
|
CurrentValue = design.DesignData.Crest(slot),
|
||||||
|
CurrentApply = design.DoApplyCrest(slot),
|
||||||
|
SetValue = v => manager.ChangeCrest(design, slot, v),
|
||||||
|
SetApply = v => manager.ChangeApplyCrest(design, slot, v),
|
||||||
|
};
|
||||||
|
|
||||||
|
public static ToggleDrawData CrestFromState(EquipSlot slot, StateManager manager, ActorState state)
|
||||||
|
=> new()
|
||||||
|
{
|
||||||
|
Label = $"{slot.ToCrestFlag().ToLabel()} Crest",
|
||||||
|
Tooltip = "Hide or show your free company crest on this piece of gear.",
|
||||||
|
Locked = state.IsLocked,
|
||||||
|
CurrentValue = state.ModelData.Crest(slot), // TODO
|
||||||
|
SetValue = v => { }, //manager.ChangeCrest(state, slot, v, StateChanged.Source.Manual),
|
||||||
|
};
|
||||||
|
|
||||||
public static ToggleDrawData FromState(ActorState.MetaIndex index, StateManager manager, ActorState state)
|
public static ToggleDrawData FromState(ActorState.MetaIndex index, StateManager manager, ActorState state)
|
||||||
{
|
{
|
||||||
var (label, tooltip, value, setValue) = index switch
|
var (label, tooltip, value, setValue) = index switch
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue