diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 0a472d4dc1..ab7efc6e38 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -284,9 +284,8 @@ public void PresentScore(ScoreInfo score) { Ruleset.Value = databasedScoreInfo.Ruleset; Beatmap.Value = BeatmapManager.GetWorkingBeatmap(databasedBeatmap); - Mods.Value = databasedScoreInfo.Mods; - menuScreen.Push(new PlayerLoader(() => new ReplayPlayer(databasedScore))); + menuScreen.Push(new ReplayPlayerLoader(() => new ReplayPlayer(databasedScore), databasedScoreInfo.Mods)); }, $"watch {databasedScoreInfo}", bypassScreenAllowChecks: true); } diff --git a/osu.Game/Screens/Play/ReplayPlayerLoader.cs b/osu.Game/Screens/Play/ReplayPlayerLoader.cs new file mode 100644 index 0000000000..1c24709e41 --- /dev/null +++ b/osu.Game/Screens/Play/ReplayPlayerLoader.cs @@ -0,0 +1,32 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Game.Rulesets.Mods; + +namespace osu.Game.Screens.Play +{ + public class ReplayPlayerLoader : PlayerLoader + { + private readonly IReadOnlyList mods; + + public ReplayPlayerLoader(Func player, IReadOnlyList mods) + : base(player) + { + this.mods = mods; + } + + private DependencyContainer dependencies; + + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) + { + dependencies = new DependencyContainer(parent); + dependencies.Cache(new Bindable>(mods)); + + return base.CreateChildDependencies(dependencies); + } + } +}