diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 9d21a0341c..aeb88149c5 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -28,10 +28,15 @@ namespace osu.Game.Overlays { public class MusicController : FocusedOverlayContainer { + private const float player_height = 130; + private const float playlist_height = 510; private Drawable currentBackground; private DragBar progress; private Button playButton; private SpriteText title, artist; + private ClickableContainer playlistButton; + private PlaylistController playlist; + private Color4 activeColour; private List playList; private readonly List playHistory = new List(); @@ -45,6 +50,7 @@ namespace osu.Game.Overlays private BeatmapDatabase beatmaps; private Container dragContainer; + private Container playerContainer; private const float progress_height = 10; @@ -53,7 +59,7 @@ namespace osu.Game.Overlays public MusicController() { Width = 400; - Height = 130; + Height = player_height + playlist_height; Margin = new MarginPadding(10); } @@ -82,104 +88,128 @@ namespace osu.Game.Overlays [BackgroundDependencyLoader] private void load(OsuGameBase game, OsuConfigManager config, BeatmapDatabase beatmaps, OsuColour colours) { + activeColour = colours.Yellow; + Children = new Drawable[] { dragContainer = new Container { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Masking = true, - CornerRadius = 5, - EdgeEffect = new EdgeEffect - { - Type = EdgeEffectType.Shadow, - Colour = Color4.Black.Opacity(40), - Radius = 5, - }, RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - title = new OsuSpriteText + playlist = new PlaylistController { - Origin = Anchor.BottomCentre, - Anchor = Anchor.TopCentre, - Position = new Vector2(0, 40), - TextSize = 25, - Colour = Color4.White, - Text = @"Nothing to play", - Font = @"Exo2.0-MediumItalic" + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Top = player_height + 10 }, + //todo: this is the logic I expect, but maybe not others + OnSelect = (set) => + { + if (set.ID == (current?.BeatmapSetInfo?.ID ?? -1)) + current?.Track?.Seek(0); + + play(set.Beatmaps[0], true); + }, }, - artist = new OsuSpriteText + playerContainer = new Container { - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - Position = new Vector2(0, 45), - TextSize = 15, - Colour = Color4.White, - Text = @"Nothing to play", - Font = @"Exo2.0-BoldItalic" - }, - new Container - { - Padding = new MarginPadding { Bottom = progress_height }, - Height = bottom_black_area_height, RelativeSizeAxes = Axes.X, - Origin = Anchor.BottomCentre, - Anchor = Anchor.BottomCentre, + Height = player_height, + Masking = true, + CornerRadius = 5, + EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Shadow, + Colour = Color4.Black.Opacity(40), + Radius = 5, + }, Children = new Drawable[] { - new FillFlowContainer