mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 15:12:57 +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()
|
private void togglePause()
|
||||||
{
|
{
|
||||||
|
if ((adjustableClock as EditorClock)?.PlaybackFinished == true)
|
||||||
|
adjustableClock.Seek(0);
|
||||||
|
|
||||||
if (adjustableClock.IsRunning)
|
if (adjustableClock.IsRunning)
|
||||||
adjustableClock.Stop();
|
adjustableClock.Stop();
|
||||||
else
|
else
|
||||||
|
@ -21,6 +21,8 @@ namespace osu.Game.Screens.Edit
|
|||||||
|
|
||||||
private readonly BindableBeatDivisor beatDivisor;
|
private readonly BindableBeatDivisor beatDivisor;
|
||||||
|
|
||||||
|
public bool PlaybackFinished { get; private set; }
|
||||||
|
|
||||||
public EditorClock(WorkingBeatmap beatmap, BindableBeatDivisor beatDivisor)
|
public EditorClock(WorkingBeatmap beatmap, BindableBeatDivisor beatDivisor)
|
||||||
{
|
{
|
||||||
this.beatDivisor = beatDivisor;
|
this.beatDivisor = beatDivisor;
|
||||||
@ -37,6 +39,23 @@ namespace osu.Game.Screens.Edit
|
|||||||
TrackLength = trackLength;
|
TrackLength = trackLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void ProcessFrame()
|
||||||
|
{
|
||||||
|
base.ProcessFrame();
|
||||||
|
|
||||||
|
if (CurrentTime >= TrackLength)
|
||||||
|
{
|
||||||
|
if (!PlaybackFinished)
|
||||||
|
{
|
||||||
|
PlaybackFinished = true;
|
||||||
|
Stop();
|
||||||
|
Seek(TrackLength);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
PlaybackFinished = false;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Seek to the closest snappable beat from a time.
|
/// Seek to the closest snappable beat from a time.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user