1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 20:13:21 +08:00

extendable minimum AR value for osu!std diff adjust mod, set to -10

This commit is contained in:
isakvik 2023-09-06 23:26:34 +02:00
parent 9b202b5f21
commit 3db0d0d341
2 changed files with 34 additions and 1 deletions

View File

@ -26,6 +26,7 @@ namespace osu.Game.Rulesets.Osu.Mods
Precision = 0.1f,
MinValue = 0,
MaxValue = 10,
ExtendedMinValue = -10,
ExtendedMaxValue = 11,
ReadCurrentFromDifficulty = diff => diff.ApproachRate,
};

View File

@ -34,9 +34,18 @@ namespace osu.Game.Rulesets.Mods
set => CurrentNumber.Precision = value;
}
private float minValue;
public float MinValue
{
set => CurrentNumber.MinValue = value;
set
{
if (value == minValue)
return;
minValue = value;
updateMinValue();
}
}
private float maxValue;
@ -53,6 +62,23 @@ namespace osu.Game.Rulesets.Mods
}
}
private float? extendedMinValue;
/// <summary>
/// The minimum value to be used when extended limits are applied.
/// </summary>
public float? ExtendedMinValue
{
set
{
if (value == extendedMinValue)
return;
extendedMinValue = value;
updateMinValue();
}
}
private float? extendedMaxValue;
/// <summary>
@ -78,6 +104,7 @@ namespace osu.Game.Rulesets.Mods
public DifficultyBindable(float? defaultValue = null)
: base(defaultValue)
{
ExtendedLimits.BindValueChanged(_ => updateMinValue());
ExtendedLimits.BindValueChanged(_ => updateMaxValue());
}
@ -94,6 +121,11 @@ namespace osu.Game.Rulesets.Mods
}
}
private void updateMinValue()
{
CurrentNumber.MinValue = ExtendedLimits.Value && extendedMinValue != null ? extendedMinValue.Value : minValue;
}
private void updateMaxValue()
{
CurrentNumber.MaxValue = ExtendedLimits.Value && extendedMaxValue != null ? extendedMaxValue.Value : maxValue;