osu/osu.Game.Rulesets.Taiko/Skinning/Default/TickPiece.cs

67 lines
1.8 KiB
C#
Raw Normal View History

// 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 09:19:50 +00:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
2020-12-07 03:30:25 +00:00
using osu.Framework.Graphics.Shapes;
2018-11-20 07:51:59 +00:00
using osuTK;
using osuTK.Graphics;
2018-04-13 09:19:50 +00:00
2020-12-07 03:30:25 +00:00
namespace osu.Game.Rulesets.Taiko.Skinning.Default
2018-04-13 09:19:50 +00:00
{
public class TickPiece : CompositeDrawable
2018-04-13 09:19:50 +00:00
{
/// <summary>
/// Any tick that is not the first for a drumroll is not filled, but is instead displayed
/// as a hollow circle. This is what controls the border width of that circle.
/// </summary>
private const float tick_border_width = 5;
/// <summary>
/// The size of a tick.
/// </summary>
private const float tick_size = 0.35f;
private bool filled;
2019-02-28 04:31:40 +00:00
2018-04-13 09:19:50 +00:00
public bool Filled
{
get => filled;
2018-04-13 09:19:50 +00:00
set
{
filled = value;
fillBox.Alpha = filled ? 1 : 0;
}
}
private readonly Box fillBox;
public TickPiece()
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
RelativeSizeAxes = Axes.Both;
FillMode = FillMode.Fit;
Size = new Vector2(tick_size);
InternalChild = new CircularContainer
2018-04-13 09:19:50 +00:00
{
RelativeSizeAxes = Axes.Both,
Masking = true,
BorderThickness = tick_border_width,
BorderColour = Color4.White,
Children = new[]
{
fillBox = new Box
{
RelativeSizeAxes = Axes.Both,
Alpha = 0,
AlwaysPresent = true
}
}
};
2018-04-13 09:19:50 +00:00
}
}
}