2017-05-04 17:02:43 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
|
|
|
|
|
using OpenTK.Graphics;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|
|
|
|
{
|
|
|
|
|
public class DrawableHoldNote : DrawableManiaHitObject<HoldNote>
|
|
|
|
|
{
|
2017-05-11 13:11:52 +08:00
|
|
|
|
private readonly NotePiece headPiece;
|
|
|
|
|
private readonly BodyPiece bodyPiece;
|
|
|
|
|
private readonly NotePiece tailPiece;
|
2017-05-04 17:02:43 +08:00
|
|
|
|
|
|
|
|
|
public DrawableHoldNote(HoldNote hitObject)
|
|
|
|
|
: base(hitObject)
|
|
|
|
|
{
|
2017-05-09 19:33:59 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
|
Height = (float)HitObject.Duration;
|
|
|
|
|
|
|
|
|
|
Add(new Drawable[]
|
2017-05-04 17:02:43 +08:00
|
|
|
|
{
|
2017-05-09 19:55:20 +08:00
|
|
|
|
// For now the body piece covers the entire height of the container
|
|
|
|
|
// whereas possibly in the future we don't want to extend under the head/tail.
|
|
|
|
|
// This will be fixed when new designs are given or the current design is finalized.
|
2017-05-04 17:02:43 +08:00
|
|
|
|
bodyPiece = new BodyPiece
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.BottomCentre,
|
|
|
|
|
Origin = Anchor.BottomCentre,
|
|
|
|
|
},
|
2017-05-09 19:33:59 +08:00
|
|
|
|
headPiece = new NotePiece
|
2017-05-04 17:02:43 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.BottomCentre,
|
|
|
|
|
Origin = Anchor.BottomCentre
|
2017-05-09 19:33:59 +08:00
|
|
|
|
},
|
|
|
|
|
tailPiece = new NotePiece
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
|
Origin = Anchor.TopCentre
|
2017-05-04 17:02:43 +08:00
|
|
|
|
}
|
2017-05-09 19:33:59 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// The "length" of the hold note stops at the "base" of the tail piece
|
|
|
|
|
// but we want to contain the tail piece within our bounds
|
|
|
|
|
Height += (float)HitObject.Duration / headPiece.Height;
|
2017-05-04 17:02:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override Color4 AccentColour
|
|
|
|
|
{
|
2017-05-11 13:11:52 +08:00
|
|
|
|
get { return base.AccentColour; }
|
2017-05-04 17:02:43 +08:00
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (base.AccentColour == value)
|
|
|
|
|
return;
|
|
|
|
|
base.AccentColour = value;
|
|
|
|
|
|
|
|
|
|
headPiece.AccentColour = value;
|
|
|
|
|
bodyPiece.AccentColour = value;
|
|
|
|
|
tailPiece.AccentColour = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void UpdateState(ArmedState state)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|