mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 10:17:23 +01:00
Change how customization config works a bit.
This commit is contained in:
parent
25cded7f9f
commit
519bfffbb2
5 changed files with 57 additions and 55 deletions
|
|
@ -25,6 +25,7 @@ public partial class CustomizationDrawer
|
|||
ImGui.OpenPopup(ColorPickerPopupName);
|
||||
}
|
||||
|
||||
var npc = false;
|
||||
if (current < 0)
|
||||
{
|
||||
using var font = ImRaii.PushFont(UiBuilder.IconFont);
|
||||
|
|
@ -32,13 +33,14 @@ public partial class CustomizationDrawer
|
|||
var pos = ImGui.GetItemRectMin() + (ImGui.GetItemRectSize() - size) / 2;
|
||||
ImGui.GetWindowDrawList().AddText(pos, ImGui.GetColorU32(ImGuiCol.Text), FontAwesomeIcon.Question.ToIconString());
|
||||
current = 0;
|
||||
npc = true;
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
|
||||
using (var group = ImRaii.Group())
|
||||
{
|
||||
DataInputInt(current);
|
||||
DataInputInt(current, npc);
|
||||
if (_withApply)
|
||||
{
|
||||
ApplyCheckbox();
|
||||
|
|
@ -46,7 +48,7 @@ public partial class CustomizationDrawer
|
|||
}
|
||||
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted(custom.Color == 0 ? $"{_currentOption} (Custom #{custom.Value})" : _currentOption);
|
||||
ImGui.TextUnformatted(custom.Color == 0 ? $"{_currentOption} (NPC)" : _currentOption);
|
||||
}
|
||||
|
||||
DrawColorPickerPopup();
|
||||
|
|
|
|||
|
|
@ -19,11 +19,13 @@ public partial class CustomizationDrawer
|
|||
var label = _currentOption;
|
||||
|
||||
var current = _set.DataByValue(index, _currentByte, out var custom, _customize.Face);
|
||||
var npc = false;
|
||||
if (current < 0)
|
||||
{
|
||||
label = $"{_currentOption} (Custom #{_customize[index]})";
|
||||
label = $"{_currentOption} (NPC)";
|
||||
current = 0;
|
||||
custom = _set.Data(index, 0);
|
||||
npc = true;
|
||||
}
|
||||
|
||||
var icon = _service.AwaitedService.GetIcon(custom!.Value.IconId);
|
||||
|
|
@ -34,10 +36,7 @@ public partial class CustomizationDrawer
|
|||
ImGui.SameLine();
|
||||
using (var group = ImRaii.Group())
|
||||
{
|
||||
if (_currentIndex == CustomizeIndex.Face)
|
||||
FaceInputInt(current);
|
||||
else
|
||||
DataInputInt(current);
|
||||
DataInputInt(current, npc);
|
||||
|
||||
if (_withApply)
|
||||
{
|
||||
|
|
@ -45,38 +44,12 @@ public partial class CustomizationDrawer
|
|||
ImGui.SameLine();
|
||||
}
|
||||
|
||||
ImGui.TextUnformatted($"{label} ({custom.Value.Value})");
|
||||
ImGui.TextUnformatted(label);
|
||||
}
|
||||
|
||||
DrawIconPickerPopup();
|
||||
}
|
||||
|
||||
private bool UpdateFace(CustomizeData data)
|
||||
{
|
||||
// Hrothgar Hack
|
||||
var value = _set.Race == Race.Hrothgar ? data.Value + 4 : data.Value;
|
||||
if (_customize.Face == value)
|
||||
return false;
|
||||
|
||||
_customize.Face = value;
|
||||
Changed |= CustomizeFlag.Face;
|
||||
return true;
|
||||
}
|
||||
|
||||
private void FaceInputInt(int currentIndex)
|
||||
{
|
||||
++currentIndex;
|
||||
ImGui.SetNextItemWidth(_inputIntSize);
|
||||
if (ImGui.InputInt("##text", ref currentIndex, 1, 1))
|
||||
{
|
||||
currentIndex = Math.Clamp(currentIndex - 1, 0, _currentCount - 1);
|
||||
var data = _set.Data(_currentIndex, currentIndex, _customize.Face);
|
||||
UpdateFace(data);
|
||||
}
|
||||
|
||||
ImGuiUtil.HoverTooltip($"Input Range: [1, {_currentCount}]");
|
||||
}
|
||||
|
||||
private void DrawIconPickerPopup()
|
||||
{
|
||||
using var popup = ImRaii.Popup(IconSelectorPopup, ImGuiWindowFlags.AlwaysAutoResize);
|
||||
|
|
@ -93,10 +66,7 @@ public partial class CustomizationDrawer
|
|||
{
|
||||
if (ImGui.ImageButton(icon.ImGuiHandle, _iconSize))
|
||||
{
|
||||
if (_currentIndex == CustomizeIndex.Face)
|
||||
UpdateFace(custom);
|
||||
else
|
||||
UpdateValue(custom.Value);
|
||||
UpdateValue(custom.Value);
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
using System;
|
||||
using System.Numerics;
|
||||
using Glamourer.Customization;
|
||||
using ImGuiNET;
|
||||
using OtterGui;
|
||||
using OtterGui.Raii;
|
||||
using Penumbra.GameData.Enums;
|
||||
|
||||
namespace Glamourer.Gui.Customization;
|
||||
|
||||
|
|
@ -45,18 +47,33 @@ public partial class CustomizationDrawer
|
|||
}
|
||||
|
||||
// Integral input for an icon- or color based item.
|
||||
private void DataInputInt(int currentIndex)
|
||||
private void DataInputInt(int currentIndex, bool npc)
|
||||
{
|
||||
++currentIndex;
|
||||
ImGui.SetNextItemWidth(_inputIntSize);
|
||||
if (ImGui.InputInt("##text", ref currentIndex, 1, 1))
|
||||
{
|
||||
currentIndex = Math.Clamp(currentIndex - 1, 0, _currentCount - 1);
|
||||
var data = _set.Data(_currentIndex, currentIndex, _customize.Face);
|
||||
UpdateValue(data.Value);
|
||||
}
|
||||
int value = _currentByte.Value;
|
||||
// Hrothgar face hack.
|
||||
if (_currentIndex is CustomizeIndex.Face && _set.Race is Race.Hrothgar)
|
||||
value -= 4;
|
||||
|
||||
ImGuiUtil.HoverTooltip($"Input Range: [1, {_currentCount}]");
|
||||
ImGui.SetNextItemWidth(_inputIntSizeNoButtons);
|
||||
if (ImGui.InputInt("##text", ref value, 0, 0))
|
||||
{
|
||||
var index = _set.DataByValue(_currentIndex, (CustomizeValue)value, out var data, _customize.Face);
|
||||
if (index >= 0)
|
||||
UpdateValue(data!.Value.Value);
|
||||
else if (ImGui.GetIO().KeyCtrl)
|
||||
UpdateValue((CustomizeValue)value);
|
||||
}
|
||||
if (!_withApply)
|
||||
ImGuiUtil.HoverTooltip("Hold Control to force updates with invalid/unknown options at your own risk.");
|
||||
|
||||
ImGui.SameLine();
|
||||
if (ImGuiUtil.DrawDisabledButton("-", new Vector2(ImGui.GetFrameHeight()), "Select the previous available option in order.",
|
||||
currentIndex <= 0))
|
||||
UpdateValue(_set.Data(_currentIndex, currentIndex - 1, _customize.Face).Value);
|
||||
ImGui.SameLine();
|
||||
if (ImGuiUtil.DrawDisabledButton("+", new Vector2(ImGui.GetFrameHeight()), "Select the next available option in order.",
|
||||
currentIndex >= _currentCount - 1 || npc))
|
||||
UpdateValue(_set.Data(_currentIndex, currentIndex + 1, _customize.Face).Value);
|
||||
}
|
||||
|
||||
private void DrawListSelector(CustomizeIndex index)
|
||||
|
|
@ -109,7 +126,8 @@ public partial class CustomizationDrawer
|
|||
var tmp = _currentByte != CustomizeValue.Zero;
|
||||
if (_withApply)
|
||||
{
|
||||
switch (UiHelpers.DrawMetaToggle(_currentIndex.ToDefaultName(), string.Empty, tmp, _currentApply, out var newValue, out var newApply, _locked))
|
||||
switch (UiHelpers.DrawMetaToggle(_currentIndex.ToDefaultName(), string.Empty, tmp, _currentApply, out var newValue,
|
||||
out var newApply, _locked))
|
||||
{
|
||||
case DataChange.Item:
|
||||
ChangeApply = newApply ? ChangeApply | _currentFlag : ChangeApply & ~_currentFlag;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ using Glamourer.Services;
|
|||
using ImGuiNET;
|
||||
using OtterGui;
|
||||
using OtterGui.Raii;
|
||||
using Penumbra.GameData.Enums;
|
||||
using CustomizeData = Penumbra.GameData.Structs.CustomizeData;
|
||||
|
||||
namespace Glamourer.Gui.Customization;
|
||||
|
|
@ -42,6 +43,7 @@ public partial class CustomizationDrawer : IDisposable
|
|||
private Vector2 _iconSize;
|
||||
private Vector2 _framedIconSize;
|
||||
private float _inputIntSize;
|
||||
private float _inputIntSizeNoButtons;
|
||||
private float _comboSelectorSize;
|
||||
private float _raceSelectorWidth;
|
||||
private bool _withApply;
|
||||
|
|
@ -116,6 +118,10 @@ public partial class CustomizationDrawer : IDisposable
|
|||
if (_currentByte == value)
|
||||
return;
|
||||
|
||||
// Hrothgar Face Hack.
|
||||
if (_currentIndex is CustomizeIndex.Face && _set.Race is Race.Hrothgar)
|
||||
value += 4;
|
||||
|
||||
_customize[_currentIndex] = value;
|
||||
Changed |= _currentFlag;
|
||||
}
|
||||
|
|
@ -198,6 +204,7 @@ public partial class CustomizationDrawer : IDisposable
|
|||
_iconSize = new Vector2(ImGui.GetTextLineHeight() * 2 + ImGui.GetStyle().ItemSpacing.Y + 2 * ImGui.GetStyle().FramePadding.Y);
|
||||
_framedIconSize = _iconSize + 2 * ImGui.GetStyle().FramePadding;
|
||||
_inputIntSize = 2 * _framedIconSize.X + 1 * _spacing.X;
|
||||
_inputIntSizeNoButtons = _inputIntSize - 2 * _spacing.X - 2 * ImGui.GetFrameHeight();
|
||||
_comboSelectorSize = 4 * _framedIconSize.X + 3 * _spacing.X;
|
||||
_raceSelectorWidth = _inputIntSize + _comboSelectorSize - _framedIconSize.X;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ public class EquipmentDrawer
|
|||
StainId cMainhandStain, out StainId rMainhandStain, StainId cOffhandStain, out StainId rOffhandStain, EquipFlag? cApply,
|
||||
out bool rApplyMainhand, out bool rApplyMainhandStain, out bool rApplyOffhand, out bool rApplyOffhandStain, bool locked)
|
||||
{
|
||||
var allWeapons = cApply.HasValue;
|
||||
if (_config.HideApplyCheckmarks)
|
||||
cApply = null;
|
||||
|
||||
|
|
@ -116,10 +117,12 @@ public class EquipmentDrawer
|
|||
|
||||
if (_config.SmallEquip)
|
||||
return DrawWeaponsSmall(cMainhand, out rMainhand, cOffhand, out rOffhand, cMainhandStain, out rMainhandStain, cOffhandStain,
|
||||
out rOffhandStain, cApply, out rApplyMainhand, out rApplyMainhandStain, out rApplyOffhand, out rApplyOffhandStain, locked);
|
||||
out rOffhandStain, cApply, out rApplyMainhand, out rApplyMainhandStain, out rApplyOffhand, out rApplyOffhandStain, locked,
|
||||
allWeapons);
|
||||
|
||||
return DrawWeaponsNormal(cMainhand, out rMainhand, cOffhand, out rOffhand, cMainhandStain, out rMainhandStain, cOffhandStain,
|
||||
out rOffhandStain, cApply, out rApplyMainhand, out rApplyMainhandStain, out rApplyOffhand, out rApplyOffhandStain, locked);
|
||||
out rOffhandStain, cApply, out rApplyMainhand, out rApplyMainhandStain, out rApplyOffhand, out rApplyOffhandStain, locked,
|
||||
allWeapons);
|
||||
}
|
||||
|
||||
public bool DrawHatState(bool currentValue, out bool newValue, bool locked)
|
||||
|
|
@ -408,7 +411,8 @@ public class EquipmentDrawer
|
|||
|
||||
private DataChange DrawWeaponsSmall(EquipItem cMainhand, out EquipItem rMainhand, EquipItem cOffhand, out EquipItem rOffhand,
|
||||
StainId cMainhandStain, out StainId rMainhandStain, StainId cOffhandStain, out StainId rOffhandStain, EquipFlag? cApply,
|
||||
out bool rApplyMainhand, out bool rApplyMainhandStain, out bool rApplyOffhand, out bool rApplyOffhandStain, bool locked)
|
||||
out bool rApplyMainhand, out bool rApplyMainhandStain, out bool rApplyOffhand, out bool rApplyOffhandStain, bool locked,
|
||||
bool allWeapons)
|
||||
{
|
||||
var changes = DataChange.None;
|
||||
if (DrawStain(EquipSlot.MainHand, cMainhandStain, out rMainhandStain, locked, true))
|
||||
|
|
@ -416,7 +420,7 @@ public class EquipmentDrawer
|
|||
ImGui.SameLine();
|
||||
|
||||
rOffhand = cOffhand;
|
||||
if (DrawMainhand(cMainhand, cApply.HasValue, out rMainhand, out var mainhandLabel, locked, true))
|
||||
if (DrawMainhand(cMainhand, allWeapons, out rMainhand, out var mainhandLabel, locked, true))
|
||||
{
|
||||
changes |= DataChange.Item;
|
||||
if (rMainhand.Type.ValidOffhand() != cMainhand.Type.ValidOffhand())
|
||||
|
|
@ -480,7 +484,8 @@ public class EquipmentDrawer
|
|||
|
||||
private DataChange DrawWeaponsNormal(EquipItem cMainhand, out EquipItem rMainhand, EquipItem cOffhand, out EquipItem rOffhand,
|
||||
StainId cMainhandStain, out StainId rMainhandStain, StainId cOffhandStain, out StainId rOffhandStain, EquipFlag? cApply,
|
||||
out bool rApplyMainhand, out bool rApplyMainhandStain, out bool rApplyOffhand, out bool rApplyOffhandStain, bool locked)
|
||||
out bool rApplyMainhand, out bool rApplyMainhandStain, out bool rApplyOffhand, out bool rApplyOffhandStain, bool locked,
|
||||
bool allWeapons)
|
||||
{
|
||||
var changes = DataChange.None;
|
||||
|
||||
|
|
@ -492,7 +497,7 @@ public class EquipmentDrawer
|
|||
using (var group = ImRaii.Group())
|
||||
{
|
||||
rOffhand = cOffhand;
|
||||
if (DrawMainhand(cMainhand, cApply.HasValue, out rMainhand, out var mainhandLabel, locked, false))
|
||||
if (DrawMainhand(cMainhand, allWeapons, out rMainhand, out var mainhandLabel, locked, false))
|
||||
{
|
||||
changes |= DataChange.Item;
|
||||
if (rMainhand.Type.ValidOffhand() != cMainhand.Type.ValidOffhand())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue