mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 08:03:52 +09:00
create base dependencies before caching, create player in playerloader
This commit is contained in:
@ -285,7 +285,7 @@ namespace osu.Game
|
|||||||
Ruleset.Value = databasedScoreInfo.Ruleset;
|
Ruleset.Value = databasedScoreInfo.Ruleset;
|
||||||
Beatmap.Value = BeatmapManager.GetWorkingBeatmap(databasedBeatmap);
|
Beatmap.Value = BeatmapManager.GetWorkingBeatmap(databasedBeatmap);
|
||||||
|
|
||||||
menuScreen.Push(new ReplayPlayerLoader(() => new ReplayPlayer(databasedScore), databasedScoreInfo.Mods));
|
menuScreen.Push(new ReplayPlayerLoader(databasedScore, databasedScoreInfo.Mods));
|
||||||
}, $"watch {databasedScoreInfo}", bypassScreenAllowChecks: true);
|
}, $"watch {databasedScoreInfo}", bypassScreenAllowChecks: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,32 +1,33 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
public class ReplayPlayerLoader : PlayerLoader
|
public class ReplayPlayerLoader : PlayerLoader
|
||||||
{
|
{
|
||||||
private readonly IReadOnlyList<Mod> mods;
|
private readonly Bindable<IReadOnlyList<Mod>> mods;
|
||||||
|
|
||||||
public ReplayPlayerLoader(Func<Player> player, IReadOnlyList<Mod> mods)
|
public ReplayPlayerLoader(Score score, IReadOnlyList<Mod> mods)
|
||||||
: base(player)
|
: base(() => new ReplayPlayer(score))
|
||||||
{
|
{
|
||||||
this.mods = mods;
|
this.mods = new Bindable<IReadOnlyList<Mod>>(mods);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DependencyContainer dependencies;
|
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
{
|
{
|
||||||
dependencies = new DependencyContainer(parent);
|
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||||
dependencies.Cache(new Bindable<IReadOnlyList<Mod>>(mods));
|
dependencies.Cache(mods);
|
||||||
|
|
||||||
return base.CreateChildDependencies(dependencies);
|
// Overwrite the global mods here for use in the mod hud.
|
||||||
|
Mods.Value = mods.Value;
|
||||||
|
|
||||||
|
return dependencies;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user