mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 07:33:20 +08:00
Remove nested blueprints from sliders
This commit is contained in:
parent
e621cfc4ea
commit
532c41c82e
@ -150,8 +150,8 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
private class TestSliderBlueprint : SliderSelectionBlueprint
|
private class TestSliderBlueprint : SliderSelectionBlueprint
|
||||||
{
|
{
|
||||||
public new SliderBodyPiece BodyPiece => base.BodyPiece;
|
public new SliderBodyPiece BodyPiece => base.BodyPiece;
|
||||||
public new TestSliderCircleBlueprint HeadBlueprint => (TestSliderCircleBlueprint)base.HeadBlueprint;
|
public new TestSliderCircleOverlay HeadOverlay => (TestSliderCircleOverlay)base.HeadOverlay;
|
||||||
public new TestSliderCircleBlueprint TailBlueprint => (TestSliderCircleBlueprint)base.TailBlueprint;
|
public new TestSliderCircleOverlay TailOverlay => (TestSliderCircleOverlay)base.TailOverlay;
|
||||||
public new PathControlPointVisualiser ControlPointVisualiser => base.ControlPointVisualiser;
|
public new PathControlPointVisualiser ControlPointVisualiser => base.ControlPointVisualiser;
|
||||||
|
|
||||||
public TestSliderBlueprint(Slider slider)
|
public TestSliderBlueprint(Slider slider)
|
||||||
@ -159,14 +159,14 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override SliderCircleSelectionBlueprint CreateCircleSelectionBlueprint(Slider slider, SliderPosition position) => new TestSliderCircleBlueprint(slider, position);
|
protected override SliderCircleOverlay CreateCircleOverlay(Slider slider, SliderPosition position) => new TestSliderCircleOverlay(slider, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestSliderCircleBlueprint : SliderCircleSelectionBlueprint
|
private class TestSliderCircleOverlay : SliderCircleOverlay
|
||||||
{
|
{
|
||||||
public new HitCirclePiece CirclePiece => base.CirclePiece;
|
public new HitCirclePiece CirclePiece => base.CirclePiece;
|
||||||
|
|
||||||
public TestSliderCircleBlueprint(Slider slider, SliderPosition position)
|
public TestSliderCircleOverlay(Slider slider, SliderPosition position)
|
||||||
: base(slider, position)
|
: base(slider, position)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -174,10 +174,10 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
AddAssert("body positioned correctly", () => blueprint.BodyPiece.Position == slider.StackedPosition);
|
AddAssert("body positioned correctly", () => blueprint.BodyPiece.Position == slider.StackedPosition);
|
||||||
|
|
||||||
AddAssert("head positioned correctly",
|
AddAssert("head positioned correctly",
|
||||||
() => Precision.AlmostEquals(blueprint.HeadBlueprint.CirclePiece.ScreenSpaceDrawQuad.Centre, drawableObject.HeadCircle.ScreenSpaceDrawQuad.Centre));
|
() => Precision.AlmostEquals(blueprint.HeadOverlay.CirclePiece.ScreenSpaceDrawQuad.Centre, drawableObject.HeadCircle.ScreenSpaceDrawQuad.Centre));
|
||||||
|
|
||||||
AddAssert("tail positioned correctly",
|
AddAssert("tail positioned correctly",
|
||||||
() => Precision.AlmostEquals(blueprint.TailBlueprint.CirclePiece.ScreenSpaceDrawQuad.Centre, drawableObject.TailCircle.ScreenSpaceDrawQuad.Centre));
|
() => Precision.AlmostEquals(blueprint.TailOverlay.CirclePiece.ScreenSpaceDrawQuad.Centre, drawableObject.TailCircle.ScreenSpaceDrawQuad.Centre));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void moveMouseToControlPoint(int index)
|
private void moveMouseToControlPoint(int index)
|
||||||
@ -195,8 +195,8 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
private class TestSliderBlueprint : SliderSelectionBlueprint
|
private class TestSliderBlueprint : SliderSelectionBlueprint
|
||||||
{
|
{
|
||||||
public new SliderBodyPiece BodyPiece => base.BodyPiece;
|
public new SliderBodyPiece BodyPiece => base.BodyPiece;
|
||||||
public new TestSliderCircleBlueprint HeadBlueprint => (TestSliderCircleBlueprint)base.HeadBlueprint;
|
public new TestSliderCircleOverlay HeadOverlay => (TestSliderCircleOverlay)base.HeadOverlay;
|
||||||
public new TestSliderCircleBlueprint TailBlueprint => (TestSliderCircleBlueprint)base.TailBlueprint;
|
public new TestSliderCircleOverlay TailOverlay => (TestSliderCircleOverlay)base.TailOverlay;
|
||||||
public new PathControlPointVisualiser ControlPointVisualiser => base.ControlPointVisualiser;
|
public new PathControlPointVisualiser ControlPointVisualiser => base.ControlPointVisualiser;
|
||||||
|
|
||||||
public TestSliderBlueprint(Slider slider)
|
public TestSliderBlueprint(Slider slider)
|
||||||
@ -204,14 +204,14 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override SliderCircleSelectionBlueprint CreateCircleSelectionBlueprint(Slider slider, SliderPosition position) => new TestSliderCircleBlueprint(slider, position);
|
protected override SliderCircleOverlay CreateCircleOverlay(Slider slider, SliderPosition position) => new TestSliderCircleOverlay(slider, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestSliderCircleBlueprint : SliderCircleSelectionBlueprint
|
private class TestSliderCircleOverlay : SliderCircleOverlay
|
||||||
{
|
{
|
||||||
public new HitCirclePiece CirclePiece => base.CirclePiece;
|
public new HitCirclePiece CirclePiece => base.CirclePiece;
|
||||||
|
|
||||||
public TestSliderCircleBlueprint(Slider slider, SliderPosition position)
|
public TestSliderCircleOverlay(Slider slider, SliderPosition position)
|
||||||
: base(slider, position)
|
: base(slider, position)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -1,35 +1,32 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
|
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||||
{
|
{
|
||||||
public class SliderCircleSelectionBlueprint : OsuSelectionBlueprint<Slider>
|
public class SliderCircleOverlay : CompositeDrawable
|
||||||
{
|
{
|
||||||
protected readonly HitCirclePiece CirclePiece;
|
protected readonly HitCirclePiece CirclePiece;
|
||||||
|
|
||||||
|
private readonly Slider slider;
|
||||||
private readonly SliderPosition position;
|
private readonly SliderPosition position;
|
||||||
|
|
||||||
public SliderCircleSelectionBlueprint(Slider slider, SliderPosition position)
|
public SliderCircleOverlay(Slider slider, SliderPosition position)
|
||||||
: base(slider)
|
|
||||||
{
|
{
|
||||||
|
this.slider = slider;
|
||||||
this.position = position;
|
this.position = position;
|
||||||
|
|
||||||
InternalChild = CirclePiece = new HitCirclePiece();
|
InternalChild = CirclePiece = new HitCirclePiece();
|
||||||
|
|
||||||
Select();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
CirclePiece.UpdateFrom(position == SliderPosition.Start ? (HitCircle)HitObject.HeadCircle : HitObject.TailCircle);
|
CirclePiece.UpdateFrom(position == SliderPosition.Start ? (HitCircle)slider.HeadCircle : slider.TailCircle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Todo: This is temporary, since the slider circle masks don't do anything special yet. In the future they will handle input.
|
|
||||||
public override bool HandlePositionalInput => false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,7 +14,6 @@ using osu.Framework.Input.Events;
|
|||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
|
||||||
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components;
|
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Screens.Edit;
|
using osu.Game.Screens.Edit;
|
||||||
@ -27,8 +26,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
|||||||
public class SliderSelectionBlueprint : OsuSelectionBlueprint<Slider>
|
public class SliderSelectionBlueprint : OsuSelectionBlueprint<Slider>
|
||||||
{
|
{
|
||||||
protected SliderBodyPiece BodyPiece { get; private set; }
|
protected SliderBodyPiece BodyPiece { get; private set; }
|
||||||
protected SliderCircleSelectionBlueprint HeadBlueprint { get; private set; }
|
protected SliderCircleOverlay HeadOverlay { get; private set; }
|
||||||
protected SliderCircleSelectionBlueprint TailBlueprint { get; private set; }
|
protected SliderCircleOverlay TailOverlay { get; private set; }
|
||||||
|
|
||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
protected PathControlPointVisualiser ControlPointVisualiser { get; private set; }
|
protected PathControlPointVisualiser ControlPointVisualiser { get; private set; }
|
||||||
@ -61,8 +60,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
|||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
BodyPiece = new SliderBodyPiece(),
|
BodyPiece = new SliderBodyPiece(),
|
||||||
HeadBlueprint = CreateCircleSelectionBlueprint(HitObject, SliderPosition.Start),
|
HeadOverlay = CreateCircleOverlay(HitObject, SliderPosition.Start),
|
||||||
TailBlueprint = CreateCircleSelectionBlueprint(HitObject, SliderPosition.End),
|
TailOverlay = CreateCircleOverlay(HitObject, SliderPosition.End),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,14 +77,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
|||||||
BodyPiece.UpdateFrom(HitObject);
|
BodyPiece.UpdateFrom(HitObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Apply(DrawableHitObject drawableObject)
|
|
||||||
{
|
|
||||||
base.Apply(drawableObject);
|
|
||||||
|
|
||||||
HeadBlueprint?.Apply(drawableObject);
|
|
||||||
TailBlueprint?.Apply(drawableObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool HandleQuickDeletion()
|
public override bool HandleQuickDeletion()
|
||||||
{
|
{
|
||||||
var hoveredControlPoint = ControlPointVisualiser?.Pieces.FirstOrDefault(p => p.IsHovered);
|
var hoveredControlPoint = ControlPointVisualiser?.Pieces.FirstOrDefault(p => p.IsHovered);
|
||||||
@ -250,6 +241,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
|||||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) =>
|
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) =>
|
||||||
BodyPiece.ReceivePositionalInputAt(screenSpacePos) || ControlPointVisualiser?.Pieces.Any(p => p.ReceivePositionalInputAt(screenSpacePos)) == true;
|
BodyPiece.ReceivePositionalInputAt(screenSpacePos) || ControlPointVisualiser?.Pieces.Any(p => p.ReceivePositionalInputAt(screenSpacePos)) == true;
|
||||||
|
|
||||||
protected virtual SliderCircleSelectionBlueprint CreateCircleSelectionBlueprint(Slider slider, SliderPosition position) => new SliderCircleSelectionBlueprint(slider, position);
|
protected virtual SliderCircleOverlay CreateCircleOverlay(Slider slider, SliderPosition position) => new SliderCircleOverlay(slider, position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user