mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 00:02:54 +08:00
Prevent playback from going beyond song end
This commit is contained in:
parent
cb0e698e04
commit
1d314a1f4b
@ -87,6 +87,9 @@ namespace osu.Game.Screens.Edit.Components
|
||||
|
||||
private void togglePause()
|
||||
{
|
||||
if ((adjustableClock as EditorClock)?.PlaybackFinished == true)
|
||||
adjustableClock.Seek(0);
|
||||
|
||||
if (adjustableClock.IsRunning)
|
||||
adjustableClock.Stop();
|
||||
else
|
||||
|
@ -21,6 +21,8 @@ namespace osu.Game.Screens.Edit
|
||||
|
||||
private readonly BindableBeatDivisor beatDivisor;
|
||||
|
||||
public bool PlaybackFinished { get; private set; }
|
||||
|
||||
public EditorClock(WorkingBeatmap beatmap, BindableBeatDivisor beatDivisor)
|
||||
{
|
||||
this.beatDivisor = beatDivisor;
|
||||
@ -37,6 +39,23 @@ namespace osu.Game.Screens.Edit
|
||||
TrackLength = trackLength;
|
||||
}
|
||||
|
||||
public override void ProcessFrame()
|
||||
{
|
||||
base.ProcessFrame();
|
||||
|
||||
if (CurrentTime >= TrackLength)
|
||||
{
|
||||
if (!PlaybackFinished)
|
||||
{
|
||||
PlaybackFinished = true;
|
||||
Stop();
|
||||
Seek(TrackLength);
|
||||
}
|
||||
}
|
||||
else
|
||||
PlaybackFinished = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Seek to the closest snappable beat from a time.
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user