Add matching requestedByUser parameter to Play method

This commit is contained in:
Dean Herbert 2020-11-02 15:01:30 +09:00
parent d2f6303988
commit 8f2cd0e8c5
2 changed files with 12 additions and 4 deletions

View File

@ -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;
}

View File

@ -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);