2019-01-24 16:43:03 +08:00
|
|
|
|
// 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.
|
2018-05-20 18:22:42 +08:00
|
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
2019-02-21 18:04:31 +08:00
|
|
|
|
using osu.Framework.Bindables;
|
2018-05-20 18:22:42 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
2018-11-06 15:19:40 +08:00
|
|
|
|
using osu.Framework.Graphics.Primitives;
|
2018-05-20 18:22:42 +08:00
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
|
|
|
|
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
|
2018-07-19 18:30:20 +08:00
|
|
|
|
using osu.Game.Rulesets.UI.Scrolling;
|
2018-11-20 15:51:59 +08:00
|
|
|
|
using osuTK;
|
|
|
|
|
using osuTK.Graphics;
|
2018-05-20 18:22:42 +08:00
|
|
|
|
|
2018-11-07 15:08:56 +08:00
|
|
|
|
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
2018-05-20 18:22:42 +08:00
|
|
|
|
{
|
2018-11-06 15:16:52 +08:00
|
|
|
|
public class HoldNoteSelectionBlueprint : ManiaSelectionBlueprint
|
2018-05-20 18:22:42 +08:00
|
|
|
|
{
|
2019-10-21 16:04:56 +08:00
|
|
|
|
public new DrawableHoldNote DrawableObject => (DrawableHoldNote)base.DrawableObject;
|
2018-07-19 18:30:20 +08:00
|
|
|
|
|
|
|
|
|
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
|
|
|
|
|
|
2019-10-17 15:14:28 +08:00
|
|
|
|
[Resolved]
|
|
|
|
|
private OsuColour colours { get; set; }
|
2018-05-20 18:22:42 +08:00
|
|
|
|
|
2018-11-06 16:56:04 +08:00
|
|
|
|
public HoldNoteSelectionBlueprint(DrawableHoldNote hold)
|
2018-05-20 18:22:42 +08:00
|
|
|
|
: base(hold)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2019-10-17 15:14:28 +08:00
|
|
|
|
private void load(IScrollingInfo scrollingInfo)
|
2018-05-20 18:22:42 +08:00
|
|
|
|
{
|
2018-07-19 18:30:20 +08:00
|
|
|
|
direction.BindTo(scrollingInfo.Direction);
|
2018-05-20 18:22:42 +08:00
|
|
|
|
}
|
2018-06-07 18:00:02 +08:00
|
|
|
|
|
2019-10-17 15:14:28 +08:00
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
|
{
|
2019-11-07 12:23:00 +08:00
|
|
|
|
new HoldNoteNoteSelectionBlueprint(DrawableObject, HoldNotePosition.Start),
|
|
|
|
|
new HoldNoteNoteSelectionBlueprint(DrawableObject, HoldNotePosition.End),
|
2019-10-17 15:14:28 +08:00
|
|
|
|
new BodyPiece
|
|
|
|
|
{
|
|
|
|
|
AccentColour = Color4.Transparent,
|
|
|
|
|
BorderColour = colours.Yellow
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-07 18:00:02 +08:00
|
|
|
|
protected override void Update()
|
|
|
|
|
{
|
|
|
|
|
base.Update();
|
|
|
|
|
|
2019-10-21 16:04:56 +08:00
|
|
|
|
Size = DrawableObject.DrawSize + new Vector2(0, DrawableObject.Tail.DrawHeight);
|
2018-07-19 18:30:20 +08:00
|
|
|
|
|
|
|
|
|
// This is a side-effect of not matching the hitobject's anchors/origins, which is kinda hard to do
|
2018-07-19 18:44:06 +08:00
|
|
|
|
// When scrolling upwards our origin is already at the top of the head note (which is the intended location),
|
2018-07-19 18:30:20 +08:00
|
|
|
|
// but when scrolling downwards our origin is at the _bottom_ of the tail note (where we need to be at the _top_ of the tail note)
|
|
|
|
|
if (direction.Value == ScrollingDirection.Down)
|
2019-10-21 16:04:56 +08:00
|
|
|
|
Y -= DrawableObject.Tail.DrawHeight;
|
2018-06-07 18:00:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-11-06 15:19:40 +08:00
|
|
|
|
public override Quad SelectionQuad => ScreenSpaceDrawQuad;
|
2018-05-20 18:22:42 +08:00
|
|
|
|
}
|
|
|
|
|
}
|