mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 03:22:55 +08:00
Fix behavioural regression by splitting methods out
This commit is contained in:
parent
44fdb5b82e
commit
1760cc2427
@ -134,9 +134,31 @@ namespace osu.Game.Overlays
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ensures music is playing, no matter what, unless the user has explicitly paused.
|
||||||
|
/// This means that if the current beatmap has a virtual track (see <see cref="TrackVirtual"/>) a new beatmap will be selected.
|
||||||
|
/// </summary>
|
||||||
|
public void EnsurePlayingSomething()
|
||||||
|
{
|
||||||
|
if (IsUserPaused) return;
|
||||||
|
|
||||||
|
var track = current?.Track;
|
||||||
|
|
||||||
|
if (track == null || track is TrackVirtual)
|
||||||
|
{
|
||||||
|
if (beatmap.Disabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
else if (!IsPlaying)
|
||||||
|
{
|
||||||
|
Play();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start playing the current track (if not already playing).
|
/// Start playing the current track (if not already playing).
|
||||||
/// Will select the next valid track if the current track is null or <see cref="TrackVirtual"/>.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <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)
|
||||||
@ -145,14 +167,8 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
IsUserPaused = false;
|
IsUserPaused = false;
|
||||||
|
|
||||||
if (track == null || track is TrackVirtual)
|
if (track == null)
|
||||||
{
|
return false;
|
||||||
if (beatmap.Disabled)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
next();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (restart)
|
if (restart)
|
||||||
track.Restart();
|
track.Restart();
|
||||||
|
@ -260,8 +260,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
// we may have consumed our preloaded instance, so let's make another.
|
// we may have consumed our preloaded instance, so let's make another.
|
||||||
preloadSongSelect();
|
preloadSongSelect();
|
||||||
|
|
||||||
if (music?.IsUserPaused == false)
|
music.EnsurePlayingSomething();
|
||||||
music.Play();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool OnExiting(IScreen next)
|
public override bool OnExiting(IScreen next)
|
||||||
|
@ -126,8 +126,7 @@ namespace osu.Game.Screens.Multi.Lounge
|
|||||||
if (selectedRoom.Value?.RoomID.Value == null)
|
if (selectedRoom.Value?.RoomID.Value == null)
|
||||||
selectedRoom.Value = new Room();
|
selectedRoom.Value = new Room();
|
||||||
|
|
||||||
if (music?.IsUserPaused == false)
|
music.EnsurePlayingSomething();
|
||||||
music.Play();
|
|
||||||
|
|
||||||
onReturning();
|
onReturning();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user