diff --git a/osu.Game/Overlays/PlaylistController.cs b/osu.Game/Overlays/Music/PlaylistController.cs similarity index 87% rename from osu.Game/Overlays/PlaylistController.cs rename to osu.Game/Overlays/Music/PlaylistController.cs index dc3c99beda..f13e0860b1 100644 --- a/osu.Game/Overlays/PlaylistController.cs +++ b/osu.Game/Overlays/Music/PlaylistController.cs @@ -3,8 +3,6 @@ using System; using System.Collections.Generic; -using OpenTK; -using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; @@ -17,26 +15,24 @@ using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Select; +using OpenTK; +using OpenTK.Graphics; -namespace osu.Game.Overlays +namespace osu.Game.Overlays.Music { public class PlaylistController : OverlayContainer { - private const float transition_duration = 800; + private const float transition_duration = 600; + + private const float playlist_height = 510; private readonly Box bg; private readonly FilterControl filter; private readonly Playlist list; - public BeatmapSetInfo[] List - { - get - { - return list.Sets; - } - } + public BeatmapSetInfo[] List => list.Sets; - public Action OnSelect + public Action OnSelect { get { return list.OnSelect; } set { list.OnSelect = value; } @@ -100,8 +96,9 @@ namespace osu.Game.Overlays filter.Search.HoldFocus = true; filter.Search.TriggerFocus(); - list.ScrollContainer.ScrollDraggerVisible = true; - ResizeTo(new Vector2(1f), transition_duration, EasingTypes.OutQuint); + + ResizeTo(new Vector2(1, playlist_height), transition_duration, EasingTypes.OutQuint); + FadeIn(transition_duration, EasingTypes.OutQuint); } protected override void PopOut() @@ -109,8 +106,8 @@ namespace osu.Game.Overlays filter.Search.HoldFocus = false; filter.Search.TriggerFocusLost(); - list.ScrollContainer.ScrollDraggerVisible = false; - ResizeTo(new Vector2(1f, 0f), transition_duration, EasingTypes.OutQuint); + ResizeTo(new Vector2(1, 0), transition_duration, EasingTypes.OutQuint); + FadeOut(transition_duration); } private class FilterControl : Container @@ -236,7 +233,7 @@ namespace osu.Game.Overlays { newItems.Add(new PlaylistItem(value[i], i) { - OnSelect = OnSelect, + OnSelect = itemSelected, }); } @@ -244,22 +241,9 @@ namespace osu.Game.Overlays } } - // exposed so PlaylistController can hide the scroll dragger when hidden - // because the scroller can be seen when scrolled to the bottom and PlaylistController is closed - public readonly ScrollContainer ScrollContainer; + private void itemSelected(BeatmapSetInfo arg1, int arg2) => OnSelect?.Invoke(arg1, arg2); - private Action onSelect; - public Action OnSelect - { - get { return onSelect; } - set - { - onSelect = value; - - foreach (PlaylistItem s in items.Children) - s.OnSelect = value; - } - } + public Action OnSelect; private BeatmapSetInfo current; public BeatmapSetInfo Current @@ -279,7 +263,7 @@ namespace osu.Game.Overlays { Children = new Drawable[] { - ScrollContainer = new ScrollContainer + new ScrollContainer { RelativeSizeAxes = Axes.Both, Children = new Drawable[] @@ -304,7 +288,7 @@ namespace osu.Game.Overlays public readonly int Index; public readonly BeatmapSetInfo RepresentedSet; - public Action OnSelect; + public Action OnSelect; private bool current; public bool Current diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 9df222344c..e430533551 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -24,13 +24,14 @@ using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using System.Linq; +using osu.Game.Overlays.Music; 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; @@ -58,13 +59,9 @@ namespace osu.Game.Overlays public MusicController() { Width = 400; - Height = player_height + playlist_height; - Margin = new MarginPadding(10); } - protected override bool InternalContains(Vector2 screenSpacePos) => playlist.State == Visibility.Visible ? dragContainer.Contains(screenSpacePos) : playerContainer.Contains(screenSpacePos); - protected override bool OnDragStart(InputState state) => true; protected override bool OnDrag(InputState state) @@ -97,13 +94,14 @@ namespace osu.Game.Overlays { Anchor = Anchor.Centre, Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, Children = new Drawable[] { playlist = new PlaylistController { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Top = player_height + 10 }, + RelativeSizeAxes = Axes.X, + Y = player_height + 10, //todo: this is the logic I expect, but maybe not others OnSelect = (set, index) => { @@ -230,7 +228,7 @@ namespace osu.Game.Overlays currentBackground = new MusicControllerBackground(); playerContainer.Add(currentBackground); - playlist.StateChanged += (c, s) => playlistButton.FadeColour(s == Visibility.Visible? activeColour : Color4.White, transition_length, EasingTypes.OutQuint); + playlist.StateChanged += (c, s) => playlistButton.FadeColour(s == Visibility.Visible? activeColour : Color4.White, 200, EasingTypes.OutQuint); } protected override void LoadComplete() @@ -242,6 +240,12 @@ namespace osu.Game.Overlays base.LoadComplete(); } + protected override void UpdateAfterChildren() + { + base.UpdateAfterChildren(); + Height = dragContainer.Height; + } + protected override void Update() { base.Update(); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 02551b6666..66dc0aa598 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -421,7 +421,7 @@ - +