1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-19 01:03:02 +08:00
osu-lazer/osu.Game/Screens/Edit/Timing/RowAttribute.cs

82 lines
2.6 KiB
C#
Raw Normal View History

2019-10-18 16:59:54 +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.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps.ControlPoints;
2019-10-18 16:59:54 +08:00
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Overlays;
using osuTK;
2019-10-18 16:59:54 +08:00
namespace osu.Game.Screens.Edit.Timing
{
public class RowAttribute : CompositeDrawable
2019-10-18 16:59:54 +08:00
{
protected readonly ControlPoint Point;
2021-04-19 14:27:38 +08:00
private readonly string label;
2019-10-18 16:59:54 +08:00
protected FillFlowContainer Content { get; private set; }
2021-04-19 14:27:38 +08:00
public RowAttribute(ControlPoint point, string label)
2019-10-18 16:59:54 +08:00
{
Point = point;
2021-04-19 14:27:38 +08:00
this.label = label;
2019-10-18 16:59:54 +08:00
}
[BackgroundDependencyLoader]
private void load(OsuColour colours, OverlayColourProvider overlayColours)
2019-10-18 16:59:54 +08:00
{
AutoSizeAxes = Axes.X;
Height = 20;
Anchor = Anchor.CentreLeft;
Origin = Anchor.CentreLeft;
Masking = true;
2021-04-19 16:57:07 +08:00
CornerRadius = 3;
2019-10-18 16:59:54 +08:00
InternalChildren = new Drawable[]
{
new Box
{
Colour = overlayColours.Background4,
2019-10-18 16:59:54 +08:00
RelativeSizeAxes = Axes.Both,
},
Content = new FillFlowContainer
2019-10-18 16:59:54 +08:00
{
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Direction = FillDirection.Horizontal,
2021-04-19 16:57:07 +08:00
Margin = new MarginPadding { Horizontal = 5 },
Spacing = new Vector2(5),
Children = new Drawable[]
{
2021-04-19 16:57:07 +08:00
new Circle
{
2021-04-19 16:57:07 +08:00
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Colour = Point.GetRepresentingColour(colours),
RelativeSizeAxes = Axes.Y,
2021-04-19 16:57:07 +08:00
Size = new Vector2(4, 0.6f),
},
new OsuSpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
2021-04-19 16:57:07 +08:00
Padding = new MarginPadding(3),
Font = OsuFont.Default.With(weight: FontWeight.Bold, size: 12),
Text = label,
},
},
}
2019-10-18 16:59:54 +08:00
};
}
}
}