From beb98c14b6882e2b308395439398df4975ffdd80 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 May 2017 16:26:11 +0900 Subject: [PATCH 1/4] Fix layout not being invalidated when re-filtering playlist display. --- osu.Game/Overlays/Music/PlaylistList.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Music/PlaylistList.cs b/osu.Game/Overlays/Music/PlaylistList.cs index 418fcd41e8..5e2f81ccf9 100644 --- a/osu.Game/Overlays/Music/PlaylistList.cs +++ b/osu.Game/Overlays/Music/PlaylistList.cs @@ -73,7 +73,13 @@ namespace osu.Game.Overlays.Music private class ItemSearchContainer : FillFlowContainer, IHasFilterableChildren { public string[] FilterTerms => new string[] { }; - public bool MatchingCurrentFilter { set { } } + public bool MatchingCurrentFilter + { + set + { + InvalidateLayout(); + } + } public IEnumerable FilterableChildren => Children; From f1d0b77d100eae3935b1000523c37021fb97f7fb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 May 2017 16:40:29 +0900 Subject: [PATCH 2/4] Base the music controller transform direction on relative indices in playlist. --- osu.Game/Overlays/Music/PlaylistOverlay.cs | 2 +- osu.Game/Overlays/MusicController.cs | 26 +++++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs index 3865ed246f..92b8addd97 100644 --- a/osu.Game/Overlays/Music/PlaylistOverlay.cs +++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs @@ -35,7 +35,7 @@ namespace osu.Game.Overlays.Music private readonly Bindable beatmapBacking = new Bindable(); - protected IEnumerable BeatmapSets; + public IEnumerable BeatmapSets; [BackgroundDependencyLoader] private void load(OsuGameBase game, BeatmapDatabase beatmaps, OsuColour colours) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index cf5a2fdee1..91d35db3bb 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -3,6 +3,7 @@ using System; using System.Diagnostics; +using System.Linq; using System.Threading.Tasks; using OpenTK; using OpenTK.Graphics; @@ -260,17 +261,36 @@ namespace osu.Game.Overlays } private WorkingBeatmap current; - private TransformDirection queuedDirection = TransformDirection.Next; + private TransformDirection? queuedDirection; private void beatmapChanged(WorkingBeatmap beatmap) { progressBar.IsEnabled = beatmap != null; bool audioEquals = beatmapBacking.Value?.BeatmapInfo?.AudioEquals(current?.BeatmapInfo) ?? false; + + TransformDirection direction; + + if (audioEquals) + direction = TransformDirection.None; + else if (queuedDirection.HasValue) + { + direction = queuedDirection.Value; + queuedDirection = null; + } + else + { + //figure out the best direction based on order in playlist. + var last = current == null ? -1 : playlist.BeatmapSets.TakeWhile(b => b.ID != current.BeatmapSetInfo.ID).Count(); + var next = beatmapBacking.Value == null ? -1 : playlist.BeatmapSets.TakeWhile(b => b.ID != beatmapBacking.Value.BeatmapSetInfo.ID).Count(); + + direction = last > next ? TransformDirection.Prev : TransformDirection.Next; + } + current = beatmapBacking.Value; - updateDisplay(beatmapBacking, audioEquals ? TransformDirection.None : queuedDirection); - queuedDirection = TransformDirection.Next; + updateDisplay(beatmapBacking, direction); + queuedDirection = null; } private ScheduledDelegate pendingBeatmapSwitch; From 46ae8bc86b8b9808ce93470a6ee89c8b86ce3443 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 May 2017 16:49:27 +0900 Subject: [PATCH 3/4] Use value because we need to. --- osu.Game/Overlays/Music/PlaylistList.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Music/PlaylistList.cs b/osu.Game/Overlays/Music/PlaylistList.cs index 5e2f81ccf9..c7909f1a63 100644 --- a/osu.Game/Overlays/Music/PlaylistList.cs +++ b/osu.Game/Overlays/Music/PlaylistList.cs @@ -77,7 +77,8 @@ namespace osu.Game.Overlays.Music { set { - InvalidateLayout(); + if (value) + InvalidateLayout(); } } From a993790a66f619c0edafdbd9b34b5524e13bffa6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 May 2017 17:54:07 +0900 Subject: [PATCH 4/4] Ensure all searchable terms are non-null non-empty. --- osu.Game/Database/BeatmapMetadata.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Database/BeatmapMetadata.cs b/osu.Game/Database/BeatmapMetadata.cs index 098c524cc3..ebca0f1cad 100644 --- a/osu.Game/Database/BeatmapMetadata.cs +++ b/osu.Game/Database/BeatmapMetadata.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Linq; using SQLite.Net.Attributes; namespace osu.Game.Database @@ -31,6 +32,6 @@ namespace osu.Game.Database TitleUnicode, Source, Tags - }; + }.Where(s => !string.IsNullOrEmpty(s)).ToArray(); } } \ No newline at end of file