mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 18:27:24 +01:00
Allow custom values for percentages and lists.
This commit is contained in:
parent
4e021d016e
commit
45a8cbcf89
3 changed files with 18 additions and 9 deletions
|
|
@ -47,7 +47,6 @@ public sealed class Design : DesignBase, ISavable
|
|||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Serialization
|
||||
|
||||
public new JObject JsonSerialize()
|
||||
|
|
|
|||
|
|
@ -45,8 +45,15 @@ public partial class CustomizationDrawer
|
|||
var tmp = (int)_currentByte.Value;
|
||||
ImGui.SetNextItemWidth(_inputIntSize);
|
||||
if (ImGui.InputInt("##text", ref tmp, 1, 1))
|
||||
UpdateValue((CustomizeValue)Math.Clamp(tmp, 0, _currentCount - 1));
|
||||
ImGuiUtil.HoverTooltip($"Input Range: [0, {_currentCount - 1}]");
|
||||
{
|
||||
var newValue = (CustomizeValue)(ImGui.GetIO().KeyCtrl
|
||||
? Math.Clamp(tmp, 0, byte.MaxValue)
|
||||
: Math.Clamp(tmp, 0, _currentCount - 1));
|
||||
UpdateValue(newValue);
|
||||
}
|
||||
|
||||
ImGuiUtil.HoverTooltip($"Input Range: [0, {_currentCount - 1}]\n"
|
||||
+ "Hold Control to force updates with invalid/unknown options at your own risk.");
|
||||
}
|
||||
|
||||
// Integral input for an icon- or color based item.
|
||||
|
|
@ -120,9 +127,15 @@ public partial class CustomizationDrawer
|
|||
{
|
||||
var tmp = _currentByte.Value + 1;
|
||||
ImGui.SetNextItemWidth(_inputIntSize);
|
||||
if (ImGui.InputInt("##text", ref tmp, 1, 1) && tmp > 0 && tmp <= _currentCount)
|
||||
UpdateValue((CustomizeValue)Math.Clamp(tmp - 1, 0, _currentCount - 1));
|
||||
ImGuiUtil.HoverTooltip($"Input Range: [1, {_currentCount}]");
|
||||
if (ImGui.InputInt("##text", ref tmp, 1, 1))
|
||||
{
|
||||
var newValue = (CustomizeValue)(ImGui.GetIO().KeyCtrl
|
||||
? Math.Clamp(tmp - 1, 0, byte.MaxValue)
|
||||
: Math.Clamp(tmp - 1, 0, _currentCount - 1));
|
||||
UpdateValue(newValue);
|
||||
}
|
||||
ImGuiUtil.HoverTooltip($"Input Range: [1, {_currentCount}]\n"
|
||||
+ "Hold Control to force updates with invalid/unknown options at your own risk.");
|
||||
}
|
||||
|
||||
// Draw a customize checkbox.
|
||||
|
|
|
|||
|
|
@ -33,9 +33,6 @@ public partial class CustomizationDrawer : IDisposable
|
|||
public CustomizeFlag Changed { get; private set; }
|
||||
public CustomizeFlag ChangeApply { get; private set; }
|
||||
|
||||
public bool RequiresRedraw
|
||||
=> Changed.RequiresRedraw();
|
||||
|
||||
private CustomizeFlag _initialApply;
|
||||
private bool _locked = false;
|
||||
private bool _lockedRedraw = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue