2019-01-24 16:43:03 +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.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2017-04-05 09:01:40 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2020-12-07 11:30:25 +08:00
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2018-11-20 15:51:59 +08:00
|
|
|
|
using osuTK;
|
|
|
|
|
using osuTK.Graphics;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2020-12-07 11:30:25 +08:00
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Skinning.Default
|
2017-04-05 09:01:40 +08:00
|
|
|
|
{
|
2020-04-11 12:14:34 +08:00
|
|
|
|
public class TickPiece : CompositeDrawable
|
2017-04-05 09:01:40 +08: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>
|
2017-08-03 12:23:12 +08:00
|
|
|
|
private const float tick_border_width = 5;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-04-05 09:01:40 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The size of a tick.
|
|
|
|
|
/// </summary>
|
2017-08-03 18:34:35 +08:00
|
|
|
|
private const float tick_size = 0.35f;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-04-05 09:01:40 +08:00
|
|
|
|
private bool filled;
|
2019-02-28 12:31:40 +08:00
|
|
|
|
|
2017-04-05 09:01:40 +08:00
|
|
|
|
public bool Filled
|
|
|
|
|
{
|
2019-02-28 12:58:19 +08:00
|
|
|
|
get => filled;
|
2017-04-05 09:01:40 +08:00
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
filled = value;
|
|
|
|
|
fillBox.Alpha = filled ? 1 : 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-04-05 09:01:40 +08:00
|
|
|
|
private readonly Box fillBox;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-04-05 09:01:40 +08:00
|
|
|
|
public TickPiece()
|
|
|
|
|
{
|
2017-08-03 12:23:12 +08:00
|
|
|
|
Anchor = Anchor.Centre;
|
|
|
|
|
Origin = Anchor.Centre;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-08-03 18:34:35 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
|
FillMode = FillMode.Fit;
|
2017-04-05 09:01:40 +08:00
|
|
|
|
Size = new Vector2(tick_size);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2020-04-11 12:14:34 +08:00
|
|
|
|
InternalChild = new CircularContainer
|
2017-04-05 09:01:40 +08: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
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-04-11 12:14:34 +08:00
|
|
|
|
};
|
2017-04-05 09:01:40 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|