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:
parent
b225b2eb39
commit
6819c528db
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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();
|
||||||
|
Loading…
Reference in New Issue
Block a user