mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2026-02-24 21:51:48 +01:00
Current State.
This commit is contained in:
parent
e8c6204c25
commit
0d4f7777f0
28 changed files with 557 additions and 557 deletions
|
|
@ -45,7 +45,7 @@ public partial class CustomizationDrawer
|
|||
_ => Unknown,
|
||||
};
|
||||
|
||||
if (ImEx.Icon.Button(icon, StringU8.Empty, icon != Unknown, _framedIconSize))
|
||||
if (ImEx.Icon.Button(icon, StringU8.Empty, icon == Unknown, _framedIconSize))
|
||||
Changed |= service.ChangeGender(ref _customize, icon == Male ? Gender.Female : Gender.Male);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public partial class CustomizationDrawer
|
|||
}
|
||||
|
||||
if (hasIcon)
|
||||
Im.Tooltip.ImageOnHover(wrap!.Id, _iconSize);
|
||||
Im.Tooltip.ImageOnHover(wrap!.Id, wrap.Size);
|
||||
|
||||
Im.Line.Same();
|
||||
using (Im.Group())
|
||||
|
|
@ -212,8 +212,8 @@ public partial class CustomizationDrawer
|
|||
hasIcon = icon.TryGetWrap(out wrap, out _);
|
||||
}
|
||||
|
||||
if (Im.Image.Button(wrap?.Id ?? icon.GetWrapOrEmpty().Id, _iconSize, Vector2.Zero, Vector2.One, Vector4.Zero,
|
||||
enabled ? Vector4.One : _redTint,
|
||||
if (Im.Image.Button(wrap?.Id ?? icon.GetWrapOrEmpty().Id, _iconSize, Vector2.Zero, Vector2.One,
|
||||
enabled ? Vector4.One : _redTint, Vector4.Zero,
|
||||
(int)Im.Style.FramePadding.X))
|
||||
{
|
||||
_customize.Set(featureIdx, enabled ? CustomizeValue.Zero : CustomizeValue.Max);
|
||||
|
|
@ -221,7 +221,7 @@ public partial class CustomizationDrawer
|
|||
}
|
||||
|
||||
if (hasIcon)
|
||||
Im.Tooltip.ImageOnHover(wrap!.Id, _iconSize);
|
||||
Im.Tooltip.ImageOnHover(wrap!.Id, wrap.Size);
|
||||
if (idx % 4 is not 3)
|
||||
Im.Line.Same();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,17 +40,19 @@ public partial class CustomizationDrawer
|
|||
|
||||
Span<byte> t = stackalloc byte[64];
|
||||
var ic = CultureInfo.InvariantCulture;
|
||||
int written;
|
||||
if (config.HeightDisplayType switch
|
||||
{
|
||||
HeightDisplayType.Centimetre => Utf8.TryWrite(t, ic, $"({height * 100:F1} cm)", out _),
|
||||
HeightDisplayType.Metre => Utf8.TryWrite(t, ic, $"({height:F2} m)", out _),
|
||||
HeightDisplayType.Wrong => Utf8.TryWrite(t, ic, $"({height * 100 / 2.539:F1} in)", out _),
|
||||
HeightDisplayType.WrongFoot => Utf8.TryWrite(t, ic, $"({(int)(height * 3.2821)}'{(int)(height * 39.3856) % 12}'')", out _),
|
||||
HeightDisplayType.Corgi => Utf8.TryWrite(t, ic, $"({height * 100 / 40.0:F1} Corgis)", out _),
|
||||
HeightDisplayType.OlympicPool => Utf8.TryWrite(t, ic, $"({height / 3.0:F3} Pools)", out _),
|
||||
_ => Utf8.TryWrite(t, ic, $"({height})", out _),
|
||||
HeightDisplayType.Centimetre => Utf8.TryWrite(t, ic, $"({height * 100:F1} cm)", out written),
|
||||
HeightDisplayType.Metre => Utf8.TryWrite(t, ic, $"({height:F2} m)", out written),
|
||||
HeightDisplayType.Wrong => Utf8.TryWrite(t, ic, $"({height * 100 / 2.539:F1} in)", out written),
|
||||
HeightDisplayType.WrongFoot => Utf8.TryWrite(t, ic, $"({(int)(height * 3.2821)}'{(int)(height * 39.3856) % 12}'')",
|
||||
out written),
|
||||
HeightDisplayType.Corgi => Utf8.TryWrite(t, ic, $"({height * 100 / 40.0:F1} Corgis)", out written),
|
||||
HeightDisplayType.OlympicPool => Utf8.TryWrite(t, ic, $"({height / 3.0:F3} Pools)", out written),
|
||||
_ => Utf8.TryWrite(t, ic, $"({height})", out written),
|
||||
})
|
||||
Im.Text(t);
|
||||
Im.Text(t[..written]);
|
||||
}
|
||||
|
||||
private void DrawPercentageSlider()
|
||||
|
|
|
|||
|
|
@ -15,6 +15,62 @@ using MouseWheelType = OtterGui.Widgets.MouseWheelType;
|
|||
|
||||
namespace Glamourer.Gui;
|
||||
|
||||
//public abstract class DesignComboBase2 : ImSharp.FilterComboBase<DesignComboBase2.CacheItem>, IDisposable
|
||||
//{
|
||||
// protected readonly EphemeralConfig Config;
|
||||
// protected readonly DesignChanged DesignChanged;
|
||||
// protected readonly DesignColors DesignColors;
|
||||
// protected readonly TabSelected TabSelected;
|
||||
// protected IDesignStandIn? _currentDesign;
|
||||
//
|
||||
// private CacheItem CreateItem(IDesignStandIn design)
|
||||
// {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public readonly struct CacheItem(IDesignStandIn design, Vector4 color)
|
||||
// {
|
||||
// public readonly IDesignStandIn Design = design;
|
||||
// public readonly StringPair Name = new(design.ResolveName(false));
|
||||
// public readonly StringPair Incognito = new(design.ResolveName(true));
|
||||
// public readonly StringPair FullPath = StringPair.Empty;
|
||||
// public readonly Vector4 Color = color;
|
||||
// }
|
||||
//
|
||||
// public DesignComboBase2(EphemeralConfig config, DesignChanged designChanged, DesignColors designColors, TabSelected tabSelected)
|
||||
// {
|
||||
// Config = config;
|
||||
// DesignChanged = designChanged;
|
||||
// DesignColors = designColors;
|
||||
// TabSelected = tabSelected;
|
||||
//
|
||||
// DesignChanged.Subscribe(OnDesignChanged, DesignChanged.Priority.DesignCombo);
|
||||
// }
|
||||
//
|
||||
// private void OnDesignChanged(DesignChanged.Type type, Design? _1, ITransaction? _2 = null)
|
||||
// {
|
||||
// _isCurrentSelectionDirty = type switch
|
||||
// {
|
||||
// DesignChanged.Type.Created => true,
|
||||
// DesignChanged.Type.Renamed => true,
|
||||
// DesignChanged.Type.ChangedColor => true,
|
||||
// DesignChanged.Type.Deleted => true,
|
||||
// DesignChanged.Type.QuickDesignBar => true,
|
||||
// _ => _isCurrentSelectionDirty,
|
||||
// };
|
||||
// }
|
||||
//
|
||||
// protected override bool DrawItem(in CacheItem item, int globalIndex, bool selected)
|
||||
// {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public void Dispose()
|
||||
// {
|
||||
// DesignChanged.Unsubscribe(OnDesignChanged);
|
||||
// }
|
||||
//}
|
||||
|
||||
public abstract class DesignComboBase : FilterComboCache<Tuple<IDesignStandIn, string>>, IDisposable
|
||||
{
|
||||
protected readonly EphemeralConfig Config;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using Dalamud.Interface.Components;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Glamourer.Events;
|
||||
using Glamourer.Gui.Materials;
|
||||
using Glamourer.Services;
|
||||
|
|
@ -46,7 +45,7 @@ public class EquipmentDrawer
|
|||
_advancedDyes = advancedDyes;
|
||||
_itemCopy = itemCopy;
|
||||
_stainData = items.Stains;
|
||||
_stainCombo = new GlamourerColorCombo(DefaultWidth - 20, _stainData, favorites);
|
||||
_stainCombo = new GlamourerColorCombo(_stainData, favorites);
|
||||
_itemCombo = EquipSlotExtensions.EqdpSlots.Select(e => new ItemCombo(gameData, items, e, Glamourer.Log, favorites)).ToArray();
|
||||
_bonusItemCombo = BonusExtensions.AllFlags.Select(f => new BonusItemCombo(gameData, items, f, Glamourer.Log, favorites)).ToArray();
|
||||
_weaponCombo = new Dictionary<FullEquipType, WeaponCombo>(FullEquipTypeExtensions.WeaponTypes.Count * 2);
|
||||
|
|
@ -159,13 +158,10 @@ public class EquipmentDrawer
|
|||
public bool DrawAllStain(out StainIds ret, bool locked)
|
||||
{
|
||||
using var disabled = Im.Disabled(locked);
|
||||
var change = _stainCombo.Draw("Dye All Slots", Stain.None.RgbaColor, string.Empty, false, false, OtterGui.Widgets.MouseWheelType.None);
|
||||
var change = _stainCombo.Draw("Dye All Slots"u8, Stain.None, out var newAllStain, Im.Style.FrameHeight);
|
||||
ret = StainIds.None;
|
||||
if (change)
|
||||
if (_stainData.TryGetValue(_stainCombo.CurrentSelection.Key, out var stain))
|
||||
ret = StainIds.All(stain.RowIndex);
|
||||
else if (_stainCombo.CurrentSelection.Key == Stain.None.RowIndex)
|
||||
ret = StainIds.None;
|
||||
ret = newAllStain.RowIndex != Stain.None.RowIndex ? StainIds.All(newAllStain.RowIndex) : StainIds.None;
|
||||
|
||||
if (!locked)
|
||||
{
|
||||
|
|
@ -390,15 +386,16 @@ public class EquipmentDrawer
|
|||
|
||||
private void DrawStain(in EquipDrawData data, bool small)
|
||||
{
|
||||
using var id = Im.Id.Push((uint)data.Slot);
|
||||
using var disabled = Im.Disabled(data.Locked);
|
||||
var width = (_comboLength - Im.Style.ItemInnerSpacing.X * (data.CurrentStains.Count - 1)) / data.CurrentStains.Count;
|
||||
foreach (var (index, stainId) in data.CurrentStains.Index())
|
||||
{
|
||||
using var id = Im.Id.Push(index);
|
||||
var found = _stainData.TryGetValue(stainId, out var stain);
|
||||
id.Push(index);
|
||||
var found = _stainData.TryGetValue(stainId, out var stain);
|
||||
var change = small
|
||||
? _stainCombo.Draw($"##stain{data.Slot}", stain.RgbaColor, stain.Name, found, stain.Gloss)
|
||||
: _stainCombo.Draw($"##stain{data.Slot}", stain.RgbaColor, stain.Name, found, stain.Gloss, width);
|
||||
? _stainCombo.Draw("##stain"u8, stain, out var newStain, Im.Style.FrameHeight)
|
||||
: _stainCombo.Draw("##stain"u8, stain, out newStain, width);
|
||||
|
||||
_itemCopy.HandleCopyPaste(data, index);
|
||||
if (!change)
|
||||
|
|
@ -408,13 +405,11 @@ public class EquipmentDrawer
|
|||
Im.Line.SameInner();
|
||||
|
||||
if (change)
|
||||
if (_stainData.TryGetValue(_stainCombo.CurrentSelection.Key, out stain))
|
||||
data.SetStains(data.CurrentStains.With(index, stain.RowIndex));
|
||||
else if (_stainCombo.CurrentSelection.Key == Stain.None.RowIndex)
|
||||
data.SetStains(data.CurrentStains.With(index, Stain.None.RowIndex));
|
||||
data.SetStains(data.CurrentStains.With(index, newStain.RowIndex));
|
||||
if (ResetOrClear(data.Locked, false, data.AllowRevert, true, stainId, data.GameStains[index], Stain.None.RowIndex,
|
||||
out var newStain))
|
||||
data.SetStains(data.CurrentStains.With(index, newStain));
|
||||
out var newStainId))
|
||||
data.SetStains(data.CurrentStains.With(index, newStainId));
|
||||
id.Pop(index);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,46 +1,70 @@
|
|||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using Glamourer.Unlocks;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Glamourer.Unlocks;
|
||||
using ImSharp;
|
||||
using OtterGui.Widgets;
|
||||
using Luna;
|
||||
using Penumbra.GameData.DataContainers;
|
||||
using Penumbra.GameData.Structs;
|
||||
using MouseWheelType = OtterGui.Widgets.MouseWheelType;
|
||||
|
||||
namespace Glamourer.Gui.Equipment;
|
||||
|
||||
public sealed class GlamourerColorCombo(float _comboWidth, DictStain _stains, FavoriteManager _favorites)
|
||||
: FilterComboColors(_comboWidth, MouseWheelType.Control, CreateFunc(_stains, _favorites), Glamourer.Log)
|
||||
public sealed class GlamourerColorCombo(DictStain stains, FavoriteManager favorites) : FilterComboColors
|
||||
{
|
||||
protected override bool DrawSelectable(int globalIdx, bool selected)
|
||||
{
|
||||
using (var _ = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, ImGuiHelpers.ScaledVector2(4, 0)))
|
||||
{
|
||||
if (globalIdx == 0)
|
||||
{
|
||||
using var font = ImRaii.PushFont(UiBuilder.IconFont);
|
||||
Im.Dummy(ImGui.CalcTextSize(FontAwesomeIcon.Star.ToIconString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
UiHelpers.DrawFavoriteStar(_favorites, Items[globalIdx].Key);
|
||||
}
|
||||
protected override float AdditionalSpace
|
||||
=> AwesomeIcon.Font.CalculateTextSize(LunaStyle.FavoriteIcon.Span).X + 4 * Im.Style.GlobalScale;
|
||||
|
||||
Im.Line.Same();
|
||||
}
|
||||
protected override bool DrawItem(in Item item, int globalIndex, bool selected)
|
||||
{
|
||||
if (globalIndex is 0)
|
||||
Im.Dummy(AwesomeIcon.Font.CalculateTextSize(LunaStyle.FavoriteIcon.Span));
|
||||
else
|
||||
UiHelpers.DrawFavoriteStar(favorites, item.Id);
|
||||
Im.Line.Same(0, 4 * Im.Style.GlobalScale);
|
||||
|
||||
var buttonWidth = Im.ContentRegion.Available.X;
|
||||
var totalWidth = ImGui.GetContentRegionMax().X;
|
||||
using var style = ImRaii.PushStyle(ImGuiStyleVar.ButtonTextAlign, new Vector2(buttonWidth / 2 / totalWidth, 0.5f));
|
||||
|
||||
return base.DrawSelectable(globalIdx, selected);
|
||||
var totalWidth = Im.ContentRegion.Maximum.X;
|
||||
using var style = ImStyleDouble.ButtonTextAlign.PushX(buttonWidth / 2 / totalWidth);
|
||||
return base.DrawItem(item, globalIndex, selected);
|
||||
}
|
||||
|
||||
private static Func<IReadOnlyList<KeyValuePair<byte, (string Name, uint Color, bool Gloss)>>> CreateFunc(DictStain stains,
|
||||
FavoriteManager favorites)
|
||||
=> () => stains.Select(kvp => (kvp, favorites.Contains(kvp.Key))).OrderBy(p => !p.Item2).Select(p => p.kvp)
|
||||
.Prepend(new KeyValuePair<StainId, Stain>(Stain.None.RowIndex, Stain.None)).Select(kvp
|
||||
=> new KeyValuePair<byte, (string, uint, bool)>(kvp.Key.Id, (kvp.Value.Name, kvp.Value.RgbaColor, kvp.Value.Gloss))).ToList();
|
||||
protected override void PreDrawCombo(float width)
|
||||
{
|
||||
base.PreDrawCombo(width);
|
||||
Style.Push(ImGuiColor.Text, CurrentSelection.Color.ContrastColor(), !CurrentSelection.Color.IsTransparent);
|
||||
}
|
||||
|
||||
protected override void PostDrawCombo(float width)
|
||||
{
|
||||
if (!CurrentSelection.Color.IsTransparent)
|
||||
Style.PopColor();
|
||||
base.PostDrawCombo(width);
|
||||
}
|
||||
|
||||
public bool Draw(Utf8StringHandler<LabelStringHandlerBuffer> label, in Stain current, out Stain newStain, float width)
|
||||
{
|
||||
// Push the preview color.
|
||||
using var color = ImGuiColor.FrameBackground.Push(current.RgbaColor, !current.RgbaColor.IsTransparent);
|
||||
|
||||
// Set the current selection only for the IsSelected and Gloss checks.
|
||||
CurrentSelection = new Item(current.Name, current.RgbaColor, current.RowIndex.Id, current.Gloss);
|
||||
|
||||
// Skip the named preview if it does not fit.
|
||||
var name = Im.Font.CalculateSize(current.Name).X <= width && !current.RgbaColor.IsTransparent ? current.Name : StringU8.Empty;
|
||||
if (base.Draw(label, name, StringU8.Empty, width, out var newItem))
|
||||
{
|
||||
if (newItem.Id is 0)
|
||||
newStain = Stain.None;
|
||||
else if (!stains.TryGetValue(newItem.Id, out newStain))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
newStain = current;
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override IEnumerable<Item> GetItems()
|
||||
=> stains.Select(kvp => (new Item(kvp.Value.Name, kvp.Value.RgbaColor, kvp.Key.Id, kvp.Value.Gloss), favorites.Contains(kvp.Key)))
|
||||
.OrderBy(p => !p.Item2)
|
||||
.Select(p => p.Item1)
|
||||
.Prepend(None);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,22 @@
|
|||
using Dalamud.Game.ClientState.Objects.Enums;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using ImSharp;
|
||||
using Penumbra.GameData.Actors;
|
||||
using Penumbra.GameData.DataContainers;
|
||||
using Penumbra.GameData.Gui;
|
||||
using Penumbra.GameData.Structs;
|
||||
using Penumbra.String;
|
||||
|
||||
namespace Glamourer.Gui.Tabs.AutomationTab;
|
||||
|
||||
public class IdentifierDrawer
|
||||
public class IdentifierDrawer(
|
||||
ActorManager actors,
|
||||
DictWorld dictWorld,
|
||||
DictModelChara dictModelChara,
|
||||
DictBNpcNames bNpcNames,
|
||||
DictBNpc bNpc,
|
||||
HumanModelList humans)
|
||||
{
|
||||
private readonly WorldCombo _worldCombo;
|
||||
private readonly HumanNpcCombo _humanNpcCombo;
|
||||
private readonly ActorManager _actors;
|
||||
private readonly WorldCombo _worldCombo = new(dictWorld);
|
||||
private readonly HumanNpcCombo _humanNpcCombo = new("##npcs", dictModelChara, bNpcNames, bNpc, humans, Glamourer.Log);
|
||||
|
||||
private string _characterName = string.Empty;
|
||||
|
||||
|
|
@ -22,18 +26,10 @@ public class IdentifierDrawer
|
|||
public ActorIdentifier MannequinIdentifier { get; private set; } = ActorIdentifier.Invalid;
|
||||
public ActorIdentifier OwnedIdentifier { get; private set; } = ActorIdentifier.Invalid;
|
||||
|
||||
public IdentifierDrawer(ActorManager actors, DictWorld dictWorld, DictModelChara dictModelChara, DictBNpcNames bNpcNames, DictBNpc bNpc,
|
||||
HumanModelList humans)
|
||||
{
|
||||
_actors = actors;
|
||||
_worldCombo = new WorldCombo(dictWorld);
|
||||
_humanNpcCombo = new HumanNpcCombo("##npcs", dictModelChara, bNpcNames, bNpc, humans, Glamourer.Log);
|
||||
}
|
||||
|
||||
public void DrawName(float width)
|
||||
{
|
||||
ImGui.SetNextItemWidth(width);
|
||||
if (ImGui.InputTextWithHint("##Name", "Character Name...", ref _characterName, 32))
|
||||
Im.Item.SetNextWidth(width);
|
||||
if (Im.Input.Text("##Name"u8, ref _characterName, "Character Name..."u8))
|
||||
UpdateIdentifiers();
|
||||
}
|
||||
|
||||
|
|
@ -68,18 +64,19 @@ public class IdentifierDrawer
|
|||
{
|
||||
if (ByteString.FromString(_characterName, out var byteName))
|
||||
{
|
||||
PlayerIdentifier = _actors.CreatePlayer(byteName, _worldCombo.Selected.Key);
|
||||
RetainerIdentifier = _actors.CreateRetainer(byteName, ActorIdentifier.RetainerType.Bell);
|
||||
MannequinIdentifier = _actors.CreateRetainer(byteName, ActorIdentifier.RetainerType.Mannequin);
|
||||
PlayerIdentifier = actors.CreatePlayer(byteName, _worldCombo.Selected.Key);
|
||||
RetainerIdentifier = actors.CreateRetainer(byteName, ActorIdentifier.RetainerType.Bell);
|
||||
MannequinIdentifier = actors.CreateRetainer(byteName, ActorIdentifier.RetainerType.Mannequin);
|
||||
|
||||
if (_humanNpcCombo.CurrentSelection.Kind is ObjectKind.EventNpc or ObjectKind.BattleNpc)
|
||||
OwnedIdentifier = _actors.CreateOwned(byteName, _worldCombo.Selected.Key, _humanNpcCombo.CurrentSelection.Kind, _humanNpcCombo.CurrentSelection.Ids[0]);
|
||||
OwnedIdentifier = actors.CreateOwned(byteName, _worldCombo.Selected.Key, _humanNpcCombo.CurrentSelection.Kind,
|
||||
_humanNpcCombo.CurrentSelection.Ids[0]);
|
||||
else
|
||||
OwnedIdentifier = ActorIdentifier.Invalid;
|
||||
}
|
||||
|
||||
NpcIdentifier = _humanNpcCombo.CurrentSelection.Kind is ObjectKind.EventNpc or ObjectKind.BattleNpc
|
||||
? _actors.CreateNpc(_humanNpcCombo.CurrentSelection.Kind, _humanNpcCombo.CurrentSelection.Ids[0])
|
||||
? actors.CreateNpc(_humanNpcCombo.CurrentSelection.Kind, _humanNpcCombo.CurrentSelection.Ids[0])
|
||||
: ActorIdentifier.Invalid;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,11 @@
|
|||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Glamourer.Automation;
|
||||
using Glamourer.Automation;
|
||||
using Glamourer.Designs;
|
||||
using Glamourer.Designs.Special;
|
||||
using Glamourer.Interop;
|
||||
using Glamourer.Services;
|
||||
using Glamourer.Unlocks;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using ImSharp;
|
||||
using OtterGui;
|
||||
using OtterGui.Extensions;
|
||||
using OtterGui.Log;
|
||||
using OtterGui.Raii;
|
||||
using OtterGui.Text;
|
||||
using Luna;
|
||||
using OtterGui.Widgets;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Structs;
|
||||
|
|
@ -45,7 +38,7 @@ public class SetPanel(
|
|||
|
||||
public void Draw()
|
||||
{
|
||||
using var group = ImRaii.Group();
|
||||
using var group = Im.Group();
|
||||
DrawHeader();
|
||||
DrawPanel();
|
||||
}
|
||||
|
|
@ -55,59 +48,45 @@ public class SetPanel(
|
|||
|
||||
private void DrawPanel()
|
||||
{
|
||||
using var child = ImUtf8.Child("##Panel"u8, -Vector2.One, true);
|
||||
using var child = Im.Child.Begin("##Panel"u8, Im.ContentRegion.Available, true);
|
||||
if (!child || !selector.HasSelection)
|
||||
return;
|
||||
|
||||
var spacing = Im.Style.ItemInnerSpacing with { Y = Im.Style.ItemSpacing.Y };
|
||||
|
||||
using (ImUtf8.Group())
|
||||
using (Im.Group())
|
||||
{
|
||||
using (ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, spacing))
|
||||
{
|
||||
var enabled = Selection.Enabled;
|
||||
if (ImUtf8.Checkbox("##Enabled"u8, ref enabled))
|
||||
manager.SetState(selector.SelectionIndex, enabled);
|
||||
ImUtf8.LabeledHelpMarker("Enabled"u8,
|
||||
"Whether the designs in this set should be applied at all. Only one set can be enabled for a character at the same time."u8);
|
||||
}
|
||||
var enabled = Selection.Enabled;
|
||||
if (Im.Checkbox("##Enabled"u8, ref enabled))
|
||||
manager.SetState(selector.SelectionIndex, enabled);
|
||||
LunaStyle.DrawAlignedHelpMarkerLabel("Enabled"u8,
|
||||
"Whether the designs in this set should be applied at all. Only one set can be enabled for a character at the same time."u8);
|
||||
|
||||
using (ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, spacing))
|
||||
{
|
||||
var useGame = selector.Selection!.BaseState is AutoDesignSet.Base.Game;
|
||||
if (ImUtf8.Checkbox("##gameState"u8, ref useGame))
|
||||
manager.ChangeBaseState(selector.SelectionIndex, useGame ? AutoDesignSet.Base.Game : AutoDesignSet.Base.Current);
|
||||
ImUtf8.LabeledHelpMarker("Use Game State as Base"u8,
|
||||
"When this is enabled, the designs matching conditions will be applied successively on top of what your character is supposed to look like for the game. "u8
|
||||
+ "Otherwise, they will be applied on top of the characters actual current look using Glamourer."u8);
|
||||
}
|
||||
var useGame = selector.Selection!.BaseState is AutoDesignSet.Base.Game;
|
||||
if (Im.Checkbox("##gameState"u8, ref useGame))
|
||||
manager.ChangeBaseState(selector.SelectionIndex, useGame ? AutoDesignSet.Base.Game : AutoDesignSet.Base.Current);
|
||||
LunaStyle.DrawAlignedHelpMarkerLabel("Use Game State as Base"u8,
|
||||
"When this is enabled, the designs matching conditions will be applied successively on top of what your character is supposed to look like for the game. "u8
|
||||
+ "Otherwise, they will be applied on top of the characters actual current look using Glamourer."u8);
|
||||
}
|
||||
|
||||
Im.Line.Same();
|
||||
using (ImUtf8.Group())
|
||||
using (Im.Group())
|
||||
{
|
||||
using (ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, spacing))
|
||||
var editing = config.ShowAutomationSetEditing;
|
||||
if (Im.Checkbox("##Show Editing"u8, ref editing))
|
||||
{
|
||||
var editing = config.ShowAutomationSetEditing;
|
||||
if (ImUtf8.Checkbox("##Show Editing"u8, ref editing))
|
||||
{
|
||||
config.ShowAutomationSetEditing = editing;
|
||||
config.Save();
|
||||
}
|
||||
|
||||
ImUtf8.LabeledHelpMarker("Show Editing"u8,
|
||||
"Show options to change the name or the associated character or NPC of this design set."u8);
|
||||
config.ShowAutomationSetEditing = editing;
|
||||
config.Save();
|
||||
}
|
||||
|
||||
using (ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, spacing))
|
||||
{
|
||||
var resetSettings = selector.Selection!.ResetTemporarySettings;
|
||||
if (ImGui.Checkbox("##resetSettings", ref resetSettings))
|
||||
manager.ChangeResetSettings(selector.SelectionIndex, resetSettings);
|
||||
LunaStyle.DrawAlignedHelpMarkerLabel("Show Editing"u8,
|
||||
"Show options to change the name or the associated character or NPC of this design set."u8);
|
||||
|
||||
ImUtf8.LabeledHelpMarker("Reset Temporary Settings"u8,
|
||||
"Always reset all temporary settings applied by Glamourer when this automation set is applied, regardless of active designs."u8);
|
||||
}
|
||||
var resetSettings = selector.Selection!.ResetTemporarySettings;
|
||||
if (Im.Checkbox("##resetSettings"u8, ref resetSettings))
|
||||
manager.ChangeResetSettings(selector.SelectionIndex, resetSettings);
|
||||
|
||||
LunaStyle.DrawAlignedHelpMarkerLabel("Reset Temporary Settings"u8,
|
||||
"Always reset all temporary settings applied by Glamourer when this automation set is applied, regardless of active designs."u8);
|
||||
}
|
||||
|
||||
if (config.ShowAutomationSetEditing)
|
||||
|
|
@ -118,11 +97,11 @@ public class SetPanel(
|
|||
|
||||
var name = _tempName ?? Selection.Name;
|
||||
var flags = selector.IncognitoMode ? InputTextFlags.ReadOnly | InputTextFlags.Password : InputTextFlags.None;
|
||||
ImGui.SetNextItemWidth(330 * Im.Style.GlobalScale);
|
||||
Im.Item.SetNextWidthScaled(330);
|
||||
if (Im.Input.Text("Rename Set##Name"u8, ref name, StringU8.Empty, flags))
|
||||
_tempName = name;
|
||||
|
||||
if (ImGui.IsItemDeactivated())
|
||||
if (Im.Item.Deactivated)
|
||||
{
|
||||
manager.Rename(selector.SelectionIndex, name);
|
||||
_tempName = null;
|
||||
|
|
@ -134,11 +113,11 @@ public class SetPanel(
|
|||
Im.Dummy(Vector2.Zero);
|
||||
Im.Separator();
|
||||
Im.Dummy(Vector2.Zero);
|
||||
|
||||
DrawDesignTable();
|
||||
randomDrawer.Draw();
|
||||
}
|
||||
|
||||
|
||||
private void DrawDesignTable()
|
||||
{
|
||||
var (numCheckboxes, numSpacing) = (config.ShowAllAutomatedApplicationRules, config.ShowUnlockedItemWarnings) switch
|
||||
|
|
@ -177,17 +156,17 @@ public class SetPanel(
|
|||
table.SetupColumn("Application"u8, TableColumnFlags.WidthFixed,
|
||||
6 * Im.Style.FrameHeight + 10 * Im.Style.GlobalScale);
|
||||
else
|
||||
table.SetupColumn("Use"u8, TableColumnFlags.WidthFixed, ImGui.CalcTextSize("Use").X);
|
||||
table.SetupColumn("Use"u8, TableColumnFlags.WidthFixed, Im.Font.CalculateSize("Use"u8).X);
|
||||
}
|
||||
else
|
||||
{
|
||||
table.SetupColumn("Design / Job Restrictions"u8, TableColumnFlags.WidthFixed,
|
||||
250 * Im.Style.GlobalScale - (ImGui.GetScrollMaxY() > 0 ? Im.Style.ScrollbarSize : 0));
|
||||
250 * Im.Style.GlobalScale - (Im.Scroll.MaximumY > 0 ? Im.Style.ScrollbarSize : 0));
|
||||
if (config.ShowAllAutomatedApplicationRules)
|
||||
table.SetupColumn("Application"u8, TableColumnFlags.WidthFixed,
|
||||
3 * Im.Style.FrameHeight + 4 * Im.Style.GlobalScale);
|
||||
else
|
||||
table.SetupColumn("Use"u8, TableColumnFlags.WidthFixed, ImGui.CalcTextSize("Use").X);
|
||||
table.SetupColumn("Use"u8, TableColumnFlags.WidthFixed, Im.Font.CalculateSize("Use"u8).X);
|
||||
}
|
||||
|
||||
if (singleRow)
|
||||
|
|
@ -197,51 +176,48 @@ public class SetPanel(
|
|||
table.SetupColumn(""u8, TableColumnFlags.WidthFixed, 2 * Im.Style.FrameHeight + 4 * Im.Style.GlobalScale);
|
||||
|
||||
table.HeaderRow();
|
||||
foreach (var (design, idx) in Selection.Designs.WithIndex())
|
||||
foreach (var (idx, design) in Selection.Designs.Index())
|
||||
{
|
||||
using var id = ImUtf8.PushId(idx);
|
||||
ImGui.TableNextColumn();
|
||||
using var id = Im.Id.Push(idx);
|
||||
table.NextColumn();
|
||||
var keyValid = config.DeleteDesignModifier.IsActive();
|
||||
var tt = keyValid
|
||||
? "Remove this design from the set."
|
||||
: $"Remove this design from the set.\nHold {config.DeleteDesignModifier} to remove.";
|
||||
|
||||
if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Trash.ToIconString(), new Vector2(Im.Style.FrameHeight), tt, !keyValid, true))
|
||||
if (ImEx.Icon.Button(LunaStyle.DeleteIcon, "Remove this design from the set."u8, !keyValid))
|
||||
_endAction = () => manager.DeleteDesign(Selection, idx);
|
||||
ImGui.TableNextColumn();
|
||||
if(!keyValid)
|
||||
Im.Tooltip.OnHover(HoveredFlags.AllowWhenDisabled, $"Hold {config.DeleteDesignModifier} to remove.");
|
||||
table.NextColumn();
|
||||
DrawSelectable(idx, design.Design);
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
table.NextColumn();
|
||||
DrawRandomEditing(Selection, design, idx);
|
||||
designCombo.Draw(Selection, design, idx);
|
||||
DrawDragDrop(Selection, idx);
|
||||
if (singleRow)
|
||||
{
|
||||
ImGui.TableNextColumn();
|
||||
table.NextColumn();
|
||||
DrawApplicationTypeBoxes(Selection, design, idx, singleRow);
|
||||
ImGui.TableNextColumn();
|
||||
table.NextColumn();
|
||||
DrawConditions(design, idx);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawConditions(design, idx);
|
||||
ImGui.TableNextColumn();
|
||||
table.NextColumn();
|
||||
DrawApplicationTypeBoxes(Selection, design, idx, singleRow);
|
||||
}
|
||||
|
||||
if (config.ShowUnlockedItemWarnings)
|
||||
{
|
||||
ImGui.TableNextColumn();
|
||||
table.NextColumn();
|
||||
DrawWarnings(design);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
ImUtf8.TextFrameAligned("New"u8);
|
||||
ImGui.TableNextColumn();
|
||||
table.NextColumn();
|
||||
table.DrawFrameColumn("New"u8);
|
||||
table.NextColumn();
|
||||
designCombo.Draw(Selection, null, -1);
|
||||
ImGui.TableNextRow();
|
||||
table.NextRow();
|
||||
|
||||
_endAction?.Invoke();
|
||||
_endAction = null;
|
||||
|
|
@ -250,7 +226,7 @@ public class SetPanel(
|
|||
private void DrawSelectable(int idx, IDesignStandIn design)
|
||||
{
|
||||
var highlight = Rgba32.Transparent;
|
||||
var sb = new StringBuilder();
|
||||
var sb = new StringBuilder();
|
||||
if (design is Design d)
|
||||
{
|
||||
var count = design.AllLinks(true).Count();
|
||||
|
|
@ -277,45 +253,31 @@ public class SetPanel(
|
|||
|
||||
using (ImGuiColor.Text.Push(highlight, highlight.IsTransparent))
|
||||
{
|
||||
ImUtf8.Selectable($"#{idx + 1:D2}");
|
||||
Im.Selectable($"#{idx + 1:D2}");
|
||||
}
|
||||
|
||||
ImUtf8.HoverTooltip($"{sb}");
|
||||
Im.Tooltip.OnHover($"{sb}");
|
||||
|
||||
DrawDragDrop(Selection, idx);
|
||||
}
|
||||
|
||||
private int _tmpGearset = int.MaxValue;
|
||||
private int _whichIndex = -1;
|
||||
|
||||
private void DrawConditions(AutoDesign design, int idx)
|
||||
{
|
||||
var usingGearset = design.GearsetIndex >= 0;
|
||||
if (ImUtf8.Button($"{(usingGearset ? "Gearset:" : "Jobs:")}##usingGearset"))
|
||||
if (Im.Button(usingGearset ? "Gearset:##usingGearset"u8 : "Jobs:##usingGearset"u8))
|
||||
{
|
||||
usingGearset = !usingGearset;
|
||||
manager.ChangeGearsetCondition(Selection, idx, (short)(usingGearset ? 0 : -1));
|
||||
}
|
||||
|
||||
ImUtf8.HoverTooltip("Click to switch between Job and Gearset restrictions."u8);
|
||||
Im.Tooltip.OnHover("Click to switch between Job and Gearset restrictions."u8);
|
||||
|
||||
ImGui.SameLine(0, Im.Style.ItemInnerSpacing.X);
|
||||
Im.Line.SameInner();
|
||||
if (usingGearset)
|
||||
{
|
||||
var set = 1 + (_tmpGearset == int.MaxValue || _whichIndex != idx ? design.GearsetIndex : _tmpGearset);
|
||||
ImGui.SetNextItemWidth(Im.ContentRegion.Available.X);
|
||||
if (ImUtf8.InputScalar("##whichGearset"u8, ref set))
|
||||
{
|
||||
_whichIndex = idx;
|
||||
_tmpGearset = Math.Clamp(set, 1, 100);
|
||||
}
|
||||
|
||||
if (ImGui.IsItemDeactivatedAfterEdit())
|
||||
{
|
||||
manager.ChangeGearsetCondition(Selection, idx, (short)(_tmpGearset - 1));
|
||||
_tmpGearset = int.MaxValue;
|
||||
_whichIndex = -1;
|
||||
}
|
||||
Im.Item.SetNextWidthFull();
|
||||
if (ImEx.InputOnDeactivation.Scalar("##whichGearset"u8, design.GearsetIndex + 1, out var newIndex))
|
||||
manager.ChangeGearsetCondition(Selection, idx, (short)(Math.Clamp(newIndex, 1, 100) - 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -329,7 +291,7 @@ public class SetPanel(
|
|||
return;
|
||||
|
||||
randomDrawer.DrawButton(set, designIdx);
|
||||
ImGui.SameLine(0, Im.Style.ItemInnerSpacing.X);
|
||||
Im.Line.SameInner();
|
||||
}
|
||||
|
||||
private void DrawWarnings(AutoDesign design)
|
||||
|
|
@ -354,12 +316,12 @@ public class SetPanel(
|
|||
sb.AppendLine($"{item.Name} in {slot.ToName()} slot is not unlocked. Consider obtaining it via gameplay means!");
|
||||
}
|
||||
|
||||
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, new Vector2(2 * Im.Style.GlobalScale, 0));
|
||||
using var style = ImStyleDouble.ItemSpacing.Push(new Vector2(2 * Im.Style.GlobalScale, 0));
|
||||
|
||||
var tt = config.UnlockedItemMode
|
||||
? "\nThese items will be skipped when applied automatically.\n\nTo change this, disable the Obtained Item Mode setting."
|
||||
: string.Empty;
|
||||
DrawWarning(sb, config.UnlockedItemMode ? 0xA03030F0 : 0x0, size, tt, "All equipment to be applied is unlocked.");
|
||||
DrawWarning(sb, config.UnlockedItemMode ? 0xA03030F0 : 0x0, size, tt, "All equipment to be applied is unlocked."u8);
|
||||
|
||||
sb.Clear();
|
||||
var sb2 = new StringBuilder();
|
||||
|
|
@ -387,37 +349,36 @@ public class SetPanel(
|
|||
tt = config.UnlockedItemMode
|
||||
? "\nThese customizations will be skipped when applied automatically.\n\nTo change this, disable the Obtained Item Mode setting."
|
||||
: string.Empty;
|
||||
DrawWarning(sb2, config.UnlockedItemMode ? 0xA03030F0 : 0x0, size, tt, "All customizations to be applied are unlocked.");
|
||||
DrawWarning(sb2, config.UnlockedItemMode ? 0xA03030F0 : 0x0, size, tt, "All customizations to be applied are unlocked."u8);
|
||||
Im.Line.Same();
|
||||
return;
|
||||
|
||||
static void DrawWarning(StringBuilder sb, uint color, Vector2 size, string suffix, string good)
|
||||
static void DrawWarning(StringBuilder sb, Rgba32 color, Vector2 size, string suffix, ReadOnlySpan<byte> good)
|
||||
{
|
||||
using var style = ImRaii.PushStyle(ImGuiStyleVar.FrameBorderSize, Im.Style.GlobalScale);
|
||||
using var style = ImStyleSingle.FrameBorderThickness.Push(Im.Style.GlobalScale);
|
||||
if (sb.Length > 0)
|
||||
{
|
||||
sb.Append(suffix);
|
||||
using (_ = ImRaii.PushFont(UiBuilder.IconFont))
|
||||
using (AwesomeIcon.Font.Push())
|
||||
{
|
||||
ImGuiUtil.DrawTextButton(FontAwesomeIcon.ExclamationCircle.ToIconString(), size, color);
|
||||
ImEx.TextFramed(LunaStyle.WarningIcon.Span, size, color);
|
||||
}
|
||||
|
||||
ImUtf8.HoverTooltip($"{sb}");
|
||||
Im.Tooltip.OnHover($"{sb}");
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGuiUtil.DrawTextButton(string.Empty, size, 0);
|
||||
ImUtf8.HoverTooltip(good);
|
||||
ImEx.TextFramed(StringU8.Empty, size, Rgba32.Transparent);
|
||||
Im.Tooltip.OnHover(good);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawDragDrop(AutoDesignSet set, int index)
|
||||
{
|
||||
const string dragDropLabel = "DesignDragDrop";
|
||||
using (var target = ImUtf8.DragDropTarget())
|
||||
using (var target = Im.DragDrop.Target())
|
||||
{
|
||||
if (target.Success && ImGuiUtil.IsDropping(dragDropLabel))
|
||||
if (target.IsDropping("DesignDragDrop"u8))
|
||||
{
|
||||
if (_dragIndex >= 0)
|
||||
{
|
||||
|
|
@ -429,14 +390,14 @@ public class SetPanel(
|
|||
}
|
||||
}
|
||||
|
||||
using (var source = ImUtf8.DragDropSource())
|
||||
using (var source = Im.DragDrop.Source())
|
||||
{
|
||||
if (source)
|
||||
{
|
||||
ImUtf8.Text($"Moving design #{index + 1:D2}...");
|
||||
if (ImGui.SetDragDropPayload(dragDropLabel, null, 0))
|
||||
Im.Text($"Moving design #{index + 1:D2}...");
|
||||
if (source.SetPayload("DesignDragDrop"u8))
|
||||
{
|
||||
_dragIndex = index;
|
||||
_dragIndex = index;
|
||||
selector.DragDesignIndex = index;
|
||||
}
|
||||
}
|
||||
|
|
@ -445,26 +406,25 @@ public class SetPanel(
|
|||
|
||||
private void DrawApplicationTypeBoxes(AutoDesignSet set, AutoDesign design, int autoDesignIndex, bool singleLine)
|
||||
{
|
||||
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, new Vector2(2 * Im.Style.GlobalScale));
|
||||
using var style = ImStyleDouble.ItemSpacing.Push(new Vector2(2 * Im.Style.GlobalScale));
|
||||
var newType = design.Type;
|
||||
var newTypeInt = (uint)newType;
|
||||
using (ImStyleBorder.Frame.Push(ColorId.FolderLine.Value()))
|
||||
{
|
||||
if (ImGui.CheckboxFlags("##all", ref newTypeInt, (uint)ApplicationType.All))
|
||||
newType = (ApplicationType)newTypeInt;
|
||||
Im.Checkbox("##all"u8, ref newType, ApplicationType.All);
|
||||
}
|
||||
|
||||
style.Pop();
|
||||
ImUtf8.HoverTooltip("Toggle all application modes at once."u8);
|
||||
Im.Tooltip.OnHover("Toggle all application modes at once."u8);
|
||||
if (config.ShowAllAutomatedApplicationRules)
|
||||
{
|
||||
void Box(int idx)
|
||||
{
|
||||
var (type, description) = ApplicationTypeExtensions.Types[idx];
|
||||
var value = design.Type.HasFlag(type);
|
||||
if (ImUtf8.Checkbox($"##{(byte)type}", ref value))
|
||||
using var id = Im.Id.Push((uint)type);
|
||||
var value = design.Type.HasFlag(type);
|
||||
if (Im.Checkbox(StringU8.Empty, ref value))
|
||||
newType = value ? newType | type : newType & ~type;
|
||||
ImUtf8.HoverTooltip(description);
|
||||
Im.Tooltip.OnHover(description);
|
||||
}
|
||||
|
||||
Im.Line.Same();
|
||||
|
|
@ -486,29 +446,29 @@ public class SetPanel(
|
|||
|
||||
private void DrawIdentifierSelection(int setIndex)
|
||||
{
|
||||
using var id = ImUtf8.PushId("Identifiers"u8);
|
||||
using var id = Im.Id.Push("Identifiers"u8);
|
||||
identifierDrawer.DrawWorld(130);
|
||||
Im.Line.Same();
|
||||
identifierDrawer.DrawName(200 - Im.Style.ItemSpacing.X);
|
||||
identifierDrawer.DrawNpcs(330);
|
||||
var buttonWidth = new Vector2(165 * Im.Style.GlobalScale - Im.Style.ItemSpacing.X / 2, 0);
|
||||
if (ImUtf8.ButtonEx("Set to Character"u8, string.Empty, buttonWidth, !identifierDrawer.CanSetPlayer))
|
||||
if (ImEx.Button("Set to Character"u8, buttonWidth, StringU8.Empty, !identifierDrawer.CanSetPlayer))
|
||||
manager.ChangeIdentifier(setIndex, identifierDrawer.PlayerIdentifier);
|
||||
Im.Line.Same();
|
||||
if (ImUtf8.ButtonEx("Set to NPC"u8, string.Empty, buttonWidth, !identifierDrawer.CanSetNpc))
|
||||
if (ImEx.Button("Set to NPC"u8, buttonWidth, StringU8.Empty, !identifierDrawer.CanSetNpc))
|
||||
manager.ChangeIdentifier(setIndex, identifierDrawer.NpcIdentifier);
|
||||
|
||||
if (ImUtf8.ButtonEx("Set to Retainer"u8, string.Empty, buttonWidth, !identifierDrawer.CanSetRetainer))
|
||||
if (ImEx.Button("Set to Retainer"u8, buttonWidth, StringU8.Empty, !identifierDrawer.CanSetRetainer))
|
||||
manager.ChangeIdentifier(setIndex, identifierDrawer.RetainerIdentifier);
|
||||
Im.Line.Same();
|
||||
if (ImUtf8.ButtonEx("Set to Mannequin"u8, string.Empty, buttonWidth, !identifierDrawer.CanSetRetainer))
|
||||
if (ImEx.Button("Set to Mannequin"u8, buttonWidth, StringU8.Empty, !identifierDrawer.CanSetRetainer))
|
||||
manager.ChangeIdentifier(setIndex, identifierDrawer.MannequinIdentifier);
|
||||
|
||||
if (ImUtf8.ButtonEx("Set to Owned NPC"u8, string.Empty, buttonWidth, !identifierDrawer.CanSetOwned))
|
||||
if (ImEx.Button("Set to Owned NPC"u8, buttonWidth, StringU8.Empty, !identifierDrawer.CanSetOwned))
|
||||
manager.ChangeIdentifier(setIndex, identifierDrawer.OwnedIdentifier);
|
||||
}
|
||||
|
||||
private sealed class JobGroupCombo(AutoDesignManager manager, JobService jobs, Logger log)
|
||||
private sealed class JobGroupCombo(AutoDesignManager manager, JobService jobs, OtterGui.Log.Logger log)
|
||||
: FilterComboCache<JobGroup>(() => jobs.JobGroups.Values.ToList(), MouseWheelType.None, log)
|
||||
{
|
||||
public void Draw(AutoDesignSet set, AutoDesign design, int autoDesignIndex)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using Luna;
|
|||
|
||||
namespace Glamourer.Gui.Tabs.DebugTab;
|
||||
|
||||
public sealed class DatFilePanel : IGameDataDrawer
|
||||
public sealed class DatFilePanel(ImportService importService) : IGameDataDrawer
|
||||
{
|
||||
public ReadOnlySpan<byte> Label
|
||||
=> "Character Dat File"u8;
|
||||
|
|
@ -14,7 +14,7 @@ public sealed class DatFilePanel : IGameDataDrawer
|
|||
public bool Disabled
|
||||
=> false;
|
||||
|
||||
public sealed class Cache(ImportService importService) : BasicCache(TimeSpan.FromMinutes(10)), IService
|
||||
private sealed class Cache(ImportService importService) : BasicCache(TimeSpan.FromMinutes(10))
|
||||
{
|
||||
private string _datFilePath = string.Empty;
|
||||
private DatCharacterFile? _datFile;
|
||||
|
|
@ -48,7 +48,7 @@ public sealed class DatFilePanel : IGameDataDrawer
|
|||
|
||||
public void Draw()
|
||||
{
|
||||
var cache = CacheManager.Instance.GetOrCreateCache<Cache>(Im.Id.Current);
|
||||
var cache = CacheManager.Instance.GetOrCreateCache(Im.Id.Current, () => new Cache(importService));
|
||||
cache.Draw();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public sealed class DebugTab(ServiceManager manager) : ITab<MainTabType>
|
|||
return;
|
||||
|
||||
if (Im.Tree.Header("General"u8))
|
||||
StartTimeTracker.Draw("Timers"u8);
|
||||
StartTimeTracker.Draw("Timers"u8, manager.GetService<StartTimeTracker>());
|
||||
|
||||
foreach (var header in _headers)
|
||||
header.Draw();
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using Penumbra.GameData.Gui.Debug;
|
|||
|
||||
namespace Glamourer.Gui.Tabs.DebugTab;
|
||||
|
||||
public sealed class DesignConverterPanel : IGameDataDrawer
|
||||
public sealed class DesignConverterPanel(DesignConverter designConverter) : IGameDataDrawer
|
||||
{
|
||||
public ReadOnlySpan<byte> Label
|
||||
=> "Design Converter"u8;
|
||||
|
|
@ -15,7 +15,7 @@ public sealed class DesignConverterPanel : IGameDataDrawer
|
|||
public bool Disabled
|
||||
=> false;
|
||||
|
||||
public sealed class Cache(DesignConverter designConverter) : BasicCache(TimeSpan.FromMinutes(10), IManagedCache.DirtyFlags.Clean), IService
|
||||
private sealed class Cache(DesignConverter designConverter) : BasicCache(TimeSpan.FromMinutes(10), IManagedCache.DirtyFlags.Clean), IService
|
||||
{
|
||||
private StringU8 _clipboardText = StringU8.Empty;
|
||||
private StringU8 _clipboardData = StringU8.Empty;
|
||||
|
|
@ -96,7 +96,7 @@ public sealed class DesignConverterPanel : IGameDataDrawer
|
|||
|
||||
public void Draw()
|
||||
{
|
||||
var cache = CacheManager.Instance.GetOrCreateCache<Cache>(Im.Id.Current);
|
||||
var cache = CacheManager.Instance.GetOrCreateCache(Im.Id.Current, () => new Cache(designConverter));
|
||||
cache.Draw();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,8 @@
|
|||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin;
|
||||
using Glamourer.Api.Enums;
|
||||
using Glamourer.Api.IpcSubscribers;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using ImSharp;
|
||||
using Luna;
|
||||
using OtterGui;
|
||||
using OtterGui.Raii;
|
||||
using OtterGui.Text;
|
||||
|
||||
namespace Glamourer.Gui.Tabs.DebugTab.IpcTester;
|
||||
|
||||
|
|
@ -21,104 +15,100 @@ public class DesignIpcTester(IDalamudPluginInterface pluginInterface) : IUiServi
|
|||
private uint _key;
|
||||
private ApplyFlag _flags = ApplyFlagEx.DesignDefault;
|
||||
private Guid? _design;
|
||||
private string _designText = string.Empty;
|
||||
private GlamourerApiEc _lastError;
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
using var tree = ImRaii.TreeNode("Designs");
|
||||
using var tree = Im.Tree.Node("Designs"u8);
|
||||
if (!tree)
|
||||
return;
|
||||
|
||||
IpcTesterHelpers.IndexInput(ref _gameObjectIndex);
|
||||
IpcTesterHelpers.KeyInput(ref _key);
|
||||
IpcTesterHelpers.NameInput(ref _gameObjectName);
|
||||
ImUtf8.InputText("##designName"u8, ref _designName, "Design Name..."u8);
|
||||
ImGuiUtil.GuidInput("##identifier", "Design Identifier...", string.Empty, ref _design, ref _designText,
|
||||
Im.ContentRegion.Available.X);
|
||||
Im.Input.Text("##designName"u8, ref _designName, "Design Name..."u8);
|
||||
ImEx.GuidInput("##identifier"u8, ref _design, Im.ContentRegion.Available.X);
|
||||
IpcTesterHelpers.DrawFlagInput(ref _flags);
|
||||
|
||||
using var table = Im.Table.Begin("##table"u8, 2, TableFlags.SizingFixedFit);
|
||||
|
||||
IpcTesterHelpers.DrawIntro("Last Error");
|
||||
ImGui.TextUnformatted(_lastError.ToString());
|
||||
IpcTesterHelpers.DrawIntro("Last Error"u8);
|
||||
Im.Text($"{_lastError}");
|
||||
|
||||
IpcTesterHelpers.DrawIntro(GetDesignList.Label);
|
||||
IpcTesterHelpers.DrawIntro(GetDesignList.LabelU8);
|
||||
DrawDesignsPopup();
|
||||
if (ImGui.Button("Get##Designs"))
|
||||
if (Im.Button("Get##Designs"u8))
|
||||
{
|
||||
_designs = new GetDesignList(pluginInterface).Invoke();
|
||||
ImGui.OpenPopup("Designs");
|
||||
Im.Popup.Open("Designs"u8);
|
||||
}
|
||||
|
||||
IpcTesterHelpers.DrawIntro(ApplyDesign.Label);
|
||||
if (ImGuiUtil.DrawDisabledButton("Apply##Idx", Vector2.Zero, string.Empty, !_design.HasValue))
|
||||
IpcTesterHelpers.DrawIntro(ApplyDesign.LabelU8);
|
||||
if (ImEx.Button("Apply##Idx"u8, Vector2.Zero, StringU8.Empty, !_design.HasValue))
|
||||
_lastError = new ApplyDesign(pluginInterface).Invoke(_design!.Value, _gameObjectIndex, _key, _flags);
|
||||
|
||||
IpcTesterHelpers.DrawIntro(ApplyDesignName.Label);
|
||||
if (ImGuiUtil.DrawDisabledButton("Apply##Name", Vector2.Zero, string.Empty, !_design.HasValue))
|
||||
IpcTesterHelpers.DrawIntro(ApplyDesignName.LabelU8);
|
||||
if (ImEx.Button("Apply##Name"u8, Vector2.Zero, StringU8.Empty, !_design.HasValue))
|
||||
_lastError = new ApplyDesignName(pluginInterface).Invoke(_design!.Value, _gameObjectName, _key, _flags);
|
||||
|
||||
IpcTesterHelpers.DrawIntro(GetExtendedDesignData.Label);
|
||||
IpcTesterHelpers.DrawIntro(GetExtendedDesignData.LabelU8);
|
||||
if (_design.HasValue)
|
||||
{
|
||||
var (display, path, color, draw) = new GetExtendedDesignData(pluginInterface).Invoke(_design.Value);
|
||||
if (path.Length > 0)
|
||||
ImUtf8.Text($"{display} ({path}){(draw ? " in QDB"u8 : ""u8)}", color);
|
||||
Im.Text($"{display} ({path}){(draw ? " in QDB"u8 : ""u8)}", color);
|
||||
else
|
||||
ImUtf8.Text("No Data"u8);
|
||||
Im.Text("No Data"u8);
|
||||
}
|
||||
else
|
||||
{
|
||||
ImUtf8.Text("No Data"u8);
|
||||
Im.Text("No Data"u8);
|
||||
}
|
||||
|
||||
IpcTesterHelpers.DrawIntro(GetDesignBase64.Label);
|
||||
if (ImUtf8.Button("To Clipboard##Base64"u8) && _design.HasValue)
|
||||
IpcTesterHelpers.DrawIntro(GetDesignBase64.LabelU8);
|
||||
if (Im.Button("To Clipboard##Base64"u8) && _design.HasValue)
|
||||
{
|
||||
var data = new GetDesignBase64(pluginInterface).Invoke(_design.Value);
|
||||
ImUtf8.SetClipboardText(data);
|
||||
if (data is not null)
|
||||
Im.Clipboard.Set(data);
|
||||
}
|
||||
|
||||
IpcTesterHelpers.DrawIntro(AddDesign.Label);
|
||||
if (ImUtf8.Button("Add from Clipboard"u8))
|
||||
IpcTesterHelpers.DrawIntro(AddDesign.LabelU8);
|
||||
if (Im.Button("Add from Clipboard"u8))
|
||||
try
|
||||
{
|
||||
var data = ImUtf8.GetClipboardText();
|
||||
var data = Im.Clipboard.GetUtf16();
|
||||
_lastError = new AddDesign(pluginInterface).Invoke(data, _designName, out var newDesign);
|
||||
if (_lastError is GlamourerApiEc.Success)
|
||||
{
|
||||
_design = newDesign;
|
||||
_designText = newDesign.ToString();
|
||||
}
|
||||
_design = newDesign;
|
||||
}
|
||||
catch
|
||||
{
|
||||
_lastError = GlamourerApiEc.UnknownError;
|
||||
}
|
||||
|
||||
IpcTesterHelpers.DrawIntro(DeleteDesign.Label);
|
||||
if (ImUtf8.Button("Delete##Design"u8) && _design.HasValue)
|
||||
IpcTesterHelpers.DrawIntro(DeleteDesign.LabelU8);
|
||||
if (Im.Button("Delete##Design"u8) && _design.HasValue)
|
||||
_lastError = new DeleteDesign(pluginInterface).Invoke(_design.Value);
|
||||
}
|
||||
|
||||
private void DrawDesignsPopup()
|
||||
{
|
||||
ImGui.SetNextWindowSize(ImGuiHelpers.ScaledVector2(500, 500));
|
||||
using var p = ImRaii.Popup("Designs");
|
||||
Im.Window.SetNextSize(ImEx.ScaledVector(500, 500));
|
||||
using var p = Im.Popup.Begin("Designs"u8);
|
||||
if (!p)
|
||||
return;
|
||||
|
||||
using var table = Im.Table.Begin("Designs"u8, 2, TableFlags.SizingFixedFit);
|
||||
foreach (var (guid, name) in _designs)
|
||||
{
|
||||
ImGuiUtil.DrawTableColumn(name);
|
||||
table.DrawColumn(name);
|
||||
using var f = Im.Font.PushMono();
|
||||
ImGui.TableNextColumn();
|
||||
ImGuiUtil.CopyOnClickSelectable(guid.ToString());
|
||||
table.NextColumn();
|
||||
ImEx.CopyOnClickSelectable($"{guid}");
|
||||
}
|
||||
|
||||
if (ImGui.Button("Close", -Vector2.UnitX) || !ImGui.IsWindowFocused())
|
||||
ImGui.CloseCurrentPopup();
|
||||
if (Im.Button("Close"u8, Im.ContentRegion.Available with { Y = 0 }) || !Im.Window.Focused())
|
||||
Im.Popup.CloseCurrent();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using Glamourer.Api.Enums;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using ImSharp;
|
||||
|
||||
namespace Glamourer.Gui.Tabs.DebugTab.IpcTester;
|
||||
|
|
@ -8,51 +7,50 @@ public static class IpcTesterHelpers
|
|||
{
|
||||
public static void DrawFlagInput(ref ApplyFlag flags)
|
||||
{
|
||||
var value = (flags & ApplyFlag.Once) != 0;
|
||||
if (ImGui.Checkbox("Apply Once", ref value))
|
||||
var value = (flags & ApplyFlag.Once) is not 0;
|
||||
if (Im.Checkbox("Apply Once"u8, ref value))
|
||||
flags = value ? flags | ApplyFlag.Once : flags & ~ApplyFlag.Once;
|
||||
|
||||
Im.Line.Same();
|
||||
value = (flags & ApplyFlag.Equipment) != 0;
|
||||
if (ImGui.Checkbox("Apply Equipment", ref value))
|
||||
value = (flags & ApplyFlag.Equipment) is not 0;
|
||||
if (Im.Checkbox("Apply Equipment"u8, ref value))
|
||||
flags = value ? flags | ApplyFlag.Equipment : flags & ~ApplyFlag.Equipment;
|
||||
|
||||
Im.Line.Same();
|
||||
value = (flags & ApplyFlag.Customization) != 0;
|
||||
if (ImGui.Checkbox("Apply Customization", ref value))
|
||||
value = (flags & ApplyFlag.Customization) is not 0;
|
||||
if (Im.Checkbox("Apply Customization"u8, ref value))
|
||||
flags = value ? flags | ApplyFlag.Customization : flags & ~ApplyFlag.Customization;
|
||||
|
||||
Im.Line.Same();
|
||||
value = (flags & ApplyFlag.Lock) != 0;
|
||||
if (ImGui.Checkbox("Lock Actor", ref value))
|
||||
value = (flags & ApplyFlag.Lock) is not 0;
|
||||
if (Im.Checkbox("Lock Actor"u8, ref value))
|
||||
flags = value ? flags | ApplyFlag.Lock : flags & ~ApplyFlag.Lock;
|
||||
}
|
||||
|
||||
public static void IndexInput(ref int index)
|
||||
{
|
||||
ImGui.SetNextItemWidth(Im.ContentRegion.Available.X / 2);
|
||||
ImGui.InputInt("Game Object Index", ref index, 0, 0);
|
||||
Im.Item.SetNextWidth(Im.ContentRegion.Available.X / 2);
|
||||
Im.Input.Scalar("Game Object Index"u8, ref index);
|
||||
}
|
||||
|
||||
public static void KeyInput(ref uint key)
|
||||
{
|
||||
ImGui.SetNextItemWidth(Im.ContentRegion.Available.X / 2);
|
||||
Im.Item.SetNextWidth(Im.ContentRegion.Available.X / 2);
|
||||
var keyI = (int)key;
|
||||
if (ImGui.InputInt("Key", ref keyI, 0, 0))
|
||||
if (Im.Input.Scalar("Key"u8, ref keyI))
|
||||
key = (uint)keyI;
|
||||
}
|
||||
|
||||
public static void NameInput(ref string name)
|
||||
{
|
||||
ImGui.SetNextItemWidth(Im.ContentRegion.Available.X);
|
||||
ImGui.InputTextWithHint("##gameObject", "Character Name...", ref name, 64);
|
||||
Im.Item.SetNextWidthFull();
|
||||
Im.Input.Text("##gameObject"u8, ref name, "Character Name..."u8);
|
||||
}
|
||||
|
||||
public static void DrawIntro(string intro)
|
||||
public static void DrawIntro(ReadOnlySpan<byte> intro)
|
||||
{
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted(intro);
|
||||
ImGui.TableNextColumn();
|
||||
Im.Table.NextColumn();
|
||||
ImEx.TextFrameAligned(intro);
|
||||
Im.Table.NextColumn();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Glamourer.Api.IpcSubscribers;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using ImSharp;
|
||||
using Penumbra.GameData.Gui.Debug;
|
||||
|
||||
|
|
@ -29,15 +28,15 @@ public sealed class IpcTesterPanel(
|
|||
{
|
||||
_lastUpdate = framework.LastUpdateUTC.AddSeconds(1);
|
||||
Subscribe();
|
||||
ImGui.TextUnformatted(ApiVersion.Label);
|
||||
Im.Text(ApiVersion.LabelU8);
|
||||
var (major, minor) = new ApiVersion(pluginInterface).Invoke();
|
||||
Im.Line.Same();
|
||||
ImGui.TextUnformatted($"({major}.{minor:D4})");
|
||||
Im.Text($"({major}.{minor:D4})");
|
||||
|
||||
ImGui.TextUnformatted(AutoReloadGearEnabled.Label);
|
||||
Im.Text(AutoReloadGearEnabled.LabelU8);
|
||||
var autoRedraw = new AutoReloadGearEnabled(pluginInterface).Invoke();
|
||||
Im.Line.Same();
|
||||
ImGui.TextUnformatted(autoRedraw ? "Enabled" : "Disabled");
|
||||
Im.Text(autoRedraw ? "Enabled"u8 : "Disabled"u8);
|
||||
|
||||
designs.Draw();
|
||||
items.Draw();
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
using Dalamud.Plugin;
|
||||
using Glamourer.Api.Enums;
|
||||
using Glamourer.Api.IpcSubscribers;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using ImSharp;
|
||||
using Luna;
|
||||
using OtterGui;
|
||||
using OtterGui.Raii;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Gui;
|
||||
using Penumbra.GameData.Structs;
|
||||
|
|
@ -26,7 +23,7 @@ public class ItemsIpcTester(IDalamudPluginInterface pluginInterface) : IUiServic
|
|||
|
||||
public void Draw()
|
||||
{
|
||||
using var tree = ImRaii.TreeNode("Items");
|
||||
using var tree = Im.Tree.Node("Items"u8);
|
||||
if (!tree)
|
||||
return;
|
||||
|
||||
|
|
@ -37,26 +34,26 @@ public class ItemsIpcTester(IDalamudPluginInterface pluginInterface) : IUiServic
|
|||
IpcTesterHelpers.DrawFlagInput(ref _flags);
|
||||
using var table = Im.Table.Begin("##table"u8, 2, TableFlags.SizingFixedFit);
|
||||
|
||||
IpcTesterHelpers.DrawIntro("Last Error");
|
||||
ImGui.TextUnformatted(_lastError.ToString());
|
||||
IpcTesterHelpers.DrawIntro("Last Error"u8);
|
||||
Im.Text($"{_lastError}");
|
||||
|
||||
IpcTesterHelpers.DrawIntro(SetItem.Label);
|
||||
if (ImGui.Button("Set##Idx"))
|
||||
IpcTesterHelpers.DrawIntro(SetItem.LabelU8);
|
||||
if (Im.Button("Set##Idx"u8))
|
||||
_lastError = new SetItem(pluginInterface).Invoke(_gameObjectIndex, (ApiEquipSlot)_slot, _customItemId.Id, [_stainId.Id], _key,
|
||||
_flags);
|
||||
|
||||
IpcTesterHelpers.DrawIntro(SetItemName.Label);
|
||||
if (ImGui.Button("Set##Name"))
|
||||
IpcTesterHelpers.DrawIntro(SetItemName.LabelU8);
|
||||
if (Im.Button("Set##Name"u8))
|
||||
_lastError = new SetItemName(pluginInterface).Invoke(_gameObjectName, (ApiEquipSlot)_slot, _customItemId.Id, [_stainId.Id], _key,
|
||||
_flags);
|
||||
|
||||
IpcTesterHelpers.DrawIntro(SetBonusItem.Label);
|
||||
if (ImGui.Button("Set##BonusIdx"))
|
||||
IpcTesterHelpers.DrawIntro(SetBonusItem.LabelU8);
|
||||
if (Im.Button("Set##BonusIdx"u8))
|
||||
_lastError = new SetBonusItem(pluginInterface).Invoke(_gameObjectIndex, ToApi(_bonusSlot), _customItemId.Id, _key,
|
||||
_flags);
|
||||
|
||||
IpcTesterHelpers.DrawIntro(SetBonusItemName.Label);
|
||||
if (ImGui.Button("Set##BonusName"))
|
||||
IpcTesterHelpers.DrawIntro(SetBonusItemName.LabelU8);
|
||||
if (Im.Button("Set##BonusName"u8))
|
||||
_lastError = new SetBonusItemName(pluginInterface).Invoke(_gameObjectName, ToApi(_bonusSlot), _customItemId.Id, _key,
|
||||
_flags);
|
||||
}
|
||||
|
|
@ -65,14 +62,14 @@ public class ItemsIpcTester(IDalamudPluginInterface pluginInterface) : IUiServic
|
|||
{
|
||||
var tmp = _customItemId.Id;
|
||||
var width = Im.ContentRegion.Available.X / 2;
|
||||
ImGui.SetNextItemWidth(width);
|
||||
if (ImGuiUtil.InputUlong("Custom Item ID", ref tmp))
|
||||
Im.Item.SetNextWidth(width);
|
||||
if (Im.Input.Scalar("Custom Item ID"u8, ref tmp))
|
||||
_customItemId = tmp;
|
||||
EquipSlotCombo.Draw("Equip Slot"u8, StringU8.Empty, ref _slot, width);
|
||||
BonusSlotCombo.Draw("Bonus Slot"u8, StringU8.Empty, ref _bonusSlot, width);
|
||||
var value = (int)_stainId.Id;
|
||||
ImGui.SetNextItemWidth(width);
|
||||
if (ImGui.InputInt("Stain ID", ref value, 1, 3))
|
||||
Im.Item.SetNextWidth(width);
|
||||
if (Im.Input.Scalar("Stain ID"u8, ref value, 1, 3))
|
||||
{
|
||||
value = Math.Clamp(value, 0, byte.MaxValue);
|
||||
_stainId = (StainId)value;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin;
|
||||
using Glamourer.Api.Enums;
|
||||
using Glamourer.Api.Helpers;
|
||||
using Glamourer.Api.IpcSubscribers;
|
||||
|
|
@ -10,9 +7,6 @@ using ImSharp;
|
|||
using Luna;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OtterGui;
|
||||
using OtterGui.Raii;
|
||||
using OtterGui.Text;
|
||||
using Penumbra.GameData.Interop;
|
||||
using Penumbra.String;
|
||||
|
||||
|
|
@ -56,11 +50,11 @@ public class StateIpcTester : IUiService, IDisposable
|
|||
|
||||
public StateIpcTester(IDalamudPluginInterface pluginInterface)
|
||||
{
|
||||
_pluginInterface = pluginInterface;
|
||||
AutoRedrawChanged = AutoReloadGearChanged.Subscriber(_pluginInterface, OnAutoRedrawChanged);
|
||||
StateChanged = StateChangedWithType.Subscriber(_pluginInterface, OnStateChanged);
|
||||
StateFinalized = Api.IpcSubscribers.StateFinalized.Subscriber(_pluginInterface, OnStateFinalized);
|
||||
GPoseChanged = Api.IpcSubscribers.GPoseChanged.Subscriber(_pluginInterface, OnGPoseChange);
|
||||
_pluginInterface = pluginInterface;
|
||||
AutoRedrawChanged = AutoReloadGearChanged.Subscriber(_pluginInterface, OnAutoRedrawChanged);
|
||||
StateChanged = StateChangedWithType.Subscriber(_pluginInterface, OnStateChanged);
|
||||
StateFinalized = Api.IpcSubscribers.StateFinalized.Subscriber(_pluginInterface, OnStateFinalized);
|
||||
GPoseChanged = Api.IpcSubscribers.GPoseChanged.Subscriber(_pluginInterface, OnGPoseChange);
|
||||
AutoRedrawChanged.Disable();
|
||||
StateChanged.Disable();
|
||||
StateFinalized.Disable();
|
||||
|
|
@ -77,7 +71,7 @@ public class StateIpcTester : IUiService, IDisposable
|
|||
|
||||
public void Draw()
|
||||
{
|
||||
using var tree = ImRaii.TreeNode("State");
|
||||
using var tree = Im.Tree.Node("State"u8);
|
||||
if (!tree)
|
||||
return;
|
||||
|
||||
|
|
@ -85,162 +79,156 @@ public class StateIpcTester : IUiService, IDisposable
|
|||
IpcTesterHelpers.KeyInput(ref _key);
|
||||
IpcTesterHelpers.NameInput(ref _gameObjectName);
|
||||
IpcTesterHelpers.DrawFlagInput(ref _flags);
|
||||
ImGui.SetNextItemWidth(Im.ContentRegion.Available.X);
|
||||
ImGui.InputTextWithHint("##base64", "Base 64 State...", ref _base64State, 2000);
|
||||
Im.Item.SetNextWidthFull();
|
||||
Im.Input.Text("##base64"u8, ref _base64State, "Base 64 State..."u8);
|
||||
using var table = Im.Table.Begin("##table"u8, 2, TableFlags.SizingFixedFit);
|
||||
|
||||
IpcTesterHelpers.DrawIntro("Last Error");
|
||||
ImGui.TextUnformatted(_lastError.ToString());
|
||||
IpcTesterHelpers.DrawIntro("Last Auto Redraw Change");
|
||||
ImGui.TextUnformatted($"{_lastAutoRedrawChangeValue} at {_lastAutoRedrawChangeTime.ToLocalTime().TimeOfDay}");
|
||||
IpcTesterHelpers.DrawIntro("Last State Change");
|
||||
IpcTesterHelpers.DrawIntro("Last Error"u8);
|
||||
Im.Text($"{_lastError}");
|
||||
IpcTesterHelpers.DrawIntro("Last Auto Redraw Change"u8);
|
||||
Im.Text($"{_lastAutoRedrawChangeValue} at {_lastAutoRedrawChangeTime.ToLocalTime().TimeOfDay}");
|
||||
IpcTesterHelpers.DrawIntro("Last State Change"u8);
|
||||
PrintChangeName();
|
||||
IpcTesterHelpers.DrawIntro("Last State Finalization");
|
||||
IpcTesterHelpers.DrawIntro("Last State Finalization"u8);
|
||||
PrintFinalizeName();
|
||||
IpcTesterHelpers.DrawIntro("Last GPose Change");
|
||||
ImGui.TextUnformatted($"{_lastGPoseChangeValue} at {_lastGPoseChangeTime.ToLocalTime().TimeOfDay}");
|
||||
IpcTesterHelpers.DrawIntro("Last GPose Change"u8);
|
||||
Im.Text($"{_lastGPoseChangeValue} at {_lastGPoseChangeTime.ToLocalTime().TimeOfDay}");
|
||||
|
||||
|
||||
IpcTesterHelpers.DrawIntro(GetState.Label);
|
||||
IpcTesterHelpers.DrawIntro(GetState.LabelU8);
|
||||
DrawStatePopup();
|
||||
if (ImUtf8.Button("Get##Idx"u8))
|
||||
if (Im.Button("Get##Idx"u8))
|
||||
{
|
||||
(_lastError, _state) = new GetState(_pluginInterface).Invoke(_gameObjectIndex, _key);
|
||||
_stateString = _state?.ToString(Formatting.Indented) ?? "No State Available";
|
||||
ImUtf8.OpenPopup("State"u8);
|
||||
Im.Popup.Open("State"u8);
|
||||
}
|
||||
|
||||
IpcTesterHelpers.DrawIntro(GetStateName.Label);
|
||||
if (ImUtf8.Button("Get##Name"u8))
|
||||
IpcTesterHelpers.DrawIntro(GetStateName.LabelU8);
|
||||
if (Im.Button("Get##Name"u8))
|
||||
{
|
||||
(_lastError, _state) = new GetStateName(_pluginInterface).Invoke(_gameObjectName, _key);
|
||||
_stateString = _state?.ToString(Formatting.Indented) ?? "No State Available";
|
||||
ImUtf8.OpenPopup("State"u8);
|
||||
Im.Popup.Open("State"u8);
|
||||
}
|
||||
|
||||
IpcTesterHelpers.DrawIntro(GetStateBase64.Label);
|
||||
if (ImUtf8.Button("Get##Base64Idx"u8))
|
||||
IpcTesterHelpers.DrawIntro(GetStateBase64.LabelU8);
|
||||
if (Im.Button("Get##Base64Idx"u8))
|
||||
{
|
||||
(_lastError, _getStateString) = new GetStateBase64(_pluginInterface).Invoke(_gameObjectIndex, _key);
|
||||
_stateString = _getStateString ?? "No State Available";
|
||||
ImUtf8.OpenPopup("State"u8);
|
||||
Im.Popup.Open("State"u8);
|
||||
}
|
||||
|
||||
IpcTesterHelpers.DrawIntro(GetStateBase64Name.Label);
|
||||
if (ImUtf8.Button("Get##Base64Idx"u8))
|
||||
IpcTesterHelpers.DrawIntro(GetStateBase64Name.LabelU8);
|
||||
if (Im.Button("Get##Base64Idx"u8))
|
||||
{
|
||||
(_lastError, _getStateString) = new GetStateBase64Name(_pluginInterface).Invoke(_gameObjectName, _key);
|
||||
_stateString = _getStateString ?? "No State Available";
|
||||
ImUtf8.OpenPopup("State"u8);
|
||||
Im.Popup.Open("State"u8);
|
||||
}
|
||||
|
||||
IpcTesterHelpers.DrawIntro(ApplyState.Label);
|
||||
if (ImGuiUtil.DrawDisabledButton("Apply Last##Idx", Vector2.Zero, string.Empty, _state == null))
|
||||
IpcTesterHelpers.DrawIntro(ApplyState.LabelU8);
|
||||
if (ImEx.Button("Apply Last##Idx"u8, Vector2.Zero, StringU8.Empty, _state is null))
|
||||
_lastError = new ApplyState(_pluginInterface).Invoke(_state!, _gameObjectIndex, _key, _flags);
|
||||
Im.Line.Same();
|
||||
if (ImUtf8.Button("Apply Base64##Idx"u8))
|
||||
if (Im.Button("Apply Base64##Idx"u8))
|
||||
_lastError = new ApplyState(_pluginInterface).Invoke(_base64State, _gameObjectIndex, _key, _flags);
|
||||
|
||||
IpcTesterHelpers.DrawIntro(ApplyStateName.Label);
|
||||
if (ImGuiUtil.DrawDisabledButton("Apply Last##Name", Vector2.Zero, string.Empty, _state == null))
|
||||
IpcTesterHelpers.DrawIntro(ApplyStateName.LabelU8);
|
||||
if (ImEx.Button("Apply Last##Name"u8, Vector2.Zero, StringU8.Empty, _state is null))
|
||||
_lastError = new ApplyStateName(_pluginInterface).Invoke(_state!, _gameObjectName, _key, _flags);
|
||||
Im.Line.Same();
|
||||
if (ImUtf8.Button("Apply Base64##Name"u8))
|
||||
if (Im.Button("Apply Base64##Name"u8))
|
||||
_lastError = new ApplyStateName(_pluginInterface).Invoke(_base64State, _gameObjectName, _key, _flags);
|
||||
|
||||
IpcTesterHelpers.DrawIntro(ReapplyState.Label);
|
||||
if (ImUtf8.Button("Reapply##Idx"u8))
|
||||
IpcTesterHelpers.DrawIntro(ReapplyState.LabelU8);
|
||||
if (Im.Button("Reapply##Idx"u8))
|
||||
_lastError = new ReapplyState(_pluginInterface).Invoke(_gameObjectIndex, _key, _flags);
|
||||
|
||||
IpcTesterHelpers.DrawIntro(ReapplyStateName.Label);
|
||||
if (ImUtf8.Button("Reapply##Name"u8))
|
||||
IpcTesterHelpers.DrawIntro(ReapplyStateName.LabelU8);
|
||||
if (Im.Button("Reapply##Name"u8))
|
||||
_lastError = new ReapplyStateName(_pluginInterface).Invoke(_gameObjectName, _key, _flags);
|
||||
|
||||
IpcTesterHelpers.DrawIntro(RevertState.Label);
|
||||
if (ImUtf8.Button("Revert##Idx"u8))
|
||||
IpcTesterHelpers.DrawIntro(RevertState.LabelU8);
|
||||
if (Im.Button("Revert##Idx"u8))
|
||||
_lastError = new RevertState(_pluginInterface).Invoke(_gameObjectIndex, _key, _flags);
|
||||
|
||||
IpcTesterHelpers.DrawIntro(RevertStateName.Label);
|
||||
if (ImUtf8.Button("Revert##Name"u8))
|
||||
IpcTesterHelpers.DrawIntro(RevertStateName.LabelU8);
|
||||
if (Im.Button("Revert##Name"u8))
|
||||
_lastError = new RevertStateName(_pluginInterface).Invoke(_gameObjectName, _key, _flags);
|
||||
|
||||
IpcTesterHelpers.DrawIntro(UnlockState.Label);
|
||||
if (ImUtf8.Button("Unlock##Idx"u8))
|
||||
IpcTesterHelpers.DrawIntro(UnlockState.LabelU8);
|
||||
if (Im.Button("Unlock##Idx"u8))
|
||||
_lastError = new UnlockState(_pluginInterface).Invoke(_gameObjectIndex, _key);
|
||||
|
||||
IpcTesterHelpers.DrawIntro(UnlockStateName.Label);
|
||||
if (ImUtf8.Button("Unlock##Name"u8))
|
||||
IpcTesterHelpers.DrawIntro(UnlockStateName.LabelU8);
|
||||
if (Im.Button("Unlock##Name"u8))
|
||||
_lastError = new UnlockStateName(_pluginInterface).Invoke(_gameObjectName, _key);
|
||||
|
||||
IpcTesterHelpers.DrawIntro(UnlockAll.Label);
|
||||
if (ImUtf8.Button("Unlock##All"u8))
|
||||
IpcTesterHelpers.DrawIntro(UnlockAll.LabelU8);
|
||||
if (Im.Button("Unlock##All"u8))
|
||||
_numUnlocked = new UnlockAll(_pluginInterface).Invoke(_key);
|
||||
Im.Line.Same();
|
||||
ImGui.TextUnformatted($"Unlocked {_numUnlocked}");
|
||||
Im.Text($"Unlocked {_numUnlocked}");
|
||||
|
||||
IpcTesterHelpers.DrawIntro(RevertToAutomation.Label);
|
||||
if (ImUtf8.Button("Revert##AutomationIdx"u8))
|
||||
IpcTesterHelpers.DrawIntro(RevertToAutomation.LabelU8);
|
||||
if (Im.Button("Revert##AutomationIdx"u8))
|
||||
_lastError = new RevertToAutomation(_pluginInterface).Invoke(_gameObjectIndex, _key, _flags);
|
||||
|
||||
IpcTesterHelpers.DrawIntro(RevertToAutomationName.Label);
|
||||
if (ImUtf8.Button("Revert##AutomationName"u8))
|
||||
IpcTesterHelpers.DrawIntro(RevertToAutomationName.LabelU8);
|
||||
if (Im.Button("Revert##AutomationName"u8))
|
||||
_lastError = new RevertToAutomationName(_pluginInterface).Invoke(_gameObjectName, _key, _flags);
|
||||
}
|
||||
|
||||
private void DrawStatePopup()
|
||||
{
|
||||
ImGui.SetNextWindowSize(ImGuiHelpers.ScaledVector2(500, 500));
|
||||
if (_stateString == null)
|
||||
if (_stateString is null)
|
||||
return;
|
||||
|
||||
using var p = ImUtf8.Popup("State"u8);
|
||||
Im.Window.SetNextSize(ImEx.ScaledVector(500, 500));
|
||||
using var p = Im.Popup.Begin("State"u8);
|
||||
if (!p)
|
||||
return;
|
||||
|
||||
if (ImUtf8.Button("Copy to Clipboard"u8))
|
||||
ImUtf8.SetClipboardText(_stateString);
|
||||
if (Im.Button("Copy to Clipboard"u8))
|
||||
Im.Clipboard.Set(_stateString);
|
||||
if (_stateString[0] is '{')
|
||||
{
|
||||
Im.Line.Same();
|
||||
if (ImUtf8.Button("Copy as Base64"u8) && _state != null)
|
||||
ImUtf8.SetClipboardText(DesignConverter.ToBase64(_state));
|
||||
if (Im.Button("Copy as Base64"u8) && _state is not null)
|
||||
Im.Clipboard.Set(DesignConverter.ToBase64(_state));
|
||||
}
|
||||
|
||||
using var font = Im.Font.PushMono();
|
||||
ImUtf8.TextWrapped(_stateString ?? string.Empty);
|
||||
Im.TextWrapped(_stateString ?? string.Empty);
|
||||
|
||||
if (ImUtf8.Button("Close"u8, -Vector2.UnitX) || !ImGui.IsWindowFocused())
|
||||
ImGui.CloseCurrentPopup();
|
||||
if (Im.Button("Close"u8, Im.ContentRegion.Available with { Y = 0 }) || !Im.Window.Focused())
|
||||
Im.Popup.CloseCurrent();
|
||||
}
|
||||
|
||||
private unsafe void PrintChangeName()
|
||||
{
|
||||
ImUtf8.Text(_lastStateChangeName.Span);
|
||||
ImGui.SameLine(0, 0);
|
||||
ImUtf8.Text($" ({_lastStateChangeType})");
|
||||
Im.Text(_lastStateChangeName.Span);
|
||||
Im.Line.NoSpacing();
|
||||
Im.Text($" ({_lastStateChangeType})");
|
||||
Im.Line.Same();
|
||||
using (Im.Font.PushMono())
|
||||
{
|
||||
ImUtf8.CopyOnClickSelectable($"0x{_lastStateChangeActor:X}");
|
||||
}
|
||||
Glamourer.Dynamis.DrawPointer(_lastStateChangeActor);
|
||||
|
||||
Im.Line.Same();
|
||||
ImUtf8.Text($"at {_lastStateChangeTime.ToLocalTime().TimeOfDay}");
|
||||
Im.Text($"at {_lastStateChangeTime.ToLocalTime().TimeOfDay}");
|
||||
}
|
||||
|
||||
private unsafe void PrintFinalizeName()
|
||||
{
|
||||
ImUtf8.Text(_lastStateFinalizeName.Span);
|
||||
ImGui.SameLine(0, 0);
|
||||
ImUtf8.Text($" ({_lastStateFinalizeType})");
|
||||
Im.Text(_lastStateFinalizeName.Span);
|
||||
Im.Line.NoSpacing();
|
||||
Im.Text($" ({_lastStateFinalizeType})");
|
||||
Im.Line.Same();
|
||||
using (Im.Font.PushMono())
|
||||
{
|
||||
ImUtf8.CopyOnClickSelectable($"0x{_lastStateFinalizeActor:X}");
|
||||
}
|
||||
Glamourer.Dynamis.DrawPointer(_lastStateFinalizeActor);
|
||||
|
||||
Im.Line.Same();
|
||||
ImUtf8.Text($"at {_lastStateFinalizeTime.ToLocalTime().TimeOfDay}");
|
||||
Im.Text($"at {_lastStateFinalizeTime.ToLocalTime().TimeOfDay}");
|
||||
}
|
||||
|
||||
private void OnAutoRedrawChanged(bool value)
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public sealed class NpcAppearancePanel(
|
|||
public readonly StringU8 ModelId = new($"{data.ModelId}");
|
||||
public readonly AwesomeIcon Visor = data.VisorToggled ? LunaStyle.TrueIcon : LunaStyle.FalseIcon;
|
||||
public readonly StringU8 CustomizeData = new($"{data.Customize}");
|
||||
public readonly StringU8 GearData = StringU8.Empty; //new(data.WriteGear());
|
||||
public readonly StringU8 GearData = new(data.WriteGear());
|
||||
}
|
||||
|
||||
private sealed class Cache(NpcCustomizeSet npcData, NpcDataFilter filter) : BasicFilterCache<CacheItem>(filter)
|
||||
|
|
|
|||
|
|
@ -1,13 +1,8 @@
|
|||
using Dalamud.Interface.Utility;
|
||||
using Glamourer.Services;
|
||||
using Glamourer.Services;
|
||||
using Glamourer.Unlocks;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using ImSharp;
|
||||
using OtterGui;
|
||||
using OtterGui.Raii;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Gui.Debug;
|
||||
using ImGuiClip = OtterGui.ImGuiClip;
|
||||
|
||||
namespace Glamourer.Gui.Tabs.DebugTab;
|
||||
|
||||
|
|
@ -34,32 +29,29 @@ public sealed class UnlockableItemsPanel(ItemUnlockManager itemUnlocks, ItemMana
|
|||
table.SetupColumn("Unlock"u8, TableColumnFlags.WidthFixed, 120 * Im.Style.GlobalScale);
|
||||
table.SetupColumn("Criteria"u8, TableColumnFlags.WidthStretch);
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
var skips = ImGuiClip.GetNecessarySkips(Im.Style.TextHeightWithSpacing);
|
||||
ImGui.TableNextRow();
|
||||
var remainder = ImGuiClip.ClippedDraw(itemUnlocks.Unlockable, skips, t =>
|
||||
using var clip = new Im.ListClipper(itemUnlocks.Unlockable.Count, Im.Style.TextHeightWithSpacing);
|
||||
foreach (var (id, timestamp) in clip.Iterate(itemUnlocks.Unlockable))
|
||||
{
|
||||
ImGuiUtil.DrawTableColumn(t.Key.ToString());
|
||||
if (items.ItemData.TryGetValue(t.Key, EquipSlot.MainHand, out var equip))
|
||||
table.DrawColumn($"{id}");
|
||||
if (items.ItemData.TryGetValue(id, EquipSlot.MainHand, out var equip))
|
||||
{
|
||||
ImGuiUtil.DrawTableColumn(equip.Name);
|
||||
ImGuiUtil.DrawTableColumn(equip.Type.ToName());
|
||||
ImGuiUtil.DrawTableColumn(equip.Weapon().ToString());
|
||||
table.DrawColumn(equip.Name);
|
||||
table.DrawColumn(equip.Type.ToName());
|
||||
table.DrawColumn($"{equip.Weapon()}");
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
table.NextColumn();
|
||||
table.NextColumn();
|
||||
table.NextColumn();
|
||||
}
|
||||
|
||||
ImGuiUtil.DrawTableColumn(itemUnlocks.IsUnlocked(t.Key, out var time)
|
||||
table.DrawColumn(itemUnlocks.IsUnlocked(id, out var time)
|
||||
? time == DateTimeOffset.MinValue
|
||||
? "Always"
|
||||
: time.LocalDateTime.ToString("g")
|
||||
: "Never");
|
||||
ImGuiUtil.DrawTableColumn(t.Value.ToString());
|
||||
}, itemUnlocks.Unlockable.Count);
|
||||
ImGuiClip.DrawEndDummy(remainder, Im.Style.TextHeight);
|
||||
? "Always"u8
|
||||
: $"{time.LocalDateTime:g}"
|
||||
: "Never"u8);
|
||||
table.DrawColumn($"{timestamp}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Glamourer.Automation;
|
||||
using Glamourer.Designs;
|
||||
using Glamourer.Designs.Links;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using ImSharp;
|
||||
using Luna;
|
||||
using OtterGui;
|
||||
using OtterGui.Raii;
|
||||
|
||||
namespace Glamourer.Gui.Tabs.DesignTab;
|
||||
|
||||
|
|
@ -29,10 +25,10 @@ public class DesignLinkDrawer(
|
|||
if (!h.Alive)
|
||||
return;
|
||||
|
||||
ImGuiUtil.HoverTooltip(
|
||||
"Design links are links to other designs that will be applied to characters or during automation according to the rules set.\n"
|
||||
+ "They apply from top to bottom just like automated design sets, so anything set by an earlier design will not not be set again by later designs, and order is important.\n"
|
||||
+ "If a linked design links to other designs, they will also be applied, so circular links are prohibited. ");
|
||||
Im.Tooltip.OnHover(
|
||||
"Design links are links to other designs that will be applied to characters or during automation according to the rules set.\n"u8
|
||||
+ "They apply from top to bottom just like automated design sets, so anything set by an earlier design will not not be set again by later designs, and order is important.\n"u8
|
||||
+ "If a linked design links to other designs, they will also be applied, so circular links are prohibited."u8);
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
|
|
@ -83,68 +79,67 @@ public class DesignLinkDrawer(
|
|||
table.SetupColumn("Detail"u8, TableColumnFlags.WidthFixed,
|
||||
6 * Im.Style.FrameHeight + 5 * Im.Style.ItemInnerSpacing.X);
|
||||
|
||||
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Im.Style.ItemInnerSpacing);
|
||||
DrawSubList(selector.Selected!.Links.Before, LinkOrder.Before);
|
||||
DrawSelf();
|
||||
DrawSubList(selector.Selected!.Links.After, LinkOrder.After);
|
||||
DrawNew();
|
||||
using var style = ImStyleDouble.ItemSpacing.Push(Im.Style.ItemInnerSpacing);
|
||||
DrawSubList(table, selector.Selected!.Links.Before, LinkOrder.Before);
|
||||
DrawSelf(table);
|
||||
DrawSubList(table, selector.Selected!.Links.After, LinkOrder.After);
|
||||
DrawNew(table);
|
||||
MoveLink();
|
||||
}
|
||||
|
||||
private void DrawSelf()
|
||||
private void DrawSelf(in Im.TableDisposable table)
|
||||
{
|
||||
using var id = Im.Id.Push((int)LinkOrder.Self);
|
||||
ImGui.TableNextColumn();
|
||||
table.NextColumn();
|
||||
var color = colorManager.GetColor(selector.Selected!);
|
||||
using (ImRaii.PushFont(UiBuilder.IconFont))
|
||||
using (AwesomeIcon.Font.Push())
|
||||
{
|
||||
using var c = ImGuiColor.Text.Push(color);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGuiUtil.RightAlign(FontAwesomeIcon.ArrowRightLong.ToIconString());
|
||||
Im.Cursor.FrameAlign();
|
||||
ImEx.TextRightAligned(FontAwesomeIcon.ArrowRightLong.Icon().Span);
|
||||
}
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
table.NextColumn();
|
||||
using (ImGuiColor.Text.Push(color))
|
||||
{
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.Selectable(selector.IncognitoMode ? selector.Selected!.Incognito : selector.Selected!.Name.Text);
|
||||
Im.Cursor.FrameAlign();
|
||||
Im.Selectable(selector.IncognitoMode ? selector.Selected!.Incognito : selector.Selected!.Name.Text);
|
||||
}
|
||||
|
||||
ImGuiUtil.HoverTooltip("Current Design");
|
||||
Im.Tooltip.OnHover("Current Design"u8);
|
||||
DrawDragDrop(selector.Selected!, LinkOrder.Self, 0);
|
||||
ImGui.TableNextColumn();
|
||||
using (ImRaii.PushFont(UiBuilder.IconFont))
|
||||
table.NextColumn();
|
||||
using (AwesomeIcon.Font.Push())
|
||||
{
|
||||
using var c = ImGuiColor.Text.Push(color);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted(FontAwesomeIcon.ArrowLeftLong.ToIconString());
|
||||
Im.Cursor.FrameAlign();
|
||||
ImEx.TextRightAligned(FontAwesomeIcon.ArrowLeftLong.Icon().Span);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawSubList(IReadOnlyList<DesignLink> list, LinkOrder order)
|
||||
private void DrawSubList(in Im.TableDisposable table, IReadOnlyList<DesignLink> list, LinkOrder order)
|
||||
{
|
||||
using var id = Im.Id.Push((int)order);
|
||||
|
||||
var buttonSize = new Vector2(Im.Style.FrameHeight);
|
||||
for (var i = 0; i < list.Count; ++i)
|
||||
{
|
||||
id.Push(i);
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
var delete = ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Trash.ToIconString(), buttonSize, "Delete this link.", false, true);
|
||||
table.NextColumn();
|
||||
var delete = ImEx.Icon.Button(LunaStyle.DeleteIcon, "Delete this link."u8);
|
||||
var (design, flags) = list[i];
|
||||
ImGui.TableNextColumn();
|
||||
table.NextColumn();
|
||||
|
||||
using (ImGuiColor.Text.Push(colorManager.GetColor(design)))
|
||||
{
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.Selectable(selector.IncognitoMode ? design.Incognito : design.Name.Text);
|
||||
Im.Cursor.FrameAlign();
|
||||
Im.Selectable(selector.IncognitoMode ? design.Incognito : design.Name.Text);
|
||||
}
|
||||
|
||||
DrawDragDrop(design, order, i);
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.AlignTextToFramePadding();
|
||||
table.NextColumn();
|
||||
Im.Cursor.FrameAlign();
|
||||
DrawApplicationBoxes(i, order, flags);
|
||||
|
||||
if (delete)
|
||||
|
|
@ -152,13 +147,12 @@ public class DesignLinkDrawer(
|
|||
}
|
||||
}
|
||||
|
||||
private void DrawNew()
|
||||
private void DrawNew(in Im.TableDisposable table)
|
||||
{
|
||||
var buttonSize = new Vector2(Im.Style.FrameHeight);
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
table.NextColumn();
|
||||
table.NextColumn();
|
||||
combo.Draw(Im.ContentRegion.Available.X);
|
||||
ImGui.TableNextColumn();
|
||||
table.NextColumn();
|
||||
string ttBefore, ttAfter;
|
||||
bool canAddBefore, canAddAfter;
|
||||
var design = combo.Design as Design;
|
||||
|
|
@ -179,35 +173,32 @@ public class DesignLinkDrawer(
|
|||
: $"Can not add a link to {design.Name}:\n{error}";
|
||||
}
|
||||
|
||||
if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.ArrowCircleUp.ToIconString(), buttonSize, ttBefore, !canAddBefore, true))
|
||||
if (ImEx.Icon.Button(FontAwesomeIcon.ArrowCircleUp.Icon(), ttBefore, !canAddBefore))
|
||||
{
|
||||
linkManager.AddDesignLink(selector.Selected!, design!, LinkOrder.Before);
|
||||
linkManager.MoveDesignLink(selector.Selected!, selector.Selected!.Links.Before.Count - 1, LinkOrder.Before, 0, LinkOrder.Before);
|
||||
}
|
||||
|
||||
Im.Line.Same();
|
||||
if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.ArrowCircleDown.ToIconString(), buttonSize, ttAfter, !canAddAfter, true))
|
||||
if (ImEx.Icon.Button(FontAwesomeIcon.ArrowCircleUp.Icon(), ttAfter, !canAddAfter))
|
||||
linkManager.AddDesignLink(selector.Selected!, design!, LinkOrder.After);
|
||||
}
|
||||
|
||||
private void DrawDragDrop(Design design, LinkOrder order, int index)
|
||||
{
|
||||
using (var source = ImRaii.DragDropSource())
|
||||
using (var source = Im.DragDrop.Source())
|
||||
{
|
||||
if (source)
|
||||
{
|
||||
ImGui.SetDragDropPayload("DraggingLink", null, 0);
|
||||
ImGui.TextUnformatted($"Reordering {design.Name}...");
|
||||
source.SetPayload("DraggingLink"u8);
|
||||
Im.Text($"Reordering {design.Name}...");
|
||||
_dragDropIndex = index;
|
||||
_dragDropOrder = order;
|
||||
}
|
||||
}
|
||||
|
||||
using var target = ImRaii.DragDropTarget();
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
if (!ImGuiUtil.IsDropping("DraggingLink"))
|
||||
using var target = Im.DragDrop.Target();
|
||||
if (!target.IsDropping("DraggingLink"u8))
|
||||
return;
|
||||
|
||||
_dragDropTargetIndex = index;
|
||||
|
|
@ -216,15 +207,13 @@ public class DesignLinkDrawer(
|
|||
|
||||
private void DrawApplicationBoxes(int idx, LinkOrder order, ApplicationType current)
|
||||
{
|
||||
var newType = current;
|
||||
var newTypeInt = (uint)newType;
|
||||
var newType = current;
|
||||
using (ImStyleBorder.Frame.Push(ColorId.FolderLine.Value()))
|
||||
{
|
||||
if (ImGui.CheckboxFlags("##all", ref newTypeInt, (uint)ApplicationType.All))
|
||||
newType = (ApplicationType)newTypeInt;
|
||||
Im.Checkbox("##all"u8, ref newType, ApplicationType.All);
|
||||
}
|
||||
|
||||
ImGuiUtil.HoverTooltip("Toggle all application modes at once.");
|
||||
Im.Tooltip.OnHover("Toggle all application modes at once."u8);
|
||||
|
||||
Im.Line.Same();
|
||||
Box(0);
|
||||
|
|
@ -244,10 +233,11 @@ public class DesignLinkDrawer(
|
|||
void Box(int i)
|
||||
{
|
||||
var (applicationType, description) = ApplicationTypeExtensions.Types[i];
|
||||
var value = current.HasFlag(applicationType);
|
||||
if (ImGui.Checkbox($"##{(byte)applicationType}", ref value))
|
||||
using var id = Im.Id.Push((uint)applicationType);
|
||||
var value = current.HasFlag(applicationType);
|
||||
if (Im.Checkbox(StringU8.Empty, ref value))
|
||||
newType = value ? newType | applicationType : newType & ~applicationType;
|
||||
ImGuiUtil.HoverTooltip(description);
|
||||
Im.Tooltip.OnHover(description);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface;
|
||||
using Glamourer.Interop.Penumbra;
|
||||
using Glamourer.Services;
|
||||
using ImSharp;
|
||||
using Luna;
|
||||
using OtterGui;
|
||||
using OtterGui.Raii;
|
||||
using Penumbra.GameData.Actors;
|
||||
using Penumbra.GameData.Interop;
|
||||
|
||||
|
|
@ -26,10 +23,10 @@ public class CollectionOverrideDrawer(
|
|||
|
||||
public void Draw()
|
||||
{
|
||||
using var header = ImRaii.CollapsingHeader("Collection Overrides");
|
||||
ImGuiUtil.HoverTooltip(
|
||||
"Here you can set up overrides for Penumbra collections that should have their settings changed when automatically applying mod settings from a design.\n"
|
||||
+ "Instead of the collection associated with the overridden character, the overridden collection will be manipulated.");
|
||||
using var header = Im.Tree.HeaderId("Collection Overrides"u8);
|
||||
Im.Tooltip.OnHover(
|
||||
"Here you can set up overrides for Penumbra collections that should have their settings changed when automatically applying mod settings from a design.\n"u8
|
||||
+ "Instead of the collection associated with the overridden character, the overridden collection will be manipulated."u8);
|
||||
if (!header)
|
||||
return;
|
||||
|
||||
|
|
@ -37,46 +34,45 @@ public class CollectionOverrideDrawer(
|
|||
if (!table)
|
||||
return;
|
||||
|
||||
var buttonSize = new Vector2(Im.Style.FrameHeight);
|
||||
table.SetupColumn("buttons"u8, TableColumnFlags.WidthFixed, buttonSize.X);
|
||||
table.SetupColumn("buttons"u8, TableColumnFlags.WidthFixed, Im.Style.FrameHeight);
|
||||
table.SetupColumn("identifiers"u8, TableColumnFlags.WidthStretch, 0.35f);
|
||||
table.SetupColumn("collections"u8, TableColumnFlags.WidthStretch, 0.4f);
|
||||
table.SetupColumn("name"u8, TableColumnFlags.WidthStretch, 0.25f);
|
||||
|
||||
for (var i = 0; i < collectionOverrides.Overrides.Count; ++i)
|
||||
DrawCollectionRow(ref i, buttonSize);
|
||||
DrawCollectionRow(table, ref i);
|
||||
|
||||
DrawNewOverride(buttonSize);
|
||||
DrawNewOverride(table);
|
||||
}
|
||||
|
||||
private void DrawCollectionRow(ref int idx, Vector2 buttonSize)
|
||||
private void DrawCollectionRow(in Im.TableDisposable table, ref int idx)
|
||||
{
|
||||
using var id = Im.Id.Push(idx);
|
||||
var (exists, actor, collection, name) = collectionOverrides.Fetch(idx);
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Trash.ToIconString(), buttonSize, "Delete this override.", false, true))
|
||||
table.NextColumn();
|
||||
if (ImEx.Icon.Button(LunaStyle.DeleteIcon, "Delete this override."u8))
|
||||
collectionOverrides.DeleteOverride(idx--);
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
table.NextColumn();
|
||||
DrawActorIdentifier(idx, actor);
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
if (combo.Draw("##collection", name, $"Select the overriding collection. Current GUID:", Im.ContentRegion.Available.X,
|
||||
table.NextColumn();
|
||||
if (combo.Draw("##collection", name, "Select the overriding collection. Current GUID:", Im.ContentRegion.Available.X,
|
||||
Im.Style.TextHeight))
|
||||
{
|
||||
var (guid, _, newName) = combo.CurrentSelection;
|
||||
collectionOverrides.ChangeOverride(idx, guid, newName);
|
||||
}
|
||||
|
||||
if (ImGui.IsItemHovered())
|
||||
if (Im.Item.Hovered())
|
||||
{
|
||||
using var tt = ImRaii.Tooltip();
|
||||
using var tt = Im.Tooltip.Begin();
|
||||
using var font = Im.Font.PushMono();
|
||||
ImGui.TextUnformatted($" {collection}");
|
||||
Im.Text($" {collection}");
|
||||
}
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
table.NextColumn();
|
||||
DrawCollectionName(exists, collection, name);
|
||||
}
|
||||
|
||||
|
|
@ -84,64 +80,64 @@ public class CollectionOverrideDrawer(
|
|||
{
|
||||
if (!exists)
|
||||
{
|
||||
ImGui.TextUnformatted("<Does not Exist>");
|
||||
if (!ImGui.IsItemHovered())
|
||||
Im.Text("<Does not Exist>"u8);
|
||||
if (!Im.Item.Hovered())
|
||||
return;
|
||||
|
||||
using var tt1 = ImRaii.Tooltip();
|
||||
ImGui.TextUnformatted($"The design {name} with the GUID");
|
||||
using var tt1 = Im.Tooltip.Begin();
|
||||
Im.Text($"The design {name} with the GUID");
|
||||
using (Im.Font.PushMono())
|
||||
{
|
||||
ImGui.TextUnformatted($" {collection}");
|
||||
Im.Text($" {collection}");
|
||||
}
|
||||
|
||||
ImGui.TextUnformatted("does not exist in Penumbra.");
|
||||
Im.Text("does not exist in Penumbra."u8);
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui.TextUnformatted(config.Ephemeral.IncognitoMode ? collection.ToString()[..8] : name);
|
||||
if (!ImGui.IsItemHovered())
|
||||
Im.Text(config.Ephemeral.IncognitoMode ? collection.ToString()[..8] : name);
|
||||
if (!Im.Item.Hovered())
|
||||
return;
|
||||
|
||||
using var tt2 = ImRaii.Tooltip();
|
||||
using var tt2 = Im.Tooltip.Begin();
|
||||
using var f = Im.Font.PushMono();
|
||||
ImGui.TextUnformatted(collection.ToString());
|
||||
Im.Text($"{collection}");
|
||||
}
|
||||
|
||||
private void DrawActorIdentifier(int idx, ActorIdentifier actor)
|
||||
{
|
||||
ImGui.Selectable(config.Ephemeral.IncognitoMode ? actor.Incognito(null) : actor.ToString());
|
||||
using (var target = ImRaii.DragDropTarget())
|
||||
Im.Selectable(config.Ephemeral.IncognitoMode ? actor.Incognito(null) : actor.ToString());
|
||||
using (var target = Im.DragDrop.Target())
|
||||
{
|
||||
if (target.Success && ImGuiUtil.IsDropping("DraggingOverride"))
|
||||
if (target.IsDropping("DraggingOverride"u8))
|
||||
{
|
||||
collectionOverrides.MoveOverride(_dragDropIndex, idx);
|
||||
_dragDropIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
using (var source = ImRaii.DragDropSource())
|
||||
using (var source = Im.DragDrop.Source())
|
||||
{
|
||||
if (source)
|
||||
{
|
||||
ImGui.SetDragDropPayload("DraggingOverride", null, 0);
|
||||
ImGui.TextUnformatted($"Reordering Override #{idx + 1}...");
|
||||
source.SetPayload("DraggingOverride"u8);
|
||||
Im.Text($"Reordering Override #{idx + 1}...");
|
||||
_dragDropIndex = idx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawNewOverride(Vector2 buttonSize)
|
||||
private void DrawNewOverride(in Im.TableDisposable table)
|
||||
{
|
||||
var (currentId, currentName) = penumbra.CurrentCollection;
|
||||
ImGui.TableNextColumn();
|
||||
if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.PersonCirclePlus.ToIconString(), buttonSize, "Add override for current player.",
|
||||
!objects.Player.Valid && currentId != Guid.Empty, true))
|
||||
table.NextColumn();
|
||||
if (ImEx.Icon.Button(FontAwesomeIcon.PersonCirclePlus.Icon(), "Add override for current player."u8,
|
||||
!objects.Player.Valid && currentId != Guid.Empty))
|
||||
collectionOverrides.AddOverride([objects.PlayerData.Identifier], currentId, currentName);
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.SetNextItemWidth(Im.ContentRegion.Available.X);
|
||||
if (ImGui.InputTextWithHint("##newActor", "New Identifier...", ref _newIdentifier, 80))
|
||||
table.NextColumn();
|
||||
Im.Item.SetNextWidthFull();
|
||||
if (Im.Input.Text("##newActor"u8, ref _newIdentifier, "New Identifier..."u8))
|
||||
try
|
||||
{
|
||||
_identifiers = actors.FromUserString(_newIdentifier, false);
|
||||
|
|
@ -154,22 +150,17 @@ public class CollectionOverrideDrawer(
|
|||
|
||||
var tt = _identifiers.Any(i => i.IsValid)
|
||||
? $"Add a new override for {_identifiers.First(i => i.IsValid)}."
|
||||
: _newIdentifier.Length == 0
|
||||
: _newIdentifier.Length is 0
|
||||
? "Please enter an identifier string first."
|
||||
: $"The identifier string {_newIdentifier} does not result in a valid identifier{(_exception == null ? "." : $":\n\n{_exception?.Message}")}";
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Plus.ToIconString(), buttonSize, tt, tt[0] is not 'A', true))
|
||||
table.NextColumn();
|
||||
if (ImEx.Icon.Button(LunaStyle.AddObjectIcon, tt, tt[0] is not 'A'))
|
||||
collectionOverrides.AddOverride(_identifiers, currentId, currentName);
|
||||
|
||||
ImGui.SameLine(0, Im.Style.ItemInnerSpacing.X);
|
||||
using (ImRaii.PushFont(UiBuilder.IconFont))
|
||||
{
|
||||
using var color = ImGuiColor.Text.Push(Im.Style[ImGuiColor.TextDisabled]);
|
||||
ImGui.TextUnformatted(FontAwesomeIcon.InfoCircle.ToIconString());
|
||||
}
|
||||
|
||||
if (ImGui.IsItemHovered())
|
||||
Im.Line.SameInner();
|
||||
ImEx.Icon.DrawAligned(LunaStyle.InfoIcon, ImGuiColor.TextDisabled.Get());
|
||||
if (Im.Item.Hovered())
|
||||
ActorIdentifierFactory.WriteUserStringTooltip(false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public static class UiHelpers
|
|||
|
||||
public static void DrawIcon(this EquipItem item, TextureService textures, Vector2 size, BonusItemFlag slot)
|
||||
{
|
||||
var isEmpty = item.PrimaryId.Id == 0;
|
||||
var isEmpty = item.PrimaryId.Id is 0;
|
||||
var (ptr, textureSize, empty) = textures.GetIcon(item, slot);
|
||||
if (empty)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue