1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-19 14:23:14 +08:00

Merge pull request #10657 from smoogipoo/rename-isuserpaused

Rename IsUserPaused -> UserPauseRequested
This commit is contained in:
Dean Herbert 2020-11-02 16:46:43 +09:00 committed by GitHub
commit 1ab609fa2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 7 deletions

View File

@ -22,9 +22,9 @@ namespace osu.Game.Tests.Visual.Menus
{ {
AddStep("ensure playing something", () => Game.MusicController.EnsurePlayingSomething()); AddStep("ensure playing something", () => Game.MusicController.EnsurePlayingSomething());
AddStep("toggle playback", () => globalActionContainer.TriggerPressed(GlobalAction.MusicPlay)); AddStep("toggle playback", () => globalActionContainer.TriggerPressed(GlobalAction.MusicPlay));
AddAssert("music paused", () => !Game.MusicController.IsPlaying && Game.MusicController.IsUserPaused); AddAssert("music paused", () => !Game.MusicController.IsPlaying && Game.MusicController.UserPauseRequested);
AddStep("toggle playback", () => globalActionContainer.TriggerPressed(GlobalAction.MusicPlay)); AddStep("toggle playback", () => globalActionContainer.TriggerPressed(GlobalAction.MusicPlay));
AddAssert("music resumed", () => Game.MusicController.IsPlaying && !Game.MusicController.IsUserPaused); AddAssert("music resumed", () => Game.MusicController.IsPlaying && !Game.MusicController.UserPauseRequested);
} }
[Test] [Test]

View File

@ -45,7 +45,10 @@ namespace osu.Game.Overlays
private readonly BindableList<BeatmapSetInfo> beatmapSets = new BindableList<BeatmapSetInfo>(); private readonly BindableList<BeatmapSetInfo> beatmapSets = new BindableList<BeatmapSetInfo>();
public bool IsUserPaused { get; private set; } /// <summary>
/// Whether the user has requested the track to be paused. Use <see cref="IsPlaying"/> to determine whether the track is still playing.
/// </summary>
public bool UserPauseRequested { get; private set; }
/// <summary> /// <summary>
/// Fired when the global <see cref="WorkingBeatmap"/> has changed. /// Fired when the global <see cref="WorkingBeatmap"/> has changed.
@ -148,7 +151,7 @@ namespace osu.Game.Overlays
/// </summary> /// </summary>
public void EnsurePlayingSomething() public void EnsurePlayingSomething()
{ {
if (IsUserPaused) return; if (UserPauseRequested) return;
if (CurrentTrack.IsDummyDevice || beatmap.Value.BeatmapSetInfo.DeletePending) if (CurrentTrack.IsDummyDevice || beatmap.Value.BeatmapSetInfo.DeletePending)
{ {
@ -176,7 +179,7 @@ namespace osu.Game.Overlays
public bool Play(bool restart = false, bool requestedByUser = false) public bool Play(bool restart = false, bool requestedByUser = false)
{ {
if (requestedByUser) if (requestedByUser)
IsUserPaused = false; UserPauseRequested = false;
if (restart) if (restart)
CurrentTrack.Restart(); CurrentTrack.Restart();
@ -196,7 +199,7 @@ namespace osu.Game.Overlays
/// </param> /// </param>
public void Stop(bool requestedByUser = false) public void Stop(bool requestedByUser = false)
{ {
IsUserPaused |= requestedByUser; UserPauseRequested |= requestedByUser;
if (CurrentTrack.IsRunning) if (CurrentTrack.IsRunning)
CurrentTrack.Stop(); CurrentTrack.Stop();
} }

View File

@ -682,7 +682,7 @@ namespace osu.Game.Screens.Select
track.RestartPoint = Beatmap.Value.Metadata.PreviewTime; track.RestartPoint = Beatmap.Value.Metadata.PreviewTime;
if (!track.IsRunning && (music.IsUserPaused != true || isNewTrack)) if (!track.IsRunning && (music.UserPauseRequested != true || isNewTrack))
music.Play(true); music.Play(true);
lastTrack.SetTarget(track); lastTrack.SetTarget(track);