1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 08:33:21 +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]
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();
}

View File

@ -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();