2018-04-13 17:19:50 +08:00
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
using OpenTK;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
2018-06-07 10:16:26 +08:00
|
|
|
using OpenTK.Graphics;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Visualises a <see cref="BarLine"/>. Although this derives DrawableManiaHitObject,
|
|
|
|
/// this does not handle input/sound like a normal hit object.
|
|
|
|
/// </summary>
|
|
|
|
public class DrawableBarLine : DrawableManiaHitObject<BarLine>
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Height of major bar line triangles.
|
|
|
|
/// </summary>
|
|
|
|
private const float triangle_height = 12;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Offset of the major bar line triangles from the sides of the bar line.
|
|
|
|
/// </summary>
|
|
|
|
private const float triangle_offset = 9;
|
|
|
|
|
|
|
|
public DrawableBarLine(BarLine barLine)
|
|
|
|
: base(barLine)
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X;
|
2018-06-07 10:16:26 +08:00
|
|
|
Height = 2f;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
AddInternal(new Box
|
|
|
|
{
|
|
|
|
Name = "Bar line",
|
|
|
|
Anchor = Anchor.BottomCentre,
|
|
|
|
Origin = Anchor.BottomCentre,
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2018-06-07 10:16:26 +08:00
|
|
|
Colour = new Color4(255, 204, 33, 255),
|
2018-04-13 17:19:50 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
bool isMajor = barLine.BeatIndex % (int)barLine.ControlPoint.TimeSignature == 0;
|
|
|
|
|
|
|
|
if (isMajor)
|
|
|
|
{
|
|
|
|
AddInternal(new EquilateralTriangle
|
|
|
|
{
|
|
|
|
Name = "Left triangle",
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
Size = new Vector2(triangle_height),
|
|
|
|
X = -triangle_offset,
|
|
|
|
Rotation = 90
|
|
|
|
});
|
|
|
|
|
|
|
|
AddInternal(new EquilateralTriangle
|
|
|
|
{
|
|
|
|
Name = "Right triangle",
|
|
|
|
Anchor = Anchor.BottomRight,
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
Size = new Vector2(triangle_height),
|
|
|
|
X = triangle_offset,
|
|
|
|
Rotation = -90
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!isMajor && barLine.BeatIndex % 2 == 1)
|
|
|
|
Alpha = 0.2f;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void UpdateState(ArmedState state)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|