mirror of
https://github.com/ppy/osu.git
synced 2025-03-05 07:02:55 +08:00
Automatically select the closest timing point on entering the timing screen
This commit is contained in:
parent
03e623d1d2
commit
6d876fdb9a
@ -14,6 +14,9 @@ namespace osu.Game.Screens.Edit.Timing
|
|||||||
[Cached]
|
[Cached]
|
||||||
public readonly Bindable<ControlPointGroup> SelectedGroup = new Bindable<ControlPointGroup>();
|
public readonly Bindable<ControlPointGroup> SelectedGroup = new Bindable<ControlPointGroup>();
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private EditorClock? editorClock { get; set; }
|
||||||
|
|
||||||
public TimingScreen()
|
public TimingScreen()
|
||||||
: base(EditorScreenMode.Timing)
|
: 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user