1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-23 19:27:24 +08:00
osu-lazer/osu.Game/Screens/Edit/Components/EditorSidebarSection.cs

86 lines
2.7 KiB
C#
Raw Normal View History

2022-03-15 15:48:14 +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
2022-03-15 15:35:46 +08:00
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Localisation;
using osu.Game.Graphics;
2022-03-16 16:19:08 +08:00
using osu.Game.Graphics.Containers;
2022-03-15 15:35:46 +08:00
using osu.Game.Overlays;
using osuTK;
namespace osu.Game.Screens.Edit.Components
{
public class EditorSidebarSection : Container
{
protected override Container<Drawable> Content { get; }
public EditorSidebarSection(LocalisableString sectionName)
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
InternalChild = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new SectionHeader(sectionName),
Content = new Container
2022-03-15 15:35:46 +08:00
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
},
}
};
}
public class SectionHeader : CompositeDrawable
{
private readonly LocalisableString text;
public SectionHeader(LocalisableString text)
{
this.text = text;
Margin = new MarginPadding { Vertical = 10, Horizontal = 5 };
2022-03-16 16:19:08 +08:00
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
2022-03-15 15:35:46 +08:00
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
2022-03-16 16:19:08 +08:00
InternalChild = new FillFlowContainer
2022-03-15 15:35:46 +08:00
{
2022-03-16 16:19:08 +08:00
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Spacing = new Vector2(2),
Children = new Drawable[]
2022-03-15 15:35:46 +08:00
{
2022-03-16 16:19:08 +08:00
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 16, weight: FontWeight.SemiBold))
{
Text = text,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
},
new Circle
{
Colour = colourProvider.Highlight1,
Size = new Vector2(28, 2),
}
2022-03-15 15:35:46 +08:00
}
};
}
}
}
}