mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 23:23:04 +08:00
Add matching requestedByUser parameter to Play method
This commit is contained in:
parent
d2f6303988
commit
8f2cd0e8c5
@ -166,9 +166,16 @@ namespace osu.Game.Overlays
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start playing the current track (if not already playing).
|
/// Start playing the current track (if not already playing).
|
||||||
/// </summary>
|
/// </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>
|
/// <returns>Whether the operation was successful.</returns>
|
||||||
public bool Play(bool restart = false)
|
public bool Play(bool restart = false, bool requestedByUser = false)
|
||||||
{
|
{
|
||||||
|
if (requestedByUser)
|
||||||
IsUserPaused = false;
|
IsUserPaused = false;
|
||||||
|
|
||||||
if (restart)
|
if (restart)
|
||||||
@ -203,7 +210,7 @@ namespace osu.Game.Overlays
|
|||||||
if (CurrentTrack.IsRunning)
|
if (CurrentTrack.IsRunning)
|
||||||
Stop(true);
|
Stop(true);
|
||||||
else
|
else
|
||||||
Play();
|
Play(requestedByUser: true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -579,7 +579,8 @@ namespace osu.Game.Screens.Select
|
|||||||
updateComponentFromBeatmap(Beatmap.Value);
|
updateComponentFromBeatmap(Beatmap.Value);
|
||||||
|
|
||||||
// restart playback on returning to song select, regardless.
|
// 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);
|
this.FadeIn(250);
|
||||||
|
Loading…
Reference in New Issue
Block a user