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:
commit
ac0ec0d66e
@ -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;
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user