1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 12:33:01 +08:00

Use canBeNull instead of needlessly caching MusicController for tests

This commit is contained in:
Dean Herbert 2019-07-11 00:20:01 +09:00
parent b225b2eb39
commit 6819c528db
2 changed files with 6 additions and 6 deletions

View File

@ -42,8 +42,8 @@ namespace osu.Game.Screens.Menu
[Resolved] [Resolved]
private GameHost host { get; set; } private GameHost host { get; set; }
[Resolved] [Resolved(canBeNull: true)]
private MusicController musicController { get; set; } private MusicController music { get; set; }
private BackgroundScreenDefault background; private BackgroundScreenDefault background;
@ -193,7 +193,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 (Beatmap.Value.Track != null && !musicController.IsUserPaused) if (Beatmap.Value.Track != null && music?.IsUserPaused != true)
Beatmap.Value.Track.Start(); Beatmap.Value.Track.Start();
} }

View File

@ -87,8 +87,8 @@ namespace osu.Game.Screens.Select
private readonly Bindable<RulesetInfo> decoupledRuleset = new Bindable<RulesetInfo>(); private readonly Bindable<RulesetInfo> decoupledRuleset = new Bindable<RulesetInfo>();
[Resolved] [Resolved(canBeNull: true)]
private MusicController musicController { get; set; } private MusicController music { get; set; }
[Cached] [Cached]
[Cached(Type = typeof(IBindable<IReadOnlyList<Mod>>))] [Cached(Type = typeof(IBindable<IReadOnlyList<Mod>>))]
@ -573,7 +573,7 @@ namespace osu.Game.Screens.Select
{ {
Track track = Beatmap.Value.Track; 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.RestartPoint = Beatmap.Value.Metadata.PreviewTime;
track.Restart(); track.Restart();