From 51c598627ab24694336d6ff97c8bdcef831e8709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 4 Jun 2024 13:53:42 +0200 Subject: [PATCH] Move out section header component from editor This sort of thing has been showing up on flyte designs more and more so I want to start using it more over that rather ugly "overlined" text that's there on multiplayer screens right now. --- .../Graphics/UserInterface/SectionHeader.cs | 55 +++++++++++++++++++ .../Edit/Components/EditorSidebarSection.cs | 48 +--------------- 2 files changed, 56 insertions(+), 47 deletions(-) create mode 100644 osu.Game/Graphics/UserInterface/SectionHeader.cs diff --git a/osu.Game/Graphics/UserInterface/SectionHeader.cs b/osu.Game/Graphics/UserInterface/SectionHeader.cs new file mode 100644 index 0000000000..0ee430c501 --- /dev/null +++ b/osu.Game/Graphics/UserInterface/SectionHeader.cs @@ -0,0 +1,55 @@ +// Copyright (c) ppy Pty Ltd . 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.Framework.Localisation; +using osu.Game.Graphics.Containers; +using osu.Game.Overlays; +using osuTK; + +namespace osu.Game.Graphics.UserInterface +{ + public partial class SectionHeader : CompositeDrawable + { + private readonly LocalisableString text; + + public SectionHeader(LocalisableString text) + { + this.text = text; + + Margin = new MarginPadding { Vertical = 10, Horizontal = 5 }; + + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + } + + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider) + { + InternalChild = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Spacing = new Vector2(2), + Children = new Drawable[] + { + 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), + } + } + }; + } + } +} diff --git a/osu.Game/Screens/Edit/Components/EditorSidebarSection.cs b/osu.Game/Screens/Edit/Components/EditorSidebarSection.cs index 279793c0a1..5dd8f78f6d 100644 --- a/osu.Game/Screens/Edit/Components/EditorSidebarSection.cs +++ b/osu.Game/Screens/Edit/Components/EditorSidebarSection.cs @@ -1,15 +1,10 @@ // Copyright (c) ppy Pty Ltd . 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.Framework.Localisation; -using osu.Game.Graphics; -using osu.Game.Graphics.Containers; -using osu.Game.Overlays; -using osuTK; +using osu.Game.Graphics.UserInterface; namespace osu.Game.Screens.Edit.Components { @@ -38,46 +33,5 @@ public EditorSidebarSection(LocalisableString sectionName) } }; } - - public partial class SectionHeader : CompositeDrawable - { - private readonly LocalisableString text; - - public SectionHeader(LocalisableString text) - { - this.text = text; - - Margin = new MarginPadding { Vertical = 10, Horizontal = 5 }; - - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - } - - [BackgroundDependencyLoader] - private void load(OverlayColourProvider colourProvider) - { - InternalChild = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Spacing = new Vector2(2), - Children = new Drawable[] - { - 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), - } - } - }; - } - } } }