mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2026-02-19 14:07:43 +01:00
THis is the current stuff.
This commit is contained in:
parent
1a4672a901
commit
99f87c744b
11 changed files with 24 additions and 3977 deletions
|
|
@ -5,18 +5,21 @@ using Glamourer.Customization;
|
|||
using Glamourer.Interop;
|
||||
using ImGuiNET;
|
||||
using OtterGui.Raii;
|
||||
using OtterGui.Widgets;
|
||||
using Penumbra.GameData.Data;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Structs;
|
||||
|
||||
namespace Glamourer.Gui.Equipment;
|
||||
|
||||
public enum ApplicationFlags
|
||||
{
|
||||
|
||||
}
|
||||
{ }
|
||||
|
||||
public partial class EquipmentDrawer
|
||||
{
|
||||
private static readonly FilterComboColors _stainCombo;
|
||||
private static readonly StainData _stainData;
|
||||
|
||||
private Race _race;
|
||||
private Gender _gender;
|
||||
private CharacterEquip _equip;
|
||||
|
|
@ -28,8 +31,9 @@ public partial class EquipmentDrawer
|
|||
|
||||
static EquipmentDrawer()
|
||||
{
|
||||
Stains = GameData.Stains(Dalamud.GameData);
|
||||
StainCombo = new FilterStainCombo(140);
|
||||
_stainData = new StainData(Dalamud.PluginInterface, Dalamud.GameData, Dalamud.GameData.Language);
|
||||
_stainCombo = new FilterComboColors(140,
|
||||
_stainData.Data.Prepend(new KeyValuePair<byte, (string Name, uint Dye, bool Gloss)>(0, ("None", 0, false))));
|
||||
Identifier = Glamourer.Identifier;
|
||||
ItemCombos = EquipSlotExtensions.EqdpSlots.Select(s => new ItemCombo(s)).ToArray();
|
||||
MainHandCombo = new WeaponCombo(EquipSlot.MainHand);
|
||||
|
|
@ -76,25 +80,31 @@ public partial class EquipmentDrawer
|
|||
d.DrawInternal(ref mainHand, ref offHand, ref flags);
|
||||
}
|
||||
|
||||
private void DrawStainCombo()
|
||||
{
|
||||
var found = _stainData.TryGetValue(_currentArmor.Stain, out var stain);
|
||||
_stainCombo.Draw("##stain", stain.RgbaColor, found);
|
||||
}
|
||||
|
||||
private void DrawInternal(ref CharacterWeapon mainHand, ref CharacterWeapon offHand)
|
||||
{
|
||||
foreach (var slot in EquipSlotExtensions.EqdpSlots)
|
||||
{
|
||||
using var id = SetSlot(slot);
|
||||
DrawStainSelector();
|
||||
DrawStainCombo();
|
||||
ImGui.SameLine();
|
||||
DrawItemSelector();
|
||||
}
|
||||
|
||||
_currentSlot = EquipSlot.MainHand;
|
||||
DrawStainSelector();
|
||||
DrawStainCombo();
|
||||
ImGui.SameLine();
|
||||
DrawMainHandSelector(ref mainHand);
|
||||
var offhand = MainHandCombo.LastCategory.AllowsOffHand();
|
||||
if (offhand != WeaponCategory.Unknown)
|
||||
{
|
||||
_currentSlot = EquipSlot.OffHand;
|
||||
DrawStainSelector();
|
||||
DrawStainCombo();
|
||||
ImGui.SameLine();
|
||||
DrawOffHandSelector(ref offHand, offhand);
|
||||
}
|
||||
|
|
@ -107,7 +117,7 @@ public partial class EquipmentDrawer
|
|||
using var id = SetSlot(slot);
|
||||
DrawCheckbox(ref flags);
|
||||
ImGui.SameLine();
|
||||
DrawStainSelector();
|
||||
DrawStainCombo();
|
||||
ImGui.SameLine();
|
||||
DrawItemSelector();
|
||||
}
|
||||
|
|
@ -115,7 +125,7 @@ public partial class EquipmentDrawer
|
|||
_currentSlot = EquipSlot.MainHand;
|
||||
DrawCheckbox(ref flags);
|
||||
ImGui.SameLine();
|
||||
DrawStainSelector();
|
||||
DrawStainCombo();
|
||||
ImGui.SameLine();
|
||||
DrawMainHandSelector(ref mainHand);
|
||||
var offhand = MainHandCombo.LastCategory.AllowsOffHand();
|
||||
|
|
@ -124,7 +134,7 @@ public partial class EquipmentDrawer
|
|||
_currentSlot = EquipSlot.OffHand;
|
||||
DrawCheckbox(ref flags);
|
||||
ImGui.SameLine();
|
||||
DrawStainSelector();
|
||||
DrawStainCombo();
|
||||
ImGui.SameLine();
|
||||
DrawOffHandSelector(ref offHand, offhand);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,92 +1,10 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Dalamud.Interface;
|
||||
using Glamourer.State;
|
||||
using ImGuiNET;
|
||||
using ImGuiNET;
|
||||
using OtterGui;
|
||||
using OtterGui.Raii;
|
||||
using OtterGui.Widgets;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Structs;
|
||||
using Stain = Glamourer.Structs.Stain;
|
||||
|
||||
namespace Glamourer.Gui.Equipment;
|
||||
|
||||
public partial class EquipmentDrawer
|
||||
{
|
||||
private static readonly IReadOnlyDictionary<StainId, Stain> Stains;
|
||||
private static readonly FilterStainCombo StainCombo;
|
||||
|
||||
private sealed class FilterStainCombo : FilterComboBase<Stain>
|
||||
{
|
||||
private readonly float _comboWidth;
|
||||
private Vector2 _buttonSize;
|
||||
public ImRaii.Color Color = new();
|
||||
|
||||
public FilterStainCombo(float comboWidth)
|
||||
: base(Stains.Values.ToArray(), false)
|
||||
=> _comboWidth = comboWidth;
|
||||
|
||||
protected override float GetFilterWidth()
|
||||
{
|
||||
// Hack to not color the filter frame.
|
||||
Color.Pop();
|
||||
return _buttonSize.X + ImGui.GetStyle().ScrollbarSize;
|
||||
}
|
||||
|
||||
protected override void DrawList(float width, float itemHeight)
|
||||
{
|
||||
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Vector2.Zero)
|
||||
.Push(ImGuiStyleVar.WindowPadding, Vector2.Zero)
|
||||
.Push(ImGuiStyleVar.FrameRounding, 0);
|
||||
_buttonSize = new Vector2(_comboWidth * ImGuiHelpers.GlobalScale, 0);
|
||||
if (ImGui.GetScrollMaxY() > 0)
|
||||
_buttonSize.X += ImGui.GetStyle().ScrollbarSize;
|
||||
base.DrawList(width, itemHeight);
|
||||
}
|
||||
|
||||
protected override string ToString(Stain obj)
|
||||
=> obj.Name;
|
||||
|
||||
protected override bool DrawSelectable(int globalIdx, bool selected)
|
||||
{
|
||||
var stain = Items[globalIdx];
|
||||
// Push the stain color to type and if it is too bright, turn the text color black.
|
||||
using var colors = ImRaii.PushColor(ImGuiCol.Button, stain.RgbaColor)
|
||||
.Push(ImGuiCol.Text, 0xFF101010, stain.Intensity > 127)
|
||||
.Push(ImGuiCol.Border, 0xFF2020D0, selected);
|
||||
using var style = ImRaii.PushStyle(ImGuiStyleVar.FrameBorderSize, 2f * ImGuiHelpers.GlobalScale, selected);
|
||||
return ImGui.Button(stain.Name, _buttonSize);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawStainSelector()
|
||||
{
|
||||
var foundIdx = StainCombo.Items.IndexOf(s => s.RowIndex.Equals(_currentArmor.Stain));
|
||||
var stain = foundIdx >= 0 ? StainCombo.Items[foundIdx] : default;
|
||||
StainCombo.Color.Push(ImGuiCol.FrameBg, stain.RgbaColor, foundIdx >= 0);
|
||||
var change = StainCombo.Draw("##stainSelector", string.Empty, ref foundIdx, ImGui.GetFrameHeight(), ImGui.GetFrameHeight(),
|
||||
ImGuiComboFlags.NoArrowButton);
|
||||
StainCombo.Color.Pop();
|
||||
if (!change && (byte)_currentArmor.Stain != 0)
|
||||
{
|
||||
ImGuiUtil.HoverTooltip($"{stain.Name}\nRight-click to clear.");
|
||||
if (ImGui.IsItemClicked(ImGuiMouseButton.Right))
|
||||
{
|
||||
change = true;
|
||||
foundIdx = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (change)
|
||||
{
|
||||
_currentArmor = new CharacterArmor(_currentArmor.Set, _currentArmor.Variant,
|
||||
foundIdx >= 0 ? StainCombo.Items[foundIdx].RowIndex : Stain.None.RowIndex);
|
||||
UpdateActors();
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawCheckbox(ref ApplicationFlags flags)
|
||||
=> DrawCheckbox("##checkbox", "Enable writing this slot in this save.", ref flags, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ using ImGuiNET;
|
|||
using Penumbra.GameData.Enums;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using Item = Glamourer.Structs.Item;
|
||||
using Stain = Glamourer.Structs.Stain;
|
||||
|
||||
namespace Glamourer.Gui;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue