mirror of https://github.com/ppy/osu
Add matching requestedByUser parameter to Play method
This commit is contained in:
parent
d2f6303988
commit
8f2cd0e8c5
|
@ -166,10 +166,17 @@ public void EnsurePlayingSomething()
|
|||
/// <summary>
|
||||
/// Start playing the current track (if not already playing).
|
||||
/// </summary>
|
||||
/// <param name="restart">Whether to restart the track from the beginning.</param>
|
||||
/// <param name="requestedByUser">
|
||||
/// Whether the request to play was issued by the user rather than internally.
|
||||
/// Specifying <c>true</c> will ensure that other methods like <see cref="EnsurePlayingSomething"/>
|
||||
/// will resume music playback going forward.
|
||||
/// </param>
|
||||
/// <returns>Whether the operation was successful.</returns>
|
||||
public bool Play(bool restart = false)
|
||||
public bool Play(bool restart = false, bool requestedByUser = false)
|
||||
{
|
||||
IsUserPaused = false;
|
||||
if (requestedByUser)
|
||||
IsUserPaused = false;
|
||||
|
||||
if (restart)
|
||||
CurrentTrack.Restart();
|
||||
|
@ -203,7 +210,7 @@ public bool TogglePause()
|
|||
if (CurrentTrack.IsRunning)
|
||||
Stop(true);
|
||||
else
|
||||
Play();
|
||||
Play(requestedByUser: true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -579,7 +579,8 @@ public override void OnResuming(IScreen last)
|
|||
updateComponentFromBeatmap(Beatmap.Value);
|
||||
|
||||
// restart playback on returning to song select, regardless.
|
||||
music.Play();
|
||||
// not sure this should be a permanent thing (we may want to leave a user pause paused even on returning)
|
||||
music.Play(requestedByUser: true);
|
||||
}
|
||||
|
||||
this.FadeIn(250);
|
||||
|
|
Loading…
Reference in New Issue