1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-25 08:29:54 +08:00

Ensure BeatmapItemsCount is stable during filter operations

This commit is contained in:
Dean Herbert
2025-05-07 16:26:43 +09:00
Unverified
parent 8775731c24
commit 7789f4dbb0
@@ -28,7 +28,6 @@ namespace osu.Game.Screens.SelectV2
public async Task<IEnumerable<CarouselItem>> Run(IEnumerable<CarouselItem> items, CancellationToken cancellationToken) => await Task.Run(() =>
{
BeatmapItemsCount = 0;
var criteria = getCriteria();
return matchItems(items, criteria);
@@ -36,16 +35,20 @@ namespace osu.Game.Screens.SelectV2
private IEnumerable<CarouselItem> matchItems(IEnumerable<CarouselItem> items, FilterCriteria criteria)
{
int countMatching = 0;
foreach (var item in items)
{
var beatmap = (BeatmapInfo)item.Model;
if (checkMatch(beatmap, criteria))
{
BeatmapItemsCount++;
countMatching++;
yield return item;
}
}
BeatmapItemsCount = countMatching;
}
private static bool checkMatch(BeatmapInfo beatmap, FilterCriteria criteria)