Random fixes and penumbra attach update.

This commit is contained in:
Ottermandias 2022-06-04 20:59:53 +02:00
parent 78fd4ce9b9
commit dbdaaf1ca8
15 changed files with 264 additions and 180 deletions

View file

@ -18,12 +18,14 @@ namespace Glamourer.Gui
{
internal partial class Interface
{
private readonly CharacterSave _currentSave = new();
private string _newDesignName = string.Empty;
private bool _keyboardFocus;
private const string DesignNamePopupLabel = "Save Design As...";
private const uint RedHeaderColor = 0xFF1818C0;
private const uint GreenHeaderColor = 0xFF18C018;
private readonly CharacterSave _currentSave = new();
private string _newDesignName = string.Empty;
private bool _keyboardFocus;
private bool _holdShift;
private bool _holdCtrl;
private const string DesignNamePopupLabel = "Save Design As...";
private const uint RedHeaderColor = 0xFF1818C0;
private const uint GreenHeaderColor = 0xFF18C018;
private void DrawPlayerHeader()
{
@ -58,10 +60,10 @@ namespace Glamourer.Gui
save.Apply(player);
}
private CharacterSave ConditionalCopy(CharacterSave save)
private static CharacterSave ConditionalCopy(CharacterSave save, bool shift, bool ctrl)
{
var copy = save.Copy();
if (ImGui.GetIO().KeyShift)
if (shift)
{
copy.Load(new CharacterEquipment());
copy.SetHatState = false;
@ -69,7 +71,7 @@ namespace Glamourer.Gui
copy.SetWeaponState = false;
copy.WriteEquipment = CharacterEquipMask.None;
}
else if (ImGui.GetIO().KeyCtrl)
else if (ctrl)
{
copy.Load(CharacterCustomization.Default);
copy.SetHatState = false;
@ -77,8 +79,8 @@ namespace Glamourer.Gui
copy.SetWeaponState = false;
copy.WriteCustomizations = false;
}
return save.Copy();
return copy;
}
private bool DrawApplyClipboardButton()

View file

@ -162,7 +162,7 @@ namespace Glamourer.Gui
var count = set.Count(CustomizationId.FacialFeaturesTattoos);
using (var _ = ImGuiRaii.NewGroup())
{
var face = set.Race == Race.Hrothgar ? customization.Hairstyle : customization.Face;
var face = customization.Face;
if (set.Faces.Count < face)
face = 1;
for (var i = 0; i < count; ++i)
@ -288,9 +288,6 @@ namespace Glamourer.Gui
ret = true;
}
if (id == CustomizationId.Hairstyle && customization.Race == Race.Hrothgar)
customization[CustomizationId.Face] = (byte) ((customization[CustomizationId.Hairstyle] + 1) / 2);
ImGui.Text($"{label} ({custom.Value.Value})");
ImGuiCustom.HoverTooltip(tooltip);

View file

@ -57,6 +57,7 @@ namespace Glamourer.Gui
if (!change)
return false;
newItem = new Item(newItem.Base, newItem.Name, slot);
if (_player == null)
return _inDesignMode && (_selection?.Data.WriteItem(newItem) ?? false);

View file

@ -37,10 +37,7 @@ namespace Glamourer.Gui
case CustomizationId.Gender: break;
case CustomizationId.FacialFeaturesTattoos: break;
case CustomizationId.HighlightsOnFlag: break;
case CustomizationId.Face:
if (customization.Race != Race.Hrothgar)
goto default;
break;
case CustomizationId.Face: break;
default:
var count = set.Count(id);
if (set.DataByValue(id, customization[id], out _) < 0)
@ -148,7 +145,7 @@ namespace Glamourer.Gui
switch (use)
{
case DesignNameUse.SaveCurrent:
SaveNewDesign(ConditionalCopy(_currentSave));
SaveNewDesign(ConditionalCopy(_currentSave, _holdShift, _holdCtrl));
break;
case DesignNameUse.NewDesign:
var empty = new CharacterSave();
@ -157,7 +154,7 @@ namespace Glamourer.Gui
SaveNewDesign(empty);
break;
case DesignNameUse.DuplicateDesign:
SaveNewDesign(ConditionalCopy(_selection!.Data));
SaveNewDesign(ConditionalCopy(_selection!.Data, _holdShift, _holdCtrl));
break;
case DesignNameUse.NewFolder:
_designs.FileSystem
@ -196,6 +193,8 @@ namespace Glamourer.Gui
{
_newDesignName = string.Empty;
_keyboardFocus = true;
_holdCtrl = ImGui.GetIO().KeyCtrl;
_holdShift = ImGui.GetIO().KeyShift;
ImGui.OpenPopup($"{DesignNamePopupLabel}{use}");
}
}