2019-11-07 11:59:05 +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.
|
|
|
|
|
2019-11-07 12:23:00 +08:00
|
|
|
using osu.Framework.Graphics;
|
2021-05-18 13:25:07 +08:00
|
|
|
using osu.Framework.Graphics.Containers;
|
2019-11-07 12:23:00 +08:00
|
|
|
using osu.Game.Rulesets.Mania.Edit.Blueprints.Components;
|
2019-11-07 11:59:05 +08:00
|
|
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|
|
|
{
|
2021-05-18 13:25:07 +08:00
|
|
|
public class HoldNoteNoteOverlay : CompositeDrawable
|
2019-11-07 11:59:05 +08:00
|
|
|
{
|
2021-05-18 13:25:07 +08:00
|
|
|
private readonly HoldNoteSelectionBlueprint holdNoteBlueprint;
|
2019-11-07 12:23:00 +08:00
|
|
|
private readonly HoldNotePosition position;
|
|
|
|
|
2021-05-18 13:25:07 +08:00
|
|
|
public HoldNoteNoteOverlay(HoldNoteSelectionBlueprint holdNoteBlueprint, HoldNotePosition position)
|
2019-11-07 11:59:05 +08:00
|
|
|
{
|
2021-05-18 13:25:07 +08:00
|
|
|
this.holdNoteBlueprint = holdNoteBlueprint;
|
2019-11-07 12:23:00 +08:00
|
|
|
this.position = position;
|
|
|
|
|
2021-05-18 13:25:07 +08:00
|
|
|
InternalChild = new EditNotePiece { RelativeSizeAxes = Axes.X };
|
2019-11-07 11:59:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
protected override void Update()
|
|
|
|
{
|
|
|
|
base.Update();
|
|
|
|
|
2021-05-18 13:25:07 +08:00
|
|
|
var drawableObject = holdNoteBlueprint.DrawableObject;
|
|
|
|
|
2019-11-07 12:31:06 +08:00
|
|
|
// Todo: This shouldn't exist, mania should not reference the drawable hitobject directly.
|
2021-05-18 13:25:07 +08:00
|
|
|
if (drawableObject.IsLoaded)
|
2019-11-07 12:31:06 +08:00
|
|
|
{
|
2021-05-18 13:25:07 +08:00
|
|
|
DrawableNote note = position == HoldNotePosition.Start ? (DrawableNote)drawableObject.Head : drawableObject.Tail;
|
2019-11-07 12:23:00 +08:00
|
|
|
|
2019-11-07 12:31:06 +08:00
|
|
|
Anchor = note.Anchor;
|
|
|
|
Origin = note.Origin;
|
2019-11-07 11:59:05 +08:00
|
|
|
|
2019-11-07 12:31:06 +08:00
|
|
|
Size = note.DrawSize;
|
|
|
|
Position = note.DrawPosition;
|
|
|
|
}
|
2019-11-07 11:59:05 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|