mirror of
https://github.com/ppy/osu.git
synced 2025-01-30 01:32:55 +08:00
Select closest timing point every time the timing screen is changed to
No issue thread for this, was pointed out internally: https://discord.com/channels/90072389919997952/1259818301517725707/1316604605777444905 Due to the custom setup that editor has with its nested "screens-that-aren't-screens", the logic that selects the closest timing point to the current time would only fire on the first open of the screen. Seems like a good idea to have it fire every time instead.
This commit is contained in:
parent
e7070bd812
commit
5a2024777d
@ -15,6 +15,8 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
[Cached]
|
||||
public readonly Bindable<ControlPointGroup> SelectedGroup = new Bindable<ControlPointGroup>();
|
||||
|
||||
private readonly Bindable<EditorScreenMode> currentEditorMode = new Bindable<EditorScreenMode>();
|
||||
|
||||
[Resolved]
|
||||
private EditorClock? editorClock { get; set; }
|
||||
|
||||
@ -41,18 +43,35 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
}
|
||||
};
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(Editor? editor)
|
||||
{
|
||||
if (editor != null)
|
||||
currentEditorMode.BindTo(editor.Mode);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
if (editorClock != null)
|
||||
// When entering the timing screen, let's choose the closest valid timing point.
|
||||
// This will emulate the osu-stable behaviour where a metronome and timing information
|
||||
// are presented on entering the screen.
|
||||
currentEditorMode.BindValueChanged(mode =>
|
||||
{
|
||||
// When entering the timing screen, let's choose the 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);
|
||||
}
|
||||
if (mode.NewValue == EditorScreenMode.Timing)
|
||||
selectClosestTimingPoint();
|
||||
});
|
||||
selectClosestTimingPoint();
|
||||
}
|
||||
|
||||
private void selectClosestTimingPoint()
|
||||
{
|
||||
if (editorClock == null)
|
||||
return;
|
||||
|
||||
var nearestTimingPoint = EditorBeatmap.ControlPointInfo.TimingPointAt(editorClock.CurrentTime);
|
||||
SelectedGroup.Value = EditorBeatmap.ControlPointInfo.GroupAt(nearestTimingPoint.Time);
|
||||
}
|
||||
|
||||
protected override void ConfigureTimeline(TimelineArea timelineArea)
|
||||
|
Loading…
Reference in New Issue
Block a user