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

Internalize both looping and stopping

This commit is contained in:
voidedWarranties 2020-03-13 16:42:05 -07:00
parent 1d314a1f4b
commit 7e4f58c2d3
2 changed files with 8 additions and 9 deletions

View File

@ -87,9 +87,6 @@ namespace osu.Game.Screens.Edit.Components
private void togglePause() private void togglePause()
{ {
if ((adjustableClock as EditorClock)?.PlaybackFinished == true)
adjustableClock.Seek(0);
if (adjustableClock.IsRunning) if (adjustableClock.IsRunning)
adjustableClock.Stop(); adjustableClock.Stop();
else else

View File

@ -21,7 +21,7 @@ namespace osu.Game.Screens.Edit
private readonly BindableBeatDivisor beatDivisor; private readonly BindableBeatDivisor beatDivisor;
public bool PlaybackFinished { get; private set; } private bool playbackFinished;
public EditorClock(WorkingBeatmap beatmap, BindableBeatDivisor beatDivisor) public EditorClock(WorkingBeatmap beatmap, BindableBeatDivisor beatDivisor)
{ {
@ -43,17 +43,19 @@ namespace osu.Game.Screens.Edit
{ {
base.ProcessFrame(); base.ProcessFrame();
if (CurrentTime >= TrackLength) var playbackAlreadyStopped = playbackFinished;
playbackFinished = CurrentTime >= TrackLength;
if (playbackFinished && IsRunning)
{ {
if (!PlaybackFinished) if (!playbackAlreadyStopped)
{ {
PlaybackFinished = true;
Stop(); Stop();
Seek(TrackLength); Seek(TrackLength);
} }
else
Seek(0);
} }
else
PlaybackFinished = false;
} }
/// <summary> /// <summary>