1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-07 05:27:51 +08:00
osu-lazer/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs

60 lines
1.7 KiB
C#
Raw Normal View History

2017-05-03 14:50:42 +08:00
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Graphics;
2017-05-04 14:36:37 +08:00
using osu.Framework.Extensions.Color4Extensions;
2017-05-03 14:50:42 +08:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
2017-05-03 14:50:42 +08:00
using osu.Game.Graphics;
namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces
{
2017-05-09 19:55:20 +08:00
/// <summary>
/// Represents the static hit markers of notes.
/// </summary>
2017-05-03 14:50:42 +08:00
internal class NotePiece : Container, IHasAccentColour
{
private const float head_height = 10;
private const float head_colour_height = 6;
2017-05-11 12:11:36 +08:00
private readonly Box colouredBox;
2017-05-03 14:50:42 +08:00
public NotePiece()
{
RelativeSizeAxes = Axes.X;
Height = head_height;
Children = new[]
{
new Box
{
RelativeSizeAxes = Axes.Both
},
colouredBox = new Box
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
Height = head_colour_height,
2017-05-04 14:36:37 +08:00
Alpha = 0.2f
2017-05-03 14:50:42 +08:00
}
};
}
private Color4 accentColour;
public Color4 AccentColour
{
get { return accentColour; }
set
{
if (accentColour == value)
return;
accentColour = value;
2017-05-04 14:36:37 +08:00
colouredBox.Colour = AccentColour.Lighten(0.9f);
2017-05-03 14:50:42 +08:00
}
}
}
}