mirror of
https://github.com/osukey/osukey.git
synced 2025-05-18 12:07:37 +09:00
Make prev button can do restart track
This commit is contained in:
parent
c708ea327d
commit
d7fc904381
@ -136,11 +136,20 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Play the previous track.
|
/// Play the previous track or restart the current track if it's current time below 5000ms
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Whether the operation was successful.</returns>
|
/// <returns>Whether the operation was successful.</returns>
|
||||||
public bool PrevTrack()
|
public bool PrevTrack()
|
||||||
{
|
{
|
||||||
|
var currentTrackPosition = current?.Track.CurrentTime;
|
||||||
|
|
||||||
|
if (currentTrackPosition >= 5000)
|
||||||
|
{
|
||||||
|
SeekTo(0);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
queuedDirection = TrackChangeDirection.Prev;
|
queuedDirection = TrackChangeDirection.Prev;
|
||||||
|
|
||||||
var playable = BeatmapSets.TakeWhile(i => i.ID != current.BeatmapSetInfo.ID).LastOrDefault() ?? BeatmapSets.LastOrDefault();
|
var playable = BeatmapSets.TakeWhile(i => i.ID != current.BeatmapSetInfo.ID).LastOrDefault() ?? BeatmapSets.LastOrDefault();
|
||||||
@ -260,8 +269,9 @@ namespace osu.Game.Overlays
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case GlobalAction.MusicPrev:
|
case GlobalAction.MusicPrev:
|
||||||
|
var shouldRestart = current?.Track.CurrentTime >= 5000;
|
||||||
if (PrevTrack())
|
if (PrevTrack())
|
||||||
onScreenDisplay?.Display(new MusicControllerToast("Previous track"));
|
onScreenDisplay?.Display(new MusicControllerToast(shouldRestart ? "Restart track" : "Previous track"));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user