1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 14:17:26 +08:00

Read initial beat divisor value from the beatmap (#6765)

Read initial beat divisor value from the beatmap
This commit is contained in:
Dean Herbert 2019-11-08 19:06:25 +09:00 committed by GitHub
commit ac0ec0d66e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 4 deletions

View File

@ -29,7 +29,10 @@ namespace osu.Game.Screens.Edit
set
{
if (!VALID_DIVISORS.Contains(value))
throw new ArgumentOutOfRangeException($"Provided divisor is not in {nameof(VALID_DIVISORS)}");
{
// If it doesn't match, value will be 0, but will be clamped to the valid range via DefaultMinValue
value = Array.FindLast(VALID_DIVISORS, d => d < value);
}
base.Value = value;
}

View File

@ -218,12 +218,17 @@ namespace osu.Game.Screens.Edit.Compose.Components
}
AddInternal(marker = new Marker());
}
CurrentNumber.ValueChanged += div =>
protected override void LoadComplete()
{
base.LoadComplete();
CurrentNumber.BindValueChanged(div =>
{
marker.MoveToX(getMappedPosition(div.NewValue), 100, Easing.OutQuint);
marker.Flash();
};
}, true);
}
protected override void UpdateValue(float value)

View File

@ -64,7 +64,10 @@ namespace osu.Game.Screens.Edit
{
this.host = host;
// TODO: should probably be done at a DrawableRuleset level to share logic with Player.
beatDivisor.Value = Beatmap.Value.BeatmapInfo.BeatDivisor;
beatDivisor.BindValueChanged(divisor => Beatmap.Value.BeatmapInfo.BeatDivisor = divisor.NewValue);
// Todo: should probably be done at a DrawableRuleset level to share logic with Player.
var sourceClock = (IAdjustableClock)Beatmap.Value.Track ?? new StopwatchClock();
clock = new EditorClock(Beatmap.Value, beatDivisor) { IsCoupled = false };
clock.ChangeSource(sourceClock);