1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-28 01:47:33 +08:00

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("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("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("head blueprint positioned correctly", () => this.ChildrenOfType<HoldNoteNoteOverlay>().ElementAt(0).DrawPosition == holdNote.Head.DrawPosition);
AddAssert("tail blueprint positioned correctly", () => this.ChildrenOfType<HoldNoteNoteSelectionBlueprint>().ElementAt(1).DrawPosition == holdNote.Tail.DrawPosition); AddAssert("tail blueprint positioned correctly", () => this.ChildrenOfType<HoldNoteNoteOverlay>().ElementAt(1).DrawPosition == holdNote.Tail.DrawPosition);
} }
private void setScrollStep(ScrollingDirection direction) private void setScrollStep(ScrollingDirection direction)

View File

@ -2,35 +2,35 @@
// 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 osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Mania.Edit.Blueprints.Components; using osu.Game.Rulesets.Mania.Edit.Blueprints.Components;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Mania.Objects.Drawables;
namespace osu.Game.Rulesets.Mania.Edit.Blueprints 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; private readonly HoldNotePosition position;
public HoldNoteNoteSelectionBlueprint(HoldNote holdNote, HoldNotePosition position) public HoldNoteNoteOverlay(HoldNoteSelectionBlueprint holdNoteBlueprint, HoldNotePosition position)
: base(holdNote)
{ {
this.holdNoteBlueprint = holdNoteBlueprint;
this.position = position; this.position = position;
InternalChild = new EditNotePiece { RelativeSizeAxes = Axes.X };
Select(); InternalChild = new EditNotePiece { RelativeSizeAxes = Axes.X };
} }
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();
var drawableObject = holdNoteBlueprint.DrawableObject;
// Todo: This shouldn't exist, mania should not reference the drawable hitobject directly. // 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; Anchor = note.Anchor;
Origin = note.Origin; Origin = note.Origin;
@ -39,8 +39,5 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
Position = note.DrawPosition; 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.Graphics;
using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Rulesets.UI.Scrolling;
using osuTK; using osuTK;
@ -22,9 +21,6 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>(); private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
private HoldNoteNoteSelectionBlueprint headBlueprint;
private HoldNoteNoteSelectionBlueprint tailBlueprint;
[Resolved] [Resolved]
private OsuColour colours { get; set; } private OsuColour colours { get; set; }
@ -40,8 +36,8 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
headBlueprint = new HoldNoteNoteSelectionBlueprint(HitObject, HoldNotePosition.Start), new HoldNoteNoteOverlay(this, HoldNotePosition.Start),
tailBlueprint = new HoldNoteNoteSelectionBlueprint(HitObject, HoldNotePosition.End), new HoldNoteNoteOverlay(this, HoldNotePosition.End),
new Container new Container
{ {
RelativeSizeAxes = Axes.Both, 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() protected override void Update()
{ {
base.Update(); base.Update();