Skip to content

Commit

Permalink
Merge pull request #2251 from andy840119/split-bottom-bar-out-of-editor
Browse files Browse the repository at this point in the history
Split `BottomBar` out of `Editor`
  • Loading branch information
andy840119 authored Jul 3, 2024
2 parents a3208ea + 2ee7328 commit 600fd57
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 54 deletions.
74 changes: 74 additions & 0 deletions osu.Game.Rulesets.Karaoke/Screens/Edit/BottomBar.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// Copyright (c) andy840119 <[email protected]>. 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;

/// <summary>
/// Copy the Component from the <see cref="osu.Game.Screens.Edit"/>
/// </summary>
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;
}
}
56 changes: 2 additions & 54 deletions osu.Game.Rulesets.Karaoke/Screens/Edit/GenericEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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(),
},
});

Expand Down

0 comments on commit 600fd57

Please sign in to comment.