UI for crests.

This commit is contained in:
Ottermandias 2023-11-26 00:29:15 +01:00
parent 512d0a1a5f
commit cd0196ddb4
4 changed files with 132 additions and 35 deletions

View file

@ -2,6 +2,8 @@
using Glamourer.Designs;
using Glamourer.Events;
using Glamourer.State;
using Glamourer.Structs;
using Penumbra.GameData.Enums;
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)
{
var (label, tooltip, value, setValue) = index switch