mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Fix user pause not being cancelled when playing audio
This commit is contained in:
@ -98,20 +98,13 @@ namespace osu.Game.Overlays
|
||||
/// <summary>
|
||||
/// Start playing the current track (if not already playing).
|
||||
/// </summary>
|
||||
public void Play()
|
||||
{
|
||||
if (!IsPlaying)
|
||||
TogglePause();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Toggle pause / play.
|
||||
/// </summary>
|
||||
/// <returns>Whether the operation was successful.</returns>
|
||||
public bool TogglePause()
|
||||
public bool Play(bool restart = false)
|
||||
{
|
||||
var track = current?.Track;
|
||||
|
||||
IsUserPaused = false;
|
||||
|
||||
if (track == null)
|
||||
{
|
||||
if (beatmap.Disabled)
|
||||
@ -121,16 +114,40 @@ namespace osu.Game.Overlays
|
||||
return true;
|
||||
}
|
||||
|
||||
if (restart)
|
||||
track.Restart();
|
||||
else if (!IsPlaying)
|
||||
track.Start();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stop playing the current track and pause at the current position.
|
||||
/// </summary>
|
||||
public void Stop()
|
||||
{
|
||||
var track = current?.Track;
|
||||
|
||||
if (track.IsRunning)
|
||||
{
|
||||
IsUserPaused = true;
|
||||
track.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Toggle pause / play.
|
||||
/// </summary>
|
||||
/// <returns>Whether the operation was successful.</returns>
|
||||
public bool TogglePause()
|
||||
{
|
||||
var track = current?.Track;
|
||||
|
||||
if (track?.IsRunning == true)
|
||||
Stop();
|
||||
else
|
||||
{
|
||||
track.Start();
|
||||
IsUserPaused = false;
|
||||
}
|
||||
Play();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user