From 2ee732835a4bff652f93d0fe5845368dc047a971 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Wed, 3 Jul 2024 22:14:19 +0800 Subject: [PATCH] Split `BottomBar` out of `Editor` Follow how https://github.com/ppy/osu/commit/8791e3b9ef37071dae3f1e44a56060e889f3f7d1 did. --- .../Screens/Edit/BottomBar.cs | 74 +++++++++++++++++++ .../Screens/Edit/GenericEditor.cs | 56 +------------- 2 files changed, 76 insertions(+), 54 deletions(-) create mode 100644 osu.Game.Rulesets.Karaoke/Screens/Edit/BottomBar.cs diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/BottomBar.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/BottomBar.cs new file mode 100644 index 000000000..36f0dc091 --- /dev/null +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/BottomBar.cs @@ -0,0 +1,74 @@ +// Copyright (c) andy840119 . Licensed under the GPL Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Effects; +using osu.Framework.Graphics.Shapes; +using osu.Game.Overlays; +using osu.Game.Screens.Edit.Components; +using osu.Game.Screens.Edit.Components.Timelines.Summary; +using osuTK.Graphics; + +namespace osu.Game.Rulesets.Karaoke.Screens.Edit; + +/// +/// Copy the Component from the +/// +public partial class BottomBar : CompositeDrawable +{ + private readonly Box background; + + public BottomBar() + { + Anchor = Anchor.BottomLeft; + Origin = Anchor.BottomLeft; + + RelativeSizeAxes = Axes.X; + + Height = 60; + + Masking = true; + EdgeEffect = new EdgeEffectParameters + { + Colour = Color4.Black.Opacity(0.2f), + Type = EdgeEffectType.Shadow, + Radius = 10f, + }; + + InternalChildren = new Drawable[] + { + background = new Box + { + RelativeSizeAxes = Axes.Both, + }, + new GridContainer + { + RelativeSizeAxes = Axes.Both, + ColumnDimensions = new[] + { + new Dimension(GridSizeMode.Absolute, 170), + new Dimension(), + new Dimension(GridSizeMode.Absolute, 220), + }, + Content = new[] + { + new Drawable[] + { + new TimeInfoContainer { RelativeSizeAxes = Axes.Both }, + new SummaryTimeline { RelativeSizeAxes = Axes.Both }, + new PlaybackControl { RelativeSizeAxes = Axes.Both }, + }, + }, + }, + }; + } + + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider) + { + background.Colour = colourProvider.Background4; + } +} diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/GenericEditor.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/GenericEditor.cs index b6077f06d..b6bd3ed8f 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/GenericEditor.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/GenericEditor.cs @@ -66,7 +66,7 @@ private void load(OsuColour colours, EditorBeatmap editorBeatmap, BindableBeatDi AddInternal(new OsuContextMenuContainer { RelativeSizeAxes = Axes.Both, - Children = new[] + Children = new Drawable[] { new Container { @@ -101,59 +101,7 @@ private void load(OsuColour colours, EditorBeatmap editorBeatmap, BindableBeatDi }, }, }, - new Container - { - Name = "Bottom bar", - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - RelativeSizeAxes = Axes.X, - Height = 60, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = colours.Gray2, - }, - new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Vertical = 5, Horizontal = 10 }, - Child = new GridContainer - { - RelativeSizeAxes = Axes.Both, - ColumnDimensions = new[] - { - new Dimension(GridSizeMode.Absolute, 220), - new Dimension(), - new Dimension(GridSizeMode.Absolute, 220), - }, - Content = new[] - { - new Drawable[] - { - new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Right = 10 }, - Child = new TimeInfoContainer { RelativeSizeAxes = Axes.Both }, - }, - new SummaryTimeline - { - RelativeSizeAxes = Axes.Both, - }, - new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = 10 }, - Child = new PlaybackControl { RelativeSizeAxes = Axes.Both }, - }, - }, - }, - }, - }, - }, - }, + new BottomBar(), }, });