mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 13:42:56 +08:00
Remove IPlayfieldProvider
by caching Playfield
This commit is contained in:
parent
418dbf3f3e
commit
9dcd0bf311
@ -5,7 +5,6 @@ using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||
using osu.Game.Rulesets.Mania.UI;
|
||||
using osu.Game.Rulesets.UI;
|
||||
@ -14,13 +13,13 @@ using osu.Game.Tests.Visual;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Tests.Editor
|
||||
{
|
||||
[Cached(typeof(IPlayfieldProvider))]
|
||||
public abstract class ManiaSelectionBlueprintTestScene : SelectionBlueprintTestScene, IPlayfieldProvider
|
||||
public abstract class ManiaSelectionBlueprintTestScene : SelectionBlueprintTestScene
|
||||
{
|
||||
protected override Container<Drawable> Content => blueprints ?? base.Content;
|
||||
|
||||
private readonly Container blueprints;
|
||||
|
||||
[Cached(typeof(Playfield))]
|
||||
public Playfield Playfield { get; }
|
||||
|
||||
private readonly ScrollingTestContainer scrollingTestContainer;
|
||||
|
@ -6,6 +6,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Mania.Objects;
|
||||
using osu.Game.Rulesets.Mania.UI;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Rulesets.UI.Scrolling;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
||||
@ -14,12 +15,12 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
||||
where T : ManiaHitObject
|
||||
{
|
||||
[Resolved]
|
||||
private IPlayfieldProvider playfieldProvider { get; set; }
|
||||
private Playfield playfield { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private IScrollingInfo scrollingInfo { get; set; }
|
||||
|
||||
protected ScrollingHitObjectContainer HitObjectContainer => ((ManiaPlayfield)playfieldProvider.Playfield).GetColumn(HitObject.Column).HitObjectContainer;
|
||||
protected ScrollingHitObjectContainer HitObjectContainer => ((ManiaPlayfield)playfield).GetColumn(HitObject.Column).HitObjectContainer;
|
||||
|
||||
protected ManiaSelectionBlueprint(T hitObject)
|
||||
: base(hitObject)
|
||||
|
@ -43,6 +43,9 @@ namespace osu.Game.Rulesets.Edit
|
||||
|
||||
protected readonly Ruleset Ruleset;
|
||||
|
||||
// Provides `Playfield`
|
||||
private DependencyContainer dependencies;
|
||||
|
||||
[Resolved]
|
||||
protected EditorClock EditorClock { get; private set; }
|
||||
|
||||
@ -69,6 +72,9 @@ namespace osu.Game.Rulesets.Edit
|
||||
Ruleset = ruleset;
|
||||
}
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) =>
|
||||
dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
@ -88,6 +94,8 @@ namespace osu.Game.Rulesets.Edit
|
||||
return;
|
||||
}
|
||||
|
||||
dependencies.CacheAs(Playfield);
|
||||
|
||||
const float toolbar_width = 200;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
@ -415,8 +423,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
/// </summary>
|
||||
[Cached(typeof(HitObjectComposer))]
|
||||
[Cached(typeof(IPositionSnapProvider))]
|
||||
[Cached(typeof(IPlayfieldProvider))]
|
||||
public abstract class HitObjectComposer : CompositeDrawable, IPositionSnapProvider, IPlayfieldProvider
|
||||
public abstract class HitObjectComposer : CompositeDrawable, IPositionSnapProvider
|
||||
{
|
||||
protected HitObjectComposer()
|
||||
{
|
||||
|
@ -1,12 +0,0 @@
|
||||
// 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 osu.Game.Rulesets.UI;
|
||||
|
||||
namespace osu.Game.Rulesets.Edit
|
||||
{
|
||||
public interface IPlayfieldProvider
|
||||
{
|
||||
Playfield Playfield { get; }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user