1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-06 21:57:19 +08:00

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

75 lines
2.3 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 18:19:50 +09:00
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
2020-12-07 12:30:25 +09:00
using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Taiko.Objects.Drawables;
2018-11-20 16:51:59 +09:00
using osuTK;
using osuTK.Graphics;
2018-04-13 18:19:50 +09:00
2020-12-07 12:30:25 +09:00
namespace osu.Game.Rulesets.Taiko.Skinning.Default
{
public partial class TickPiece : CompositeDrawable
{
/// <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 13:53:12 +09:30
private const float tick_border_width = 5;
2018-04-13 18:19:50 +09:00
/// <summary>
/// The size of a tick.
/// </summary>
2017-08-03 20:04:35 +09:30
private const float tick_size = 0.35f;
2018-04-13 18:19:50 +09:00
private readonly Box fillBox;
2018-04-13 18:19:50 +09:00
private Bindable<bool> isFirstTick = null!;
public TickPiece()
{
2017-08-03 13:53:12 +09:30
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
2018-04-13 18:19:50 +09:00
2017-08-03 20:04:35 +09:30
RelativeSizeAxes = Axes.Both;
FillMode = FillMode.Fit;
Size = new Vector2(tick_size);
2018-04-13 18:19:50 +09:00
InternalChild = new CircularContainer
{
RelativeSizeAxes = Axes.Both,
Masking = true,
BorderThickness = tick_border_width,
BorderColour = Color4.White,
Children = new[]
{
fillBox = new Box
{
RelativeSizeAxes = Axes.Both,
Alpha = 0,
AlwaysPresent = true
}
}
};
}
[Resolved]
private DrawableHitObject drawableHitObject { get; set; } = null!;
protected override void LoadComplete()
{
base.LoadComplete();
if (drawableHitObject is DrawableDrumRollTick drumRollTick)
{
isFirstTick = drumRollTick.IsFirstTick.GetBoundCopy();
isFirstTick.BindValueChanged(first => fillBox.Alpha = first.NewValue ? 1 : 0, true);
}
}
}
}