From bb938be0b6e2d43ced4637d961fa8251bcf4916d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 30 May 2025 03:02:33 +0900 Subject: [PATCH] Fix carousel filtering twice on entering song select --- osu.Game/Screens/SelectV2/BeatmapCarousel.cs | 17 ++++++++++++++++- osu.Game/Screens/SelectV2/SongSelect.cs | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/SelectV2/BeatmapCarousel.cs b/osu.Game/Screens/SelectV2/BeatmapCarousel.cs index e007ae54ce..32e14ad43a 100644 --- a/osu.Game/Screens/SelectV2/BeatmapCarousel.cs +++ b/osu.Game/Screens/SelectV2/BeatmapCarousel.cs @@ -7,6 +7,7 @@ using System.Collections.Specialized; using System.Diagnostics; using System.Linq; using System.Threading; +using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; @@ -49,6 +50,8 @@ namespace osu.Game.Screens.SelectV2 private readonly BeatmapCarouselFilterMatching matching; private readonly BeatmapCarouselFilterGrouping grouping; + private bool waitingForInitialCriteria; + /// /// Total number of beatmap difficulties displayed with the filter. /// @@ -67,8 +70,10 @@ namespace osu.Game.Screens.SelectV2 return -SPACING; } - public BeatmapCarousel() + public BeatmapCarousel(bool waitForInitialCriteria = false) { + waitingForInitialCriteria = waitForInitialCriteria; + DebounceDelay = 100; DistanceOffscreenToPreload = 100; @@ -473,6 +478,8 @@ namespace osu.Game.Screens.SelectV2 public void Filter(FilterCriteria criteria) { + waitingForInitialCriteria = false; + bool resetDisplay = grouping.BeatmapSetsGroupedTogether != BeatmapCarouselFilterGrouping.ShouldGroupBeatmapsTogether(criteria); Criteria = criteria; @@ -493,6 +500,14 @@ namespace osu.Game.Screens.SelectV2 })); } + protected override Task> FilterAsync(bool clearExistingPanels = false) + { + if (waitingForInitialCriteria) + return Task.FromResult(Enumerable.Empty()); + + return base.FilterAsync(clearExistingPanels); + } + #endregion #region Drawable pooling diff --git a/osu.Game/Screens/SelectV2/SongSelect.cs b/osu.Game/Screens/SelectV2/SongSelect.cs index 1056c2ff71..59dae1f28a 100644 --- a/osu.Game/Screens/SelectV2/SongSelect.cs +++ b/osu.Game/Screens/SelectV2/SongSelect.cs @@ -208,7 +208,7 @@ namespace osu.Game.Screens.SelectV2 }, Children = new Drawable[] { - carousel = new BeatmapCarousel + carousel = new BeatmapCarousel(waitForInitialCriteria: true) { BleedTop = FilterControl.HEIGHT_FROM_SCREEN_TOP + 5, BleedBottom = ScreenFooter.HEIGHT + 5,