2019-01-24 17:43:03 +09: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-04-13 18:19:50 +09:00
|
|
|
|
2022-06-17 16:37:17 +09:00
|
|
|
#nullable disable
|
|
|
|
|
2017-05-29 16:00:14 +09:00
|
|
|
using osu.Framework.Graphics;
|
2017-06-20 15:54:23 +10:00
|
|
|
using osu.Framework.Graphics.Shapes;
|
2020-11-04 16:19:07 +09:00
|
|
|
using osuTK;
|
2018-11-20 16:51:59 +09:00
|
|
|
using osuTK.Graphics;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
2017-05-29 16:00:14 +09: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>
|
2019-09-24 23:03:55 +02:00
|
|
|
public class DrawableBarLine : DrawableManiaHitObject<BarLine>
|
2017-05-29 16:00:14 +09:00
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Height of major bar line triangles.
|
|
|
|
/// </summary>
|
|
|
|
private const float triangle_height = 12;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
2017-05-29 16:00:14 +09:00
|
|
|
/// <summary>
|
|
|
|
/// Offset of the major bar line triangles from the sides of the bar line.
|
|
|
|
/// </summary>
|
|
|
|
private const float triangle_offset = 9;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
2017-05-29 16:00:14 +09:00
|
|
|
public DrawableBarLine(BarLine barLine)
|
|
|
|
: base(barLine)
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X;
|
2018-06-07 11:16:26 +09:00
|
|
|
Height = 2f;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
2018-03-15 13:41:06 +09:00
|
|
|
AddInternal(new Box
|
2017-05-29 16:00:14 +09:00
|
|
|
{
|
|
|
|
Name = "Bar line",
|
|
|
|
Anchor = Anchor.BottomCentre,
|
|
|
|
Origin = Anchor.BottomCentre,
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2018-06-07 11:16:26 +09:00
|
|
|
Colour = new Color4(255, 204, 33, 255),
|
2017-05-29 16:00:14 +09:00
|
|
|
});
|
2018-04-13 18:19:50 +09:00
|
|
|
|
2019-09-10 13:29:50 +09:00
|
|
|
if (barLine.Major)
|
2017-05-29 16:00:14 +09:00
|
|
|
{
|
2018-03-15 13:41:06 +09:00
|
|
|
AddInternal(new EquilateralTriangle
|
2017-05-29 16:00:14 +09:00
|
|
|
{
|
|
|
|
Name = "Left triangle",
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
Size = new Vector2(triangle_height),
|
|
|
|
X = -triangle_offset,
|
|
|
|
Rotation = 90
|
|
|
|
});
|
2018-04-13 18:19:50 +09:00
|
|
|
|
2018-03-15 13:41:06 +09:00
|
|
|
AddInternal(new EquilateralTriangle
|
2017-05-29 16:00:14 +09:00
|
|
|
{
|
|
|
|
Name = "Right triangle",
|
|
|
|
Anchor = Anchor.BottomRight,
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
Size = new Vector2(triangle_height),
|
|
|
|
X = triangle_offset,
|
|
|
|
Rotation = -90
|
|
|
|
});
|
|
|
|
}
|
2018-04-13 18:19:50 +09:00
|
|
|
|
2019-09-10 13:29:50 +09:00
|
|
|
if (!barLine.Major)
|
2017-05-29 16:00:14 +09:00
|
|
|
Alpha = 0.2f;
|
|
|
|
}
|
2018-04-13 18:19:50 +09:00
|
|
|
|
2019-09-11 18:45:47 +09:00
|
|
|
protected override void UpdateInitialTransforms()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-11-04 16:19:07 +09:00
|
|
|
protected override void UpdateStartTimeStateTransforms() => this.FadeOut(150);
|
2017-05-29 16:00:14 +09:00
|
|
|
}
|
2018-01-05 20:21:19 +09:00
|
|
|
}
|