1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-14 23:37:26 +08:00
osu-lazer/osu.Game/Screens/Edit/Timing/RowAttribute.cs

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

86 lines
2.7 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.
2022-06-17 15:37:17 +08:00
#nullable disable
2019-10-18 16:59:54 +08:00
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 Drawable Background { get; private set; }
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[]
2019-10-18 16:59:54 +08:00
{
Background = new Box
2019-10-18 16:59:54 +08:00
{
Colour = overlayColours.Background5,
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
};
}
}
}