From eed88d7c9b66e8a62d8bddd05a79e8be64d87c07 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 7 Aug 2025 18:15:52 +0900 Subject: [PATCH] Provide `BeatmapItemsCount` in all filters to ensure we always use correct value --- osu.Game/Graphics/Carousel/ICarouselFilter.cs | 5 +++++ osu.Game/Screens/SelectV2/BeatmapCarousel.cs | 2 +- osu.Game/Screens/SelectV2/BeatmapCarouselFilterMatching.cs | 3 --- osu.Game/Screens/SelectV2/BeatmapCarouselFilterSorting.cs | 4 ++++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/Carousel/ICarouselFilter.cs b/osu.Game/Graphics/Carousel/ICarouselFilter.cs index a85b44b46a..a498c0ebc2 100644 --- a/osu.Game/Graphics/Carousel/ICarouselFilter.cs +++ b/osu.Game/Graphics/Carousel/ICarouselFilter.cs @@ -19,5 +19,10 @@ namespace osu.Game.Graphics.Carousel /// A cancellation token. /// The post-filtered items. Task> Run(IEnumerable items, CancellationToken cancellationToken); + + /// + /// The total number of beatmap difficulties displayed post filter. + /// + int BeatmapItemsCount { get; } } } diff --git a/osu.Game/Screens/SelectV2/BeatmapCarousel.cs b/osu.Game/Screens/SelectV2/BeatmapCarousel.cs index 9883c27fd1..d67fd5e23e 100644 --- a/osu.Game/Screens/SelectV2/BeatmapCarousel.cs +++ b/osu.Game/Screens/SelectV2/BeatmapCarousel.cs @@ -54,7 +54,7 @@ namespace osu.Game.Screens.SelectV2 /// /// Total number of beatmap difficulties displayed with the filter. /// - public int MatchedBeatmapsCount => grouping.BeatmapItemsCount; + public int MatchedBeatmapsCount => Filters.Last().BeatmapItemsCount; protected override float GetSpacingBetweenPanels(CarouselItem top, CarouselItem bottom) { diff --git a/osu.Game/Screens/SelectV2/BeatmapCarouselFilterMatching.cs b/osu.Game/Screens/SelectV2/BeatmapCarouselFilterMatching.cs index 166ca72487..1f5304c953 100644 --- a/osu.Game/Screens/SelectV2/BeatmapCarouselFilterMatching.cs +++ b/osu.Game/Screens/SelectV2/BeatmapCarouselFilterMatching.cs @@ -17,9 +17,6 @@ namespace osu.Game.Screens.SelectV2 { private readonly Func getCriteria; - /// - /// The total number of beatmap difficulties displayed post filter. - /// public int BeatmapItemsCount { get; private set; } public BeatmapCarouselFilterMatching(Func getCriteria) diff --git a/osu.Game/Screens/SelectV2/BeatmapCarouselFilterSorting.cs b/osu.Game/Screens/SelectV2/BeatmapCarouselFilterSorting.cs index 0ebfc084bd..e9d65f7108 100644 --- a/osu.Game/Screens/SelectV2/BeatmapCarouselFilterSorting.cs +++ b/osu.Game/Screens/SelectV2/BeatmapCarouselFilterSorting.cs @@ -16,6 +16,8 @@ namespace osu.Game.Screens.SelectV2 { public class BeatmapCarouselFilterSorting : ICarouselFilter { + public int BeatmapItemsCount { get; private set; } + private readonly Func getCriteria; public BeatmapCarouselFilterSorting(Func getCriteria) @@ -29,6 +31,8 @@ namespace osu.Game.Screens.SelectV2 bool groupedSets = BeatmapCarouselFilterGrouping.ShouldGroupBeatmapsTogether(criteria); + BeatmapItemsCount = items.Count(); + return items.Order(Comparer.Create((a, b) => { var ab = (BeatmapInfo)a.Model;