mirror of
https://github.com/ppy/osu
synced 2025-02-16 18:17:01 +00:00
Fix incorrect DifficultyBindable
logic
This commit is contained in:
parent
ae38e66036
commit
6813f5ee0a
@ -38,6 +38,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
|
|
||||||
public float MinValue
|
public float MinValue
|
||||||
{
|
{
|
||||||
|
get => minValue;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == minValue)
|
if (value == minValue)
|
||||||
@ -52,6 +53,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
|
|
||||||
public float MaxValue
|
public float MaxValue
|
||||||
{
|
{
|
||||||
|
get => maxValue;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == maxValue)
|
if (value == maxValue)
|
||||||
@ -69,6 +71,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public float? ExtendedMinValue
|
public float? ExtendedMinValue
|
||||||
{
|
{
|
||||||
|
get => extendedMinValue;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == extendedMinValue)
|
if (value == extendedMinValue)
|
||||||
@ -86,6 +89,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public float? ExtendedMaxValue
|
public float? ExtendedMaxValue
|
||||||
{
|
{
|
||||||
|
get => extendedMaxValue;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == extendedMaxValue)
|
if (value == extendedMaxValue)
|
||||||
@ -114,9 +118,14 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
{
|
{
|
||||||
// Ensure that in the case serialisation runs in the wrong order (and limit extensions aren't applied yet) the deserialised value is still propagated.
|
// Ensure that in the case serialisation runs in the wrong order (and limit extensions aren't applied yet) the deserialised value is still propagated.
|
||||||
if (value != null)
|
if (value != null)
|
||||||
CurrentNumber.MaxValue = MathF.Max(CurrentNumber.MaxValue, value.Value);
|
{
|
||||||
|
CurrentNumber.MinValue = Math.Clamp(MathF.Min(CurrentNumber.MinValue, value.Value), ExtendedMinValue ?? MinValue, MinValue);
|
||||||
|
CurrentNumber.MaxValue = Math.Clamp(MathF.Max(CurrentNumber.MaxValue, value.Value), MaxValue, ExtendedMaxValue ?? MaxValue);
|
||||||
|
|
||||||
base.Value = value;
|
base.Value = Math.Clamp(value.Value, CurrentNumber.MinValue, CurrentNumber.MaxValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
base.Value = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,6 +147,8 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
// the following max value copies are only safe as long as these values are effectively constants.
|
// the following max value copies are only safe as long as these values are effectively constants.
|
||||||
otherDifficultyBindable.MaxValue = maxValue;
|
otherDifficultyBindable.MaxValue = maxValue;
|
||||||
otherDifficultyBindable.ExtendedMaxValue = extendedMaxValue;
|
otherDifficultyBindable.ExtendedMaxValue = extendedMaxValue;
|
||||||
|
otherDifficultyBindable.MinValue = minValue;
|
||||||
|
otherDifficultyBindable.ExtendedMinValue = extendedMinValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void BindTo(Bindable<float?> them)
|
public override void BindTo(Bindable<float?> them)
|
||||||
|
Loading…
Reference in New Issue
Block a user