Add mode to have one-line Equipment display, fix customization not changing in Designs.

This commit is contained in:
Ottermandias 2023-07-13 16:38:03 +02:00
parent 656c8ed564
commit 51bfcd1136
7 changed files with 304 additions and 167 deletions

View file

@ -109,23 +109,23 @@ public partial class CustomizationDrawer
var tmp = _currentByte != CustomizeValue.Zero;
if (_withApply)
{
switch (UiHelpers.DrawMetaToggle(_currentOption, 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;
_customize.Set(idx, tmp ? CustomizeValue.Max : CustomizeValue.Zero);
_customize.Set(idx, newValue ? CustomizeValue.Max : CustomizeValue.Zero);
Changed |= _currentFlag;
break;
case DataChange.ApplyItem:
ChangeApply = newApply ? ChangeApply | _currentFlag : ChangeApply & ~_currentFlag;
break;
case DataChange.Item | DataChange.ApplyItem:
_customize.Set(idx, tmp ? CustomizeValue.Max : CustomizeValue.Zero);
_customize.Set(idx, newValue ? CustomizeValue.Max : CustomizeValue.Zero);
Changed |= _currentFlag;
break;
}
}
else if (ImGui.Checkbox(_currentOption, ref tmp))
else if (ImGui.Checkbox(_currentIndex.ToDefaultName(), ref tmp))
{
_customize.Set(idx, tmp ? CustomizeValue.Max : CustomizeValue.Zero);
Changed |= _currentFlag;
@ -144,4 +144,11 @@ public partial class CustomizationDrawer
if (UiHelpers.DrawCheckbox("##apply", $"Apply the {_currentOption} customization in this design.", _currentApply, out _, _locked))
ToggleApply();
}
// Update the current Apply value.
private void ToggleApply()
{
_currentApply = !_currentApply;
ChangeApply = _currentApply ? ChangeApply | _currentFlag : ChangeApply & ~_currentFlag;
}
}