1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 11:52:54 +08:00

Adjust initial and final rate ranges and prevent them from overlapping

This commit is contained in:
Ronnie Moir 2021-02-23 15:38:09 +00:00
parent 66f86bdee5
commit f45cedeb85
2 changed files with 22 additions and 4 deletions

View File

@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Mods
[SettingSource("Initial rate", "The starting speed of the track")] [SettingSource("Initial rate", "The starting speed of the track")]
public override BindableNumber<double> InitialRate { get; } = new BindableDouble public override BindableNumber<double> InitialRate { get; } = new BindableDouble
{ {
MinValue = 1, MinValue = 0.5,
MaxValue = 2, MaxValue = 2,
Default = 1, Default = 1,
Value = 1, Value = 1,
@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Mods
public override BindableNumber<double> FinalRate { get; } = new BindableDouble public override BindableNumber<double> FinalRate { get; } = new BindableDouble
{ {
MinValue = 0.5, MinValue = 0.5,
MaxValue = 0.99, MaxValue = 2,
Default = 0.75, Default = 0.75,
Value = 0.75, Value = 0.75,
Precision = 0.01, Precision = 0.01,
@ -45,5 +45,14 @@ namespace osu.Game.Rulesets.Mods
}; };
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModWindUp)).ToArray(); public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModWindUp)).ToArray();
public ModWindDown()
{
InitialRate.BindValueChanged(val =>
InitialRate.Value = Math.Max(val.NewValue, FinalRate.Value + 0.01));
FinalRate.BindValueChanged(val =>
FinalRate.Value = Math.Min(val.NewValue, InitialRate.Value - 0.01));
}
} }
} }

View File

@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Mods
public override BindableNumber<double> InitialRate { get; } = new BindableDouble public override BindableNumber<double> InitialRate { get; } = new BindableDouble
{ {
MinValue = 0.5, MinValue = 0.5,
MaxValue = 1, MaxValue = 2,
Default = 1, Default = 1,
Value = 1, Value = 1,
Precision = 0.01, Precision = 0.01,
@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Mods
[SettingSource("Final rate", "The speed increase to ramp towards")] [SettingSource("Final rate", "The speed increase to ramp towards")]
public override BindableNumber<double> FinalRate { get; } = new BindableDouble public override BindableNumber<double> FinalRate { get; } = new BindableDouble
{ {
MinValue = 1.01, MinValue = 0.5,
MaxValue = 2, MaxValue = 2,
Default = 1.5, Default = 1.5,
Value = 1.5, Value = 1.5,
@ -45,5 +45,14 @@ namespace osu.Game.Rulesets.Mods
}; };
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModWindDown)).ToArray(); public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModWindDown)).ToArray();
public ModWindUp()
{
InitialRate.BindValueChanged(val =>
InitialRate.Value = Math.Min(val.NewValue, FinalRate.Value - 0.01));
FinalRate.BindValueChanged(val =>
FinalRate.Value = Math.Max(val.NewValue, InitialRate.Value + 0.01));
}
} }
} }