mirror of
https://github.com/ppy/osu.git
synced 2025-01-19 10:12:53 +08:00
Create ReplayPlayerLoader for local mod caching
This commit is contained in:
parent
2432878614
commit
2747d7692b
@ -284,9 +284,8 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
Ruleset.Value = databasedScoreInfo.Ruleset;
|
Ruleset.Value = databasedScoreInfo.Ruleset;
|
||||||
Beatmap.Value = BeatmapManager.GetWorkingBeatmap(databasedBeatmap);
|
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);
|
}, $"watch {databasedScoreInfo}", bypassScreenAllowChecks: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
32
osu.Game/Screens/Play/ReplayPlayerLoader.cs
Normal file
32
osu.Game/Screens/Play/ReplayPlayerLoader.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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<Mod> mods;
|
||||||
|
|
||||||
|
public ReplayPlayerLoader(Func<Player> player, IReadOnlyList<Mod> mods)
|
||||||
|
: base(player)
|
||||||
|
{
|
||||||
|
this.mods = mods;
|
||||||
|
}
|
||||||
|
|
||||||
|
private DependencyContainer dependencies;
|
||||||
|
|
||||||
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
|
{
|
||||||
|
dependencies = new DependencyContainer(parent);
|
||||||
|
dependencies.Cache(new Bindable<IReadOnlyList<Mod>>(mods));
|
||||||
|
|
||||||
|
return base.CreateChildDependencies(dependencies);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user