Merge pull request #14980 from peppy/difficulty-move-to-beatmap

Copy `BaseDifficulty` to `Beatmap<T>` and move the majority of write operations across
This commit is contained in:
Dan Balasescu
2021-10-07 18:43:44 +09:00
committed by GitHub
50 changed files with 202 additions and 129 deletions

View File

@ -5,6 +5,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
@ -24,24 +25,25 @@ namespace osu.Game.Tests.Visual
base.Content.Add(HitObjectContainer = CreateHitObjectContainer().With(c => c.Clock = new FramedClock(new StopwatchClock())));
}
[BackgroundDependencyLoader]
private void load()
{
Beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize = 2;
}
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
dependencies.CacheAs(new EditorClock());
var playable = Beatmap.Value.GetPlayableBeatmap(Beatmap.Value.BeatmapInfo.Ruleset);
var playable = GetPlayableBeatmap();
dependencies.CacheAs(new EditorBeatmap(playable));
return dependencies;
}
protected virtual IBeatmap GetPlayableBeatmap()
{
var playable = Beatmap.Value.GetPlayableBeatmap(Beatmap.Value.BeatmapInfo.Ruleset);
playable.Difficulty.CircleSize = 2;
return playable;
}
protected override void LoadComplete()
{
base.LoadComplete();