1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 04:02:59 +08:00

Add editor track traversal keys (Z-V)

This commit is contained in:
Dean Herbert 2022-05-14 02:50:51 +09:00
parent 8edbc10155
commit c4871ebcf4

View File

@ -33,6 +33,7 @@ using osu.Game.Overlays.Notifications;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Screens.Edit.Components;
using osu.Game.Screens.Edit.Components.Menus;
using osu.Game.Screens.Edit.Components.Timelines.Summary;
@ -475,6 +476,44 @@ namespace osu.Game.Screens.Edit
case Key.Right:
seek(e, 1);
return true;
// Track traversal keys.
// Matching osu-stable implementations.
case Key.Z:
// Seek to first object time, or track start if already there.
double? firstObjectTime = editorBeatmap.HitObjects.FirstOrDefault()?.StartTime;
if (firstObjectTime == null || clock.CurrentTime == firstObjectTime)
clock.Seek(0);
else
clock.Seek(firstObjectTime.Value);
return true;
case Key.X:
// Restart playback from beginning of track.
clock.Seek(0);
clock.Start();
return true;
case Key.C:
// Pause or resume.
if (clock.IsRunning)
clock.Stop();
else
clock.Start();
return true;
case Key.V:
// Seek to last object time, or track end if already there.
// Note that in osu-stable subsequent presses when at track end won't return to last object.
// This has intentionally been changed to make it more useful.
double? lastObjectTime = editorBeatmap.HitObjects.LastOrDefault()?.GetEndTime();
if (lastObjectTime == null || clock.CurrentTime == lastObjectTime)
clock.Seek(clock.TrackLength);
else
clock.Seek(lastObjectTime.Value);
return true;
}
return base.OnKeyDown(e);