mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:12:54 +08:00
Use canBeNull instead of needlessly caching MusicController for tests
This commit is contained in:
parent
b225b2eb39
commit
6819c528db
@ -42,8 +42,8 @@ namespace osu.Game.Screens.Menu
|
||||
[Resolved]
|
||||
private GameHost host { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private MusicController musicController { get; set; }
|
||||
[Resolved(canBeNull: true)]
|
||||
private MusicController music { get; set; }
|
||||
|
||||
private BackgroundScreenDefault background;
|
||||
|
||||
@ -193,7 +193,7 @@ namespace osu.Game.Screens.Menu
|
||||
//we may have consumed our preloaded instance, so let's make another.
|
||||
preloadSongSelect();
|
||||
|
||||
if (Beatmap.Value.Track != null && !musicController.IsUserPaused)
|
||||
if (Beatmap.Value.Track != null && music?.IsUserPaused != true)
|
||||
Beatmap.Value.Track.Start();
|
||||
}
|
||||
|
||||
|
@ -87,8 +87,8 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private readonly Bindable<RulesetInfo> decoupledRuleset = new Bindable<RulesetInfo>();
|
||||
|
||||
[Resolved]
|
||||
private MusicController musicController { get; set; }
|
||||
[Resolved(canBeNull: true)]
|
||||
private MusicController music { get; set; }
|
||||
|
||||
[Cached]
|
||||
[Cached(Type = typeof(IBindable<IReadOnlyList<Mod>>))]
|
||||
@ -573,7 +573,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
Track track = Beatmap.Value.Track;
|
||||
|
||||
if ((!track.IsRunning || restart) && !musicController.IsUserPaused)
|
||||
if ((!track.IsRunning || restart) && music?.IsUserPaused != true)
|
||||
{
|
||||
track.RestartPoint = Beatmap.Value.Metadata.PreviewTime;
|
||||
track.Restart();
|
||||
|
Loading…
Reference in New Issue
Block a user