mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2026-02-18 21:47:44 +01:00
Services here, too!
This commit is contained in:
parent
1eb16b98a8
commit
85adc3626e
47 changed files with 1015 additions and 562 deletions
|
|
@ -19,8 +19,8 @@ public partial class CustomizationDrawer
|
|||
ImGui.SameLine();
|
||||
using var group = ImRaii.Group();
|
||||
DrawRaceCombo();
|
||||
var gender = Glamourer.Customization.GetName(CustomName.Gender);
|
||||
var clan = Glamourer.Customization.GetName(CustomName.Clan);
|
||||
var gender = _service.AwaitedService.GetName(CustomName.Gender);
|
||||
var clan = _service.AwaitedService.GetName(CustomName.Clan);
|
||||
ImGui.TextUnformatted($"{gender} & {clan}");
|
||||
}
|
||||
|
||||
|
|
@ -39,20 +39,20 @@ public partial class CustomizationDrawer
|
|||
if (!ImGuiUtil.DrawDisabledButton(icon.ToIconString(), _framedIconSize, string.Empty, icon == FontAwesomeIcon.MarsDouble, true))
|
||||
return;
|
||||
|
||||
Changed |= _customize.ChangeGender(CharacterEquip.Null, _customize.Gender is Gender.Male ? Gender.Female : Gender.Male);
|
||||
Changed |= _customize.ChangeGender(CharacterEquip.Null, _customize.Gender is Gender.Male ? Gender.Female : Gender.Male, _items, _service.AwaitedService);
|
||||
}
|
||||
|
||||
private void DrawRaceCombo()
|
||||
{
|
||||
ImGui.SetNextItemWidth(_raceSelectorWidth);
|
||||
using var combo = ImRaii.Combo("##subRaceCombo", _customize.ClanName());
|
||||
using var combo = ImRaii.Combo("##subRaceCombo", _customize.ClanName(_service.AwaitedService));
|
||||
if (!combo)
|
||||
return;
|
||||
|
||||
foreach (var subRace in Enum.GetValues<SubRace>().Skip(1)) // Skip Unknown
|
||||
{
|
||||
if (ImGui.Selectable(CustomizeExtensions.ClanName(subRace, _customize.Gender), subRace == _customize.Clan))
|
||||
Changed |= _customize.ChangeRace(CharacterEquip.Null, subRace);
|
||||
if (ImGui.Selectable(CustomizeExtensions.ClanName(_service.AwaitedService, subRace, _customize.Gender), subRace == _customize.Clan))
|
||||
Changed |= _customize.ChangeRace(CharacterEquip.Null, subRace, _items, _service.AwaitedService);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public partial class CustomizationDrawer
|
|||
custom = _set.Data(index, 0);
|
||||
}
|
||||
|
||||
var icon = Glamourer.Customization.GetIcon(custom!.Value.IconId);
|
||||
var icon = _service.AwaitedService.GetIcon(custom!.Value.IconId);
|
||||
if (ImGui.ImageButton(icon.ImGuiHandle, _iconSize))
|
||||
ImGui.OpenPopup(IconSelectorPopup);
|
||||
ImGuiUtil.HoverIconTooltip(icon, _iconSize);
|
||||
|
|
@ -77,13 +77,12 @@ public partial class CustomizationDrawer
|
|||
if (!popup)
|
||||
return;
|
||||
|
||||
var ret = false;
|
||||
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Vector2.Zero)
|
||||
.Push(ImGuiStyleVar.FrameRounding, 0);
|
||||
for (var i = 0; i < _currentCount; ++i)
|
||||
{
|
||||
var custom = _set.Data(_currentIndex, i, _customize.Face);
|
||||
var icon = Glamourer.Customization.GetIcon(custom.IconId);
|
||||
var icon = _service.AwaitedService.GetIcon(custom.IconId);
|
||||
using (var _ = ImRaii.Group())
|
||||
{
|
||||
if (ImGui.ImageButton(icon.ImGuiHandle, _iconSize))
|
||||
|
|
@ -134,8 +133,8 @@ public partial class CustomizationDrawer
|
|||
var enabled = _customize.Get(featureIdx) != CustomizeValue.Zero;
|
||||
var feature = _set.Data(featureIdx, 0, _customize.Face);
|
||||
var icon = featureIdx == CustomizeIndex.LegacyTattoo
|
||||
? _legacyTattoo ?? Glamourer.Customization.GetIcon(feature.IconId)
|
||||
: Glamourer.Customization.GetIcon(feature.IconId);
|
||||
? _legacyTattoo ?? _service.AwaitedService.GetIcon(feature.IconId)
|
||||
: _service.AwaitedService.GetIcon(feature.IconId);
|
||||
if (ImGui.ImageButton(icon.ImGuiHandle, _iconSize, Vector2.Zero, Vector2.One, (int)ImGui.GetStyle().FramePadding.X,
|
||||
Vector4.Zero, enabled ? Vector4.One : _redTint))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using System.Reflection;
|
|||
using System.Runtime.InteropServices;
|
||||
using Dalamud.Plugin;
|
||||
using Glamourer.Customization;
|
||||
using Glamourer.Services;
|
||||
using ImGuiNET;
|
||||
using OtterGui;
|
||||
using OtterGui.Raii;
|
||||
|
|
@ -40,8 +41,13 @@ public partial class CustomizationDrawer : IDisposable
|
|||
private float _comboSelectorSize;
|
||||
private float _raceSelectorWidth;
|
||||
|
||||
public CustomizationDrawer(DalamudPluginInterface pi)
|
||||
private readonly CustomizationService _service;
|
||||
private readonly ItemManager _items;
|
||||
|
||||
public CustomizationDrawer(DalamudPluginInterface pi, CustomizationService service, ItemManager items)
|
||||
{
|
||||
_service = service;
|
||||
_items = items;
|
||||
_legacyTattoo = GetLegacyTattooIcon(pi);
|
||||
unsafe
|
||||
{
|
||||
|
|
@ -120,7 +126,7 @@ public partial class CustomizationDrawer : IDisposable
|
|||
try
|
||||
{
|
||||
DrawRaceGenderSelector();
|
||||
_set = Glamourer.Customization.GetList(_customize.Clan, _customize.Gender);
|
||||
_set = _service.AwaitedService.GetList(_customize.Clan, _customize.Gender);
|
||||
|
||||
foreach (var id in _set.Order[CharaMakeParams.MenuType.Percentage])
|
||||
PercentageSelector(id);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
using Glamourer.Designs;
|
||||
using System.Numerics;
|
||||
using Dalamud.Game.ClientState.Keys;
|
||||
using Dalamud.Interface;
|
||||
using Glamourer.Designs;
|
||||
using OtterGui;
|
||||
using OtterGui.FileSystem.Selector;
|
||||
|
||||
namespace Glamourer.Gui.Designs;
|
||||
|
|
@ -10,11 +14,12 @@ public sealed class DesignFileSystemSelector : FileSystemSelector<Design, Design
|
|||
public struct DesignState
|
||||
{ }
|
||||
|
||||
public DesignFileSystemSelector(Design.Manager manager, DesignFileSystem fileSystem)
|
||||
: base(fileSystem, Dalamud.KeyState)
|
||||
public DesignFileSystemSelector(Design.Manager manager, DesignFileSystem fileSystem, KeyState keyState)
|
||||
: base(fileSystem, keyState)
|
||||
{
|
||||
_manager = manager;
|
||||
_manager.DesignChange += OnDesignChange;
|
||||
AddButton(DeleteButton, 1000);
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
|
|
@ -36,4 +41,19 @@ public sealed class DesignFileSystemSelector : FileSystemSelector<Design, Design
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void DeleteButton(Vector2 size)
|
||||
{
|
||||
var keys = true;
|
||||
var tt = SelectedLeaf == null
|
||||
? "No design selected."
|
||||
: "Delete the currently selected design entirely from your drive.\n"
|
||||
+ "This can not be undone.";
|
||||
//if (!keys)
|
||||
// tt += $"\nHold {_config.DeleteModModifier} while clicking to delete the mod.";
|
||||
|
||||
if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Trash.ToIconString(), size, tt, SelectedLeaf == null || !keys, true)
|
||||
&& Selected != null)
|
||||
_manager.Delete(Selected);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,10 +2,11 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using Dalamud.Data;
|
||||
using Dalamud.Interface;
|
||||
using Glamourer.Designs;
|
||||
using Glamourer.Services;
|
||||
using Glamourer.State;
|
||||
using Glamourer.Util;
|
||||
using ImGuiNET;
|
||||
using OtterGui;
|
||||
using OtterGui.Widgets;
|
||||
|
|
@ -23,27 +24,27 @@ public class EquipmentDrawer
|
|||
private readonly ItemCombo[] _itemCombo;
|
||||
private readonly Dictionary<(FullEquipType, EquipSlot), WeaponCombo> _weaponCombo;
|
||||
|
||||
public EquipmentDrawer(ItemManager items)
|
||||
public EquipmentDrawer(DataManager gameData, ItemManager items)
|
||||
{
|
||||
_items = items;
|
||||
_stainData = items.Stains;
|
||||
_stainCombo = new FilterComboColors(140,
|
||||
_stainData.Data.Prepend(new KeyValuePair<byte, (string Name, uint Dye, bool Gloss)>(0, ("None", 0, false))));
|
||||
_itemCombo = EquipSlotExtensions.EqdpSlots.Select(e => new ItemCombo(items, e)).ToArray();
|
||||
_itemCombo = EquipSlotExtensions.EqdpSlots.Select(e => new ItemCombo(gameData, items, e)).ToArray();
|
||||
_weaponCombo = new Dictionary<(FullEquipType, EquipSlot), WeaponCombo>(FullEquipTypeExtensions.WeaponTypes.Count * 2);
|
||||
foreach (var type in Enum.GetValues<FullEquipType>())
|
||||
{
|
||||
if (type.ToSlot() is EquipSlot.MainHand)
|
||||
_weaponCombo.TryAdd((type, EquipSlot.MainHand), new WeaponCombo(items, type, EquipSlot.MainHand));
|
||||
_weaponCombo.TryAdd((type, EquipSlot.MainHand), new WeaponCombo(gameData, items, type, EquipSlot.MainHand));
|
||||
else if (type.ToSlot() is EquipSlot.OffHand)
|
||||
_weaponCombo.TryAdd((type, EquipSlot.OffHand), new WeaponCombo(items, type, EquipSlot.OffHand));
|
||||
_weaponCombo.TryAdd((type, EquipSlot.OffHand), new WeaponCombo(gameData, items, type, EquipSlot.OffHand));
|
||||
|
||||
var offhand = type.Offhand();
|
||||
if (offhand is not FullEquipType.Unknown && !_weaponCombo.ContainsKey((offhand, EquipSlot.OffHand)))
|
||||
_weaponCombo.TryAdd((offhand, EquipSlot.OffHand), new WeaponCombo(items, type, EquipSlot.OffHand));
|
||||
_weaponCombo.TryAdd((offhand, EquipSlot.OffHand), new WeaponCombo(gameData, items, type, EquipSlot.OffHand));
|
||||
}
|
||||
|
||||
_weaponCombo.Add((FullEquipType.Unknown, EquipSlot.MainHand), new WeaponCombo(items, FullEquipType.Unknown, EquipSlot.MainHand));
|
||||
_weaponCombo.Add((FullEquipType.Unknown, EquipSlot.MainHand), new WeaponCombo(gameData, items, FullEquipType.Unknown, EquipSlot.MainHand));
|
||||
}
|
||||
|
||||
private string VerifyRestrictedGear(Item gear, EquipSlot slot, Gender gender, Race race)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Glamourer.Util;
|
||||
using Dalamud.Data;
|
||||
using Glamourer.Designs;
|
||||
using Glamourer.Services;
|
||||
using ImGuiNET;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using OtterGui;
|
||||
|
|
@ -17,10 +19,10 @@ public sealed class ItemCombo : FilterComboCache<Item>
|
|||
public readonly string Label;
|
||||
private uint _currentItem;
|
||||
|
||||
public ItemCombo(ItemManager items, EquipSlot slot)
|
||||
public ItemCombo(DataManager gameData, ItemManager items, EquipSlot slot)
|
||||
: base(() => GetItems(items, slot))
|
||||
{
|
||||
Label = GetLabel(slot);
|
||||
Label = GetLabel(gameData, slot);
|
||||
_currentItem = ItemManager.NothingId(slot);
|
||||
}
|
||||
|
||||
|
|
@ -66,9 +68,9 @@ public sealed class ItemCombo : FilterComboCache<Item>
|
|||
protected override string ToString(Item obj)
|
||||
=> obj.Name;
|
||||
|
||||
private static string GetLabel(EquipSlot slot)
|
||||
private static string GetLabel(DataManager gameData, EquipSlot slot)
|
||||
{
|
||||
var sheet = Dalamud.GameData.GetExcelSheet<Addon>()!;
|
||||
var sheet = gameData.GetExcelSheet<Addon>()!;
|
||||
|
||||
return slot switch
|
||||
{
|
||||
|
|
@ -89,7 +91,7 @@ public sealed class ItemCombo : FilterComboCache<Item>
|
|||
private static IReadOnlyList<Item> GetItems(ItemManager items, EquipSlot slot)
|
||||
{
|
||||
var nothing = ItemManager.NothingItem(slot);
|
||||
if (!items.Items.TryGetValue(slot.ToEquipType(), out var list))
|
||||
if (!items.ItemService.AwaitedService.TryGetValue(slot.ToEquipType(), out var list))
|
||||
return new[]
|
||||
{
|
||||
nothing,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Dalamud.Data;
|
||||
using Glamourer.Designs;
|
||||
using Glamourer.Util;
|
||||
using Glamourer.Services;
|
||||
using ImGuiNET;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using OtterGui;
|
||||
|
|
@ -18,9 +19,9 @@ public sealed class WeaponCombo : FilterComboCache<Weapon>
|
|||
public readonly string Label;
|
||||
private uint _currentItem;
|
||||
|
||||
public WeaponCombo(ItemManager items, FullEquipType type, EquipSlot offhand)
|
||||
public WeaponCombo(DataManager gameData, ItemManager items, FullEquipType type, EquipSlot offhand)
|
||||
: base(offhand is EquipSlot.OffHand ? () => GetOff(items, type) : () => GetMain(items, type))
|
||||
=> Label = GetLabel(offhand);
|
||||
=> Label = GetLabel(gameData, offhand);
|
||||
|
||||
protected override void DrawList(float width, float itemHeight)
|
||||
{
|
||||
|
|
@ -64,9 +65,9 @@ public sealed class WeaponCombo : FilterComboCache<Weapon>
|
|||
protected override string ToString(Weapon obj)
|
||||
=> obj.Name;
|
||||
|
||||
private static string GetLabel(EquipSlot offhand)
|
||||
private static string GetLabel(DataManager gameData, EquipSlot offhand)
|
||||
{
|
||||
var sheet = Dalamud.GameData.GetExcelSheet<Addon>()!;
|
||||
var sheet = gameData.GetExcelSheet<Addon>()!;
|
||||
return offhand is EquipSlot.OffHand
|
||||
? sheet.GetRow(739)?.Text.ToString() ?? "Off Hand"
|
||||
: sheet.GetRow(738)?.Text.ToString() ?? "Main Hand";
|
||||
|
|
@ -77,9 +78,9 @@ public sealed class WeaponCombo : FilterComboCache<Weapon>
|
|||
var list = new List<Weapon>();
|
||||
if (type is FullEquipType.Unknown)
|
||||
foreach (var t in Enum.GetValues<FullEquipType>().Where(t => t.ToSlot() == EquipSlot.MainHand))
|
||||
list.AddRange(items.Items[t].Select(w => new Weapon(w, false)));
|
||||
list.AddRange(items.ItemService.AwaitedService[t].Select(w => new Weapon(w, false)));
|
||||
else if (type.ToSlot() is EquipSlot.MainHand)
|
||||
list.AddRange(items.Items[type].Select(w => new Weapon(w, false)));
|
||||
list.AddRange(items.ItemService.AwaitedService[type].Select(w => new Weapon(w, false)));
|
||||
list.Sort((w1, w2) => string.CompareOrdinal(w1.Name, w2.Name));
|
||||
return list;
|
||||
}
|
||||
|
|
@ -89,7 +90,7 @@ public sealed class WeaponCombo : FilterComboCache<Weapon>
|
|||
if (type.ToSlot() == EquipSlot.OffHand)
|
||||
{
|
||||
var nothing = ItemManager.NothingItem(type);
|
||||
if (!items.Items.TryGetValue(type, out var list))
|
||||
if (!items.ItemService.AwaitedService.TryGetValue(type, out var list))
|
||||
return new[]
|
||||
{
|
||||
nothing,
|
||||
|
|
@ -97,7 +98,7 @@ public sealed class WeaponCombo : FilterComboCache<Weapon>
|
|||
|
||||
return list.Select(w => new Weapon(w, true)).OrderBy(w => w.Name).Prepend(nothing).ToList();
|
||||
}
|
||||
else if (items.Items.TryGetValue(type, out var list))
|
||||
else if (items.ItemService.AwaitedService.TryGetValue(type, out var list))
|
||||
{
|
||||
return list.Select(w => new Weapon(w, true)).OrderBy(w => w.Name).ToList();
|
||||
}
|
||||
|
|
|
|||
30
Glamourer/Gui/GlamourerWindowSystem.cs
Normal file
30
Glamourer/Gui/GlamourerWindowSystem.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
using System;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Windowing;
|
||||
|
||||
namespace Glamourer.Gui;
|
||||
|
||||
public class GlamourerWindowSystem : IDisposable
|
||||
{
|
||||
private readonly WindowSystem _windowSystem = new("Glamourer");
|
||||
private readonly UiBuilder _uiBuilder;
|
||||
private readonly Interface _ui;
|
||||
|
||||
public GlamourerWindowSystem(UiBuilder uiBuilder, Interface ui)
|
||||
{
|
||||
_uiBuilder = uiBuilder;
|
||||
_ui = ui;
|
||||
_windowSystem.AddWindow(ui);
|
||||
_uiBuilder.Draw += _windowSystem.Draw;
|
||||
_uiBuilder.OpenConfigUi += _ui.Toggle;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_uiBuilder.Draw -= _windowSystem.Draw;
|
||||
_uiBuilder.OpenConfigUi -= _ui.Toggle;
|
||||
}
|
||||
|
||||
public void Toggle()
|
||||
=> _ui.Toggle();
|
||||
}
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using Dalamud.Game.ClientState.Objects;
|
||||
using Dalamud.Interface;
|
||||
using Glamourer.Interop;
|
||||
using Glamourer.Services;
|
||||
using Glamourer.State;
|
||||
using ImGuiNET;
|
||||
using OtterGui;
|
||||
|
|
@ -14,25 +16,32 @@ using ImGui = ImGuiNET.ImGui;
|
|||
|
||||
namespace Glamourer.Gui;
|
||||
|
||||
internal partial class Interface
|
||||
public partial class Interface
|
||||
{
|
||||
private class ActorTab
|
||||
{
|
||||
private readonly Interface _main;
|
||||
private readonly ActiveDesign.Manager _activeDesigns;
|
||||
private readonly ObjectManager _objects;
|
||||
private readonly TargetManager _targets;
|
||||
private readonly ActorService _actors;
|
||||
private readonly ItemManager _items;
|
||||
|
||||
public ActorTab(Interface main, ActiveDesign.Manager activeDesigns, ObjectManager objects)
|
||||
public ActorTab(Interface main, ActiveDesign.Manager activeDesigns, ObjectManager objects, TargetManager targets, ActorService actors,
|
||||
ItemManager items)
|
||||
{
|
||||
_main = main;
|
||||
_activeDesigns = activeDesigns;
|
||||
_objects = objects;
|
||||
_targets = targets;
|
||||
_actors = actors;
|
||||
_items = items;
|
||||
}
|
||||
|
||||
private ActorIdentifier _identifier = ActorIdentifier.Invalid;
|
||||
private ObjectManager.ActorData _currentData = ObjectManager.ActorData.Invalid;
|
||||
private string _currentLabel = string.Empty;
|
||||
private ActiveDesign? _currentSave;
|
||||
private ActorIdentifier _identifier = ActorIdentifier.Invalid;
|
||||
private ActorData _currentData = ActorData.Invalid;
|
||||
private string _currentLabel = string.Empty;
|
||||
private ActiveDesign? _currentSave;
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
|
|
@ -42,7 +51,7 @@ internal partial class Interface
|
|||
|
||||
DrawActorSelector();
|
||||
if (!_objects.TryGetValue(_identifier, out _currentData))
|
||||
_currentData = ObjectManager.ActorData.Invalid;
|
||||
_currentData = ActorData.Invalid;
|
||||
else
|
||||
_currentLabel = _currentData.Label;
|
||||
|
||||
|
|
@ -64,11 +73,12 @@ internal partial class Interface
|
|||
return;
|
||||
|
||||
if (_currentData.Valid)
|
||||
_currentSave.Initialize(_currentData.Objects[0]);
|
||||
_currentSave.Initialize(_items, _currentData.Objects[0]);
|
||||
|
||||
RevertButton();
|
||||
if (_main._customizationDrawer.Draw(_currentSave.Customize(), _identifier.Type == IdentifierType.Special))
|
||||
_activeDesigns.ChangeCustomize(_currentSave, _main._customizationDrawer.Changed, _main._customizationDrawer.CustomizeData, false);
|
||||
_activeDesigns.ChangeCustomize(_currentSave, _main._customizationDrawer.Changed, _main._customizationDrawer.CustomizeData,
|
||||
false);
|
||||
|
||||
foreach (var slot in EquipSlotExtensions.EqdpSlots)
|
||||
{
|
||||
|
|
@ -76,7 +86,8 @@ internal partial class Interface
|
|||
if (_main._equipmentDrawer.DrawStain(current.Stain, slot, out var stain))
|
||||
_activeDesigns.ChangeStain(_currentSave, slot, stain.RowIndex, false);
|
||||
ImGui.SameLine();
|
||||
if (_main._equipmentDrawer.DrawArmor(current, slot, out var armor, _currentSave.Customize().Gender, _currentSave.Customize().Race))
|
||||
if (_main._equipmentDrawer.DrawArmor(current, slot, out var armor, _currentSave.Customize().Gender,
|
||||
_currentSave.Customize().Race))
|
||||
_activeDesigns.ChangeEquipment(_currentSave, slot, armor, false);
|
||||
}
|
||||
|
||||
|
|
@ -95,9 +106,7 @@ internal partial class Interface
|
|||
}
|
||||
|
||||
if (_main._equipmentDrawer.DrawVisor(_currentSave, out var value))
|
||||
{
|
||||
_activeDesigns.ChangeVisor(_currentSave, value, false);
|
||||
}
|
||||
}
|
||||
|
||||
private const uint RedHeaderColor = 0xFF1818C0;
|
||||
|
|
@ -241,10 +250,10 @@ internal partial class Interface
|
|||
ImGuiClip.DrawEndDummy(remainder, ImGui.GetTextLineHeight());
|
||||
}
|
||||
|
||||
private bool CheckFilter(KeyValuePair<ActorIdentifier, ObjectManager.ActorData> pair)
|
||||
private bool CheckFilter(KeyValuePair<ActorIdentifier, ActorData> pair)
|
||||
=> _actorFilter.IsEmpty || pair.Value.Label.Contains(_actorFilter.Lower, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
private void DrawSelectable(KeyValuePair<ActorIdentifier, ObjectManager.ActorData> pair)
|
||||
private void DrawSelectable(KeyValuePair<ActorIdentifier, ActorData> pair)
|
||||
{
|
||||
var equal = pair.Key.Equals(_identifier);
|
||||
if (ImGui.Selectable(pair.Value.Label, equal) && !equal)
|
||||
|
|
@ -263,13 +272,13 @@ internal partial class Interface
|
|||
|
||||
if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.UserCircle.ToIconString(), buttonWidth
|
||||
, "Select the local player character.", !_objects.Player, true))
|
||||
_identifier = _objects.Player.GetIdentifier();
|
||||
_identifier = _objects.Player.GetIdentifier(_actors.AwaitedService);
|
||||
|
||||
ImGui.SameLine();
|
||||
Actor targetActor = Dalamud.Targets.Target?.Address;
|
||||
Actor targetActor = _targets.Target?.Address;
|
||||
if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.HandPointer.ToIconString(), buttonWidth,
|
||||
"Select the current target, if it is in the list.", _objects.IsInGPose || !targetActor, true))
|
||||
_identifier = targetActor.GetIdentifier();
|
||||
_identifier = targetActor.GetIdentifier(_actors.AwaitedService);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using Glamourer.Customization;
|
||||
using Glamourer.Services;
|
||||
using Glamourer.Util;
|
||||
using ImGuiNET;
|
||||
using OtterGui;
|
||||
|
|
@ -7,31 +8,34 @@ using OtterGui.Raii;
|
|||
|
||||
namespace Glamourer.Gui;
|
||||
|
||||
internal partial class Interface
|
||||
public partial class Interface
|
||||
{
|
||||
private class DebugDataTab
|
||||
{
|
||||
private readonly ICustomizationManager _mg;
|
||||
private readonly CustomizationService _service;
|
||||
|
||||
public DebugDataTab(ICustomizationManager manager)
|
||||
=> _mg = manager;
|
||||
public DebugDataTab(CustomizationService service)
|
||||
=> _service = service;
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
if (!_service.Valid)
|
||||
return;
|
||||
|
||||
using var tab = ImRaii.TabItem("Debug");
|
||||
if (!tab)
|
||||
return;
|
||||
|
||||
foreach (var clan in _mg.Clans)
|
||||
foreach (var clan in _service.AwaitedService.Clans)
|
||||
{
|
||||
foreach (var gender in _mg.Genders)
|
||||
DrawCustomizationInfo(_mg.GetList(clan, gender));
|
||||
foreach (var gender in _service.AwaitedService.Genders)
|
||||
DrawCustomizationInfo(_service.AwaitedService.GetList(clan, gender));
|
||||
}
|
||||
}
|
||||
|
||||
public static void DrawCustomizationInfo(CustomizationSet set)
|
||||
public void DrawCustomizationInfo(CustomizationSet set)
|
||||
{
|
||||
if (!ImGui.CollapsingHeader($"{CustomizeExtensions.ClanName(set.Clan, set.Gender)} {set.Gender}"))
|
||||
if (!ImGui.CollapsingHeader($"{CustomizeExtensions.ClanName(_service.AwaitedService, set.Clan, set.Gender)} {set.Gender}"))
|
||||
return;
|
||||
|
||||
using var table = ImRaii.Table("data", 5);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ using Penumbra.GameData.Actors;
|
|||
|
||||
namespace Glamourer.Gui;
|
||||
|
||||
internal partial class Interface
|
||||
public partial class Interface
|
||||
{
|
||||
private class DebugStateTab
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,34 +1,31 @@
|
|||
using System;
|
||||
using System.Numerics;
|
||||
using Dalamud.Game.ClientState.Keys;
|
||||
using Dalamud.Interface;
|
||||
using Glamourer.Customization;
|
||||
using Glamourer.Designs;
|
||||
using Glamourer.Gui.Customization;
|
||||
using Glamourer.Gui.Designs;
|
||||
using Glamourer.Gui.Equipment;
|
||||
using Glamourer.Interop;
|
||||
using ImGuiNET;
|
||||
using OtterGui.Raii;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Structs;
|
||||
|
||||
namespace Glamourer.Gui;
|
||||
|
||||
internal partial class Interface
|
||||
public partial class Interface
|
||||
{
|
||||
private class DesignTab : IDisposable
|
||||
{
|
||||
public readonly DesignFileSystemSelector Selector;
|
||||
private readonly Interface _main;
|
||||
private readonly DesignFileSystem _fileSystem;
|
||||
private readonly Design.Manager _manager;
|
||||
private readonly Design.Manager _manager;
|
||||
|
||||
public DesignTab(Interface main, Design.Manager manager, DesignFileSystem fileSystem)
|
||||
public DesignTab(Interface main, Design.Manager manager, DesignFileSystem fileSystem, KeyState keyState)
|
||||
{
|
||||
_main = main;
|
||||
_manager = manager;
|
||||
_fileSystem = fileSystem;
|
||||
Selector = new DesignFileSystemSelector(manager, fileSystem);
|
||||
Selector = new DesignFileSystemSelector(manager, fileSystem, keyState);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
|
|
|||
|
|
@ -1,29 +1,28 @@
|
|||
using System;
|
||||
using Glamourer.State;
|
||||
using ImGuiNET;
|
||||
using OtterGui;
|
||||
using OtterGui.Raii;
|
||||
|
||||
namespace Glamourer.Gui;
|
||||
|
||||
internal partial class Interface
|
||||
public partial class Interface
|
||||
{
|
||||
private static void Checkmark(string label, string tooltip, bool value, Action<bool> setter)
|
||||
private void Checkmark(string label, string tooltip, bool value, Action<bool> setter)
|
||||
{
|
||||
if (ImGuiUtil.Checkbox(label, tooltip, value, setter))
|
||||
Glamourer.Config.Save();
|
||||
_config.Save();
|
||||
}
|
||||
|
||||
private static void ChangeAndSave<T>(T value, T currentValue, Action<T> setter) where T : IEquatable<T>
|
||||
private void ChangeAndSave<T>(T value, T currentValue, Action<T> setter) where T : IEquatable<T>
|
||||
{
|
||||
if (value.Equals(currentValue))
|
||||
return;
|
||||
|
||||
setter(value);
|
||||
Glamourer.Config.Save();
|
||||
_config.Save();
|
||||
}
|
||||
|
||||
private static void DrawColorPicker(string name, string tooltip, uint value, uint defaultValue, Action<uint> setter)
|
||||
private void DrawColorPicker(string name, string tooltip, uint value, uint defaultValue, Action<uint> setter)
|
||||
{
|
||||
const ImGuiColorEditFlags flags = ImGuiColorEditFlags.AlphaPreviewHalf | ImGuiColorEditFlags.NoInputs;
|
||||
|
||||
|
|
@ -42,7 +41,7 @@ internal partial class Interface
|
|||
|
||||
private static void DrawRestorePenumbraButton()
|
||||
{
|
||||
const string buttonLabel = "Re-Register Penumbra";
|
||||
//const string buttonLabel = "Re-Register Penumbra";
|
||||
// TODO
|
||||
//if (ImGui.Button(buttonLabel))
|
||||
// Glamourer.Penumbra.Reattach(true);
|
||||
|
|
@ -51,36 +50,35 @@ internal partial class Interface
|
|||
// "If Penumbra did not register the functions for some reason, pressing this button might help restore functionality.");
|
||||
}
|
||||
|
||||
private static void DrawSettingsTab()
|
||||
private void DrawSettingsTab()
|
||||
{
|
||||
using var tab = ImRaii.TabItem("Settings");
|
||||
if (!tab)
|
||||
return;
|
||||
|
||||
var cfg = Glamourer.Config;
|
||||
ImGui.Dummy(_spacing);
|
||||
|
||||
Checkmark("Folders First", "Sort Folders before all designs instead of lexicographically.", cfg.FoldersFirst,
|
||||
v => cfg.FoldersFirst = v);
|
||||
Checkmark("Folders First", "Sort Folders before all designs instead of lexicographically.", _config.FoldersFirst,
|
||||
v => _config.FoldersFirst = v);
|
||||
Checkmark("Color Designs", "Color the names of designs in the selector using the colors from below for the given cases.",
|
||||
cfg.ColorDesigns,
|
||||
v => cfg.ColorDesigns = v);
|
||||
Checkmark("Show Locks", "Write-protected Designs show a lock besides their name in the selector.", cfg.ShowLocks,
|
||||
v => cfg.ShowLocks = v);
|
||||
_config.ColorDesigns,
|
||||
v => _config.ColorDesigns = v);
|
||||
Checkmark("Show Locks", "Write-protected Designs show a lock besides their name in the selector.", _config.ShowLocks,
|
||||
v => _config.ShowLocks = v);
|
||||
DrawRestorePenumbraButton();
|
||||
|
||||
Checkmark("Apply Fixed Designs",
|
||||
"Automatically apply fixed designs to characters and redraw them when anything changes.",
|
||||
cfg.ApplyFixedDesigns,
|
||||
v => { cfg.ApplyFixedDesigns = v; });
|
||||
_config.ApplyFixedDesigns,
|
||||
v => { _config.ApplyFixedDesigns = v; });
|
||||
|
||||
ImGui.Dummy(_spacing);
|
||||
|
||||
DrawColorPicker("Customization Color", "The color for designs that only apply their character customization.",
|
||||
cfg.CustomizationColor, GlamourerConfig.DefaultCustomizationColor, c => cfg.CustomizationColor = c);
|
||||
_config.CustomizationColor, Configuration.DefaultCustomizationColor, c => _config.CustomizationColor = c);
|
||||
DrawColorPicker("Equipment Color", "The color for designs that only apply some or all of their equipment slots and stains.",
|
||||
cfg.EquipmentColor, GlamourerConfig.DefaultEquipmentColor, c => cfg.EquipmentColor = c);
|
||||
_config.EquipmentColor, Configuration.DefaultEquipmentColor, c => _config.EquipmentColor = c);
|
||||
DrawColorPicker("State Color", "The color for designs that only apply some state modification.",
|
||||
cfg.StateColor, GlamourerConfig.DefaultStateColor, c => cfg.StateColor = c);
|
||||
_config.StateColor, Configuration.DefaultStateColor, c => _config.StateColor = c);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using ImGuiNET;
|
|||
|
||||
namespace Glamourer.Gui;
|
||||
|
||||
internal partial class Interface
|
||||
public partial class Interface
|
||||
{
|
||||
private static Vector2 _spacing = Vector2.Zero;
|
||||
private static float _actorSelectorWidth;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
using System;
|
||||
using System.Numerics;
|
||||
using Dalamud.Data;
|
||||
using Dalamud.Game.ClientState.Keys;
|
||||
using Dalamud.Game.ClientState.Objects;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Logging;
|
||||
using Dalamud.Plugin;
|
||||
|
|
@ -7,43 +10,43 @@ using Glamourer.Designs;
|
|||
using Glamourer.Gui.Customization;
|
||||
using Glamourer.Gui.Equipment;
|
||||
using Glamourer.Interop;
|
||||
using Glamourer.Services;
|
||||
using Glamourer.State;
|
||||
using Glamourer.Util;
|
||||
using ImGuiNET;
|
||||
using OtterGui.Raii;
|
||||
|
||||
namespace Glamourer.Gui;
|
||||
|
||||
internal partial class Interface : Window, IDisposable
|
||||
public partial class Interface : Window, IDisposable
|
||||
{
|
||||
private readonly DalamudPluginInterface _pi;
|
||||
|
||||
private readonly EquipmentDrawer _equipmentDrawer;
|
||||
private readonly CustomizationDrawer _customizationDrawer;
|
||||
|
||||
private readonly ActorTab _actorTab;
|
||||
private readonly DesignTab _designTab;
|
||||
private readonly DebugStateTab _debugStateTab;
|
||||
private readonly DebugDataTab _debugDataTab;
|
||||
private readonly Configuration _config;
|
||||
private readonly ActorTab _actorTab;
|
||||
private readonly DesignTab _designTab;
|
||||
private readonly DebugStateTab _debugStateTab;
|
||||
private readonly DebugDataTab _debugDataTab;
|
||||
|
||||
public Interface(DalamudPluginInterface pi, ItemManager items, ActiveDesign.Manager activeDesigns, Design.Manager manager,
|
||||
DesignFileSystem fileSystem, ObjectManager objects)
|
||||
DesignFileSystem fileSystem, ObjectManager objects, CustomizationService customization, Configuration config, DataManager gameData, TargetManager targets, ActorService actors, KeyState keyState)
|
||||
: base(GetLabel())
|
||||
{
|
||||
_pi = pi;
|
||||
_equipmentDrawer = new EquipmentDrawer(items);
|
||||
_customizationDrawer = new CustomizationDrawer(pi);
|
||||
Dalamud.PluginInterface.UiBuilder.DisableGposeUiHide = true;
|
||||
Dalamud.PluginInterface.UiBuilder.OpenConfigUi += Toggle;
|
||||
_pi = pi;
|
||||
_config = config;
|
||||
_equipmentDrawer = new EquipmentDrawer(gameData, items);
|
||||
_customizationDrawer = new CustomizationDrawer(pi, customization, items);
|
||||
pi.UiBuilder.DisableGposeUiHide = true;
|
||||
SizeConstraints = new WindowSizeConstraints()
|
||||
{
|
||||
MinimumSize = new Vector2(675, 675),
|
||||
MaximumSize = ImGui.GetIO().DisplaySize,
|
||||
};
|
||||
_actorTab = new ActorTab(this, activeDesigns, objects);
|
||||
_actorTab = new ActorTab(this, activeDesigns, objects, targets, actors, items);
|
||||
_debugStateTab = new DebugStateTab(activeDesigns);
|
||||
_debugDataTab = new DebugDataTab(Glamourer.Customization);
|
||||
_designTab = new DesignTab(this, manager, fileSystem);
|
||||
_debugDataTab = new DebugDataTab(customization);
|
||||
_designTab = new DesignTab(this, manager, fileSystem, keyState);
|
||||
}
|
||||
|
||||
public override void Draw()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
namespace Glamourer.Gui;
|
||||
|
||||
internal partial class Interface
|
||||
public partial class Interface
|
||||
{
|
||||
//private readonly CharacterSave _currentSave = new();
|
||||
//private string _newDesignName = string.Empty;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue