Remove nested blueprints from hold notes

This commit is contained in:
smoogipoo 2021-05-18 14:25:07 +09:00
parent 532c41c82e
commit 72beddaadc
3 changed files with 14 additions and 29 deletions

View File

@ -184,8 +184,8 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
AddAssert("head note positioned correctly", () => Precision.AlmostEquals(holdNote.ScreenSpaceDrawQuad.BottomLeft, holdNote.Head.ScreenSpaceDrawQuad.BottomLeft));
AddAssert("tail note positioned correctly", () => Precision.AlmostEquals(holdNote.ScreenSpaceDrawQuad.TopLeft, holdNote.Tail.ScreenSpaceDrawQuad.BottomLeft));
AddAssert("head blueprint positioned correctly", () => this.ChildrenOfType<HoldNoteNoteSelectionBlueprint>().ElementAt(0).DrawPosition == holdNote.Head.DrawPosition);
AddAssert("tail blueprint positioned correctly", () => this.ChildrenOfType<HoldNoteNoteSelectionBlueprint>().ElementAt(1).DrawPosition == holdNote.Tail.DrawPosition);
AddAssert("head blueprint positioned correctly", () => this.ChildrenOfType<HoldNoteNoteOverlay>().ElementAt(0).DrawPosition == holdNote.Head.DrawPosition);
AddAssert("tail blueprint positioned correctly", () => this.ChildrenOfType<HoldNoteNoteOverlay>().ElementAt(1).DrawPosition == holdNote.Tail.DrawPosition);
}
private void setScrollStep(ScrollingDirection direction)

View File

@ -2,35 +2,35 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Mania.Edit.Blueprints.Components;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Objects.Drawables;
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
{
public class HoldNoteNoteSelectionBlueprint : ManiaSelectionBlueprint<HoldNote>
public class HoldNoteNoteOverlay : CompositeDrawable
{
protected new DrawableHoldNote DrawableObject => (DrawableHoldNote)base.DrawableObject;
private readonly HoldNoteSelectionBlueprint holdNoteBlueprint;
private readonly HoldNotePosition position;
public HoldNoteNoteSelectionBlueprint(HoldNote holdNote, HoldNotePosition position)
: base(holdNote)
public HoldNoteNoteOverlay(HoldNoteSelectionBlueprint holdNoteBlueprint, HoldNotePosition position)
{
this.holdNoteBlueprint = holdNoteBlueprint;
this.position = position;
InternalChild = new EditNotePiece { RelativeSizeAxes = Axes.X };
Select();
InternalChild = new EditNotePiece { RelativeSizeAxes = Axes.X };
}
protected override void Update()
{
base.Update();
var drawableObject = holdNoteBlueprint.DrawableObject;
// Todo: This shouldn't exist, mania should not reference the drawable hitobject directly.
if (DrawableObject.IsLoaded)
if (drawableObject.IsLoaded)
{
DrawableNote note = position == HoldNotePosition.Start ? (DrawableNote)DrawableObject.Head : DrawableObject.Tail;
DrawableNote note = position == HoldNotePosition.Start ? (DrawableNote)drawableObject.Head : drawableObject.Tail;
Anchor = note.Anchor;
Origin = note.Origin;
@ -39,8 +39,5 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
Position = note.DrawPosition;
}
}
// Todo: This is temporary, since the note masks don't do anything special yet. In the future they will handle input.
public override bool HandlePositionalInput => false;
}
}

View File

@ -10,7 +10,6 @@ using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI.Scrolling;
using osuTK;
@ -22,9 +21,6 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
private HoldNoteNoteSelectionBlueprint headBlueprint;
private HoldNoteNoteSelectionBlueprint tailBlueprint;
[Resolved]
private OsuColour colours { get; set; }
@ -40,8 +36,8 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
InternalChildren = new Drawable[]
{
headBlueprint = new HoldNoteNoteSelectionBlueprint(HitObject, HoldNotePosition.Start),
tailBlueprint = new HoldNoteNoteSelectionBlueprint(HitObject, HoldNotePosition.End),
new HoldNoteNoteOverlay(this, HoldNotePosition.Start),
new HoldNoteNoteOverlay(this, HoldNotePosition.End),
new Container
{
RelativeSizeAxes = Axes.Both,
@ -58,14 +54,6 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
};
}
public override void Apply(DrawableHitObject drawableObject)
{
base.Apply(drawableObject);
headBlueprint?.Apply(drawableObject);
tailBlueprint?.Apply(drawableObject);
}
protected override void Update()
{
base.Update();