2019-07-08 05:55:05 +00:00
|
|
|
// 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.Collections.Generic;
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Bindables;
|
|
|
|
using osu.Game.Rulesets.Mods;
|
2019-07-08 06:40:10 +00:00
|
|
|
using osu.Game.Scoring;
|
2019-07-08 05:55:05 +00:00
|
|
|
|
|
|
|
namespace osu.Game.Screens.Play
|
|
|
|
{
|
|
|
|
public class ReplayPlayerLoader : PlayerLoader
|
|
|
|
{
|
2019-07-08 06:40:10 +00:00
|
|
|
private readonly Bindable<IReadOnlyList<Mod>> mods;
|
2019-07-08 05:55:05 +00:00
|
|
|
|
2019-07-08 06:40:10 +00:00
|
|
|
public ReplayPlayerLoader(Score score, IReadOnlyList<Mod> mods)
|
|
|
|
: base(() => new ReplayPlayer(score))
|
2019-07-08 05:55:05 +00:00
|
|
|
{
|
2019-07-08 06:40:10 +00:00
|
|
|
this.mods = new Bindable<IReadOnlyList<Mod>>(mods);
|
2019-07-08 05:55:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
|
|
|
{
|
2019-07-08 06:40:10 +00:00
|
|
|
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
|
|
|
dependencies.Cache(mods);
|
|
|
|
|
|
|
|
// Overwrite the global mods here for use in the mod hud.
|
|
|
|
Mods.Value = mods.Value;
|
2019-07-08 05:55:05 +00:00
|
|
|
|
2019-07-08 06:40:10 +00:00
|
|
|
return dependencies;
|
2019-07-08 05:55:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|