1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 01:53:00 +08:00

Remove non-generic DrawableEditRuleset

This commit is contained in:
smoogipoo 2019-08-29 18:12:29 +09:00
parent 59296d12f3
commit 87e28ab1f9
3 changed files with 23 additions and 36 deletions

View File

@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Mania.Edit
[Cached(Type = typeof(IManiaHitObjectComposer))]
public class ManiaHitObjectComposer : HitObjectComposer<ManiaHitObject>, IManiaHitObjectComposer
{
protected new DrawableManiaEditRuleset DrawableRuleset { get; private set; }
private DrawableManiaEditRuleset drawableRuleset;
public ManiaHitObjectComposer(Ruleset ruleset)
: base(ruleset)
@ -33,23 +33,23 @@ namespace osu.Game.Rulesets.Mania.Edit
/// </summary>
/// <param name="screenSpacePosition">The screen-space position.</param>
/// <returns>The column which intersects with <paramref name="screenSpacePosition"/>.</returns>
public Column ColumnAt(Vector2 screenSpacePosition) => DrawableRuleset.GetColumnByPosition(screenSpacePosition);
public Column ColumnAt(Vector2 screenSpacePosition) => drawableRuleset.GetColumnByPosition(screenSpacePosition);
private DependencyContainer dependencies;
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
=> dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
public int TotalColumns => ((ManiaPlayfield)DrawableRuleset.Playfield).TotalColumns;
public int TotalColumns => ((ManiaPlayfield)drawableRuleset.Playfield).TotalColumns;
protected override DrawableRuleset<ManiaHitObject> CreateDrawableRuleset(Ruleset ruleset, WorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
{
DrawableRuleset = new DrawableManiaEditRuleset(ruleset, beatmap, mods);
drawableRuleset = new DrawableManiaEditRuleset(ruleset, beatmap, mods);
// This is the earliest we can cache the scrolling info to ourselves, before masks are added to the hierarchy and inject it
dependencies.CacheAs(DrawableRuleset.ScrollingInfo);
dependencies.CacheAs(drawableRuleset.ScrollingInfo);
return DrawableRuleset;
return drawableRuleset;
}
protected override IReadOnlyList<HitObjectCompositionTool> CompositionTools => new HitObjectCompositionTool[]

View File

@ -11,27 +11,10 @@ using osu.Game.Screens.Edit;
namespace osu.Game.Rulesets.Edit
{
public abstract class DrawableEditRuleset : CompositeDrawable
{
/// <summary>
/// The <see cref="Playfield"/> contained by this <see cref="DrawableEditRuleset"/>.
/// </summary>
public abstract Playfield Playfield { get; }
public abstract PlayfieldAdjustmentContainer CreatePlayfieldAdjustmentContainer();
internal DrawableEditRuleset()
{
RelativeSizeAxes = Axes.Both;
}
}
public class DrawableEditRuleset<TObject> : DrawableEditRuleset
public class DrawableEditRuleset<TObject> : CompositeDrawable
where TObject : HitObject
{
public override Playfield Playfield => drawableRuleset.Playfield;
public override PlayfieldAdjustmentContainer CreatePlayfieldAdjustmentContainer() => drawableRuleset.CreatePlayfieldAdjustmentContainer();
public Playfield Playfield => drawableRuleset.Playfield;
private readonly DrawableRuleset<TObject> drawableRuleset;
@ -42,6 +25,8 @@ namespace osu.Game.Rulesets.Edit
{
this.drawableRuleset = drawableRuleset;
RelativeSizeAxes = Axes.Both;
InternalChild = drawableRuleset;
}
@ -76,6 +61,8 @@ namespace osu.Game.Rulesets.Edit
drawableRuleset.Playfield.PostProcess();
}
public PlayfieldAdjustmentContainer CreatePlayfieldAdjustmentContainer() => drawableRuleset.CreatePlayfieldAdjustmentContainer();
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);

View File

@ -30,7 +30,6 @@ namespace osu.Game.Rulesets.Edit
where TObject : HitObject
{
protected IRulesetConfigManager Config { get; private set; }
protected DrawableEditRuleset DrawableRuleset { get; private set; }
protected readonly Ruleset Ruleset;
@ -39,6 +38,7 @@ namespace osu.Game.Rulesets.Edit
private EditorBeatmap<TObject> editorBeatmap;
private IBeatmapProcessor beatmapProcessor;
private DrawableEditRuleset<TObject> drawableRuleset;
private BlueprintContainer blueprintContainer;
private readonly List<Container> layerContainers = new List<Container>();
@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.Edit
{
try
{
DrawableRuleset = new DrawableEditRuleset<TObject>(CreateDrawableRuleset(Ruleset, workingBeatmap.Value, Array.Empty<Mod>()))
drawableRuleset = new DrawableEditRuleset<TObject>(CreateDrawableRuleset(Ruleset, workingBeatmap.Value, Array.Empty<Mod>()))
{
Clock = framedClock
};
@ -66,10 +66,10 @@ namespace osu.Game.Rulesets.Edit
return;
}
var layerBelowRuleset = DrawableRuleset.CreatePlayfieldAdjustmentContainer();
var layerBelowRuleset = drawableRuleset.CreatePlayfieldAdjustmentContainer();
layerBelowRuleset.Child = new EditorPlayfieldBorder { RelativeSizeAxes = Axes.Both };
var layerAboveRuleset = DrawableRuleset.CreatePlayfieldAdjustmentContainer();
var layerAboveRuleset = drawableRuleset.CreatePlayfieldAdjustmentContainer();
layerAboveRuleset.Child = blueprintContainer = new BlueprintContainer();
layerContainers.Add(layerBelowRuleset);
@ -100,7 +100,7 @@ namespace osu.Game.Rulesets.Edit
Children = new Drawable[]
{
layerBelowRuleset,
DrawableRuleset,
drawableRuleset,
layerAboveRuleset
}
}
@ -153,10 +153,10 @@ namespace osu.Game.Rulesets.Edit
layerContainers.ForEach(l =>
{
l.Anchor = DrawableRuleset.Playfield.Anchor;
l.Origin = DrawableRuleset.Playfield.Origin;
l.Position = DrawableRuleset.Playfield.Position;
l.Size = DrawableRuleset.Playfield.Size;
l.Anchor = drawableRuleset.Playfield.Anchor;
l.Origin = drawableRuleset.Playfield.Origin;
l.Position = drawableRuleset.Playfield.Position;
l.Size = drawableRuleset.Playfield.Size;
});
}
@ -173,8 +173,8 @@ namespace osu.Game.Rulesets.Edit
beatmapProcessor?.PostProcess();
}
public override IEnumerable<DrawableHitObject> HitObjects => DrawableRuleset.Playfield.AllHitObjects;
public override bool CursorInPlacementArea => DrawableRuleset.Playfield.ReceivePositionalInputAt(inputManager.CurrentState.Mouse.Position);
public override IEnumerable<DrawableHitObject> HitObjects => drawableRuleset.Playfield.AllHitObjects;
public override bool CursorInPlacementArea => drawableRuleset.Playfield.ReceivePositionalInputAt(inputManager.CurrentState.Mouse.Position);
protected abstract IReadOnlyList<HitObjectCompositionTool> CompositionTools { get; }