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

Automatically select the closest timing point on entering the timing screen

This commit is contained in:
Dean Herbert 2023-02-10 17:44:05 +09:00
parent 03e623d1d2
commit 6d876fdb9a

View File

@ -14,6 +14,9 @@ namespace osu.Game.Screens.Edit.Timing
[Cached]
public readonly Bindable<ControlPointGroup> SelectedGroup = new Bindable<ControlPointGroup>();
[Resolved]
private EditorClock? editorClock { get; set; }
public TimingScreen()
: base(EditorScreenMode.Timing)
{
@ -36,5 +39,19 @@ namespace osu.Game.Screens.Edit.Timing
},
}
};
protected override void LoadComplete()
{
base.LoadComplete();
if (editorClock != null)
{
// When entering the timing screen, let's choose to closest valid timing point.
// This will emulate the osu-stable behaviour where a metronome and timing information
// are presented on entering the screen.
var nearestTimingPoint = EditorBeatmap.ControlPointInfo.TimingPointAt(editorClock.CurrentTime);
SelectedGroup.Value = EditorBeatmap.ControlPointInfo.GroupAt(nearestTimingPoint.Time);
}
}
}
}