mirror of
https://github.com/ppy/osu.git
synced 2026-06-03 03:20:16 +08:00
Fix carousel filtering twice on entering song select
This commit is contained in:
@@ -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;
|
||||
|
||||
/// <summary>
|
||||
/// Total number of beatmap difficulties displayed with the filter.
|
||||
/// </summary>
|
||||
@@ -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<IEnumerable<CarouselItem>> FilterAsync(bool clearExistingPanels = false)
|
||||
{
|
||||
if (waitingForInitialCriteria)
|
||||
return Task.FromResult(Enumerable.Empty<CarouselItem>());
|
||||
|
||||
return base.FilterAsync(clearExistingPanels);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Drawable pooling
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user