From ef8fd7b5d71a68cff64e5dc1028031cb488acc4d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 29 May 2025 01:22:22 +0900 Subject: [PATCH] SongSelectV2: Fix incorrect conditional being used for "split out" check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤦 Have inlined the v1 usage so we don't accidentally do this again. --- osu.Game/Screens/Select/BeatmapCarousel.cs | 5 +++-- osu.Game/Screens/Select/FilterCriteria.cs | 5 ----- osu.Game/Screens/SelectV2/BeatmapCarousel.cs | 9 +-------- .../Screens/SelectV2/BeatmapCarouselFilterGrouping.cs | 7 ++++++- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index a807fc6a34..c474b36a89 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -28,6 +28,7 @@ using osu.Game.Extensions; using osu.Game.Graphics.Containers; using osu.Game.Input.Bindings; using osu.Game.Screens.Select.Carousel; +using osu.Game.Screens.Select.Filter; using osuTK; using osuTK.Input; @@ -123,7 +124,7 @@ namespace osu.Game.Screens.Select private void loadNewRoot() { - beatmapsSplitOut = activeCriteria.SplitOutDifficulties; + beatmapsSplitOut = activeCriteria.Sort == SortMode.Difficulty; // Ensure no changes are made to the list while we are initialising items. // We'll catch up on changes via subscriptions anyway. @@ -656,7 +657,7 @@ namespace osu.Game.Screens.Select { PendingFilter = null; - if (activeCriteria.SplitOutDifficulties != beatmapsSplitOut) + if ((activeCriteria.Sort == SortMode.Difficulty) != beatmapsSplitOut) { loadNewRoot(); return; diff --git a/osu.Game/Screens/Select/FilterCriteria.cs b/osu.Game/Screens/Select/FilterCriteria.cs index 15cb3c5104..cc8a92c7c7 100644 --- a/osu.Game/Screens/Select/FilterCriteria.cs +++ b/osu.Game/Screens/Select/FilterCriteria.cs @@ -20,11 +20,6 @@ namespace osu.Game.Screens.Select public GroupMode Group; public SortMode Sort; - /// - /// Whether the display of beatmap sets should be split apart per-difficulty for the current criteria. - /// - public bool SplitOutDifficulties => Sort == SortMode.Difficulty; - public BeatmapSetInfo? SelectedBeatmapSet; public OptionalRange StarDifficulty; diff --git a/osu.Game/Screens/SelectV2/BeatmapCarousel.cs b/osu.Game/Screens/SelectV2/BeatmapCarousel.cs index e7a410130a..e007ae54ce 100644 --- a/osu.Game/Screens/SelectV2/BeatmapCarousel.cs +++ b/osu.Game/Screens/SelectV2/BeatmapCarousel.cs @@ -471,16 +471,9 @@ namespace osu.Game.Screens.SelectV2 private ScheduledDelegate? loadingDebounce; - /// - /// We need to track this state locally since `FilterCriteria` is passed by reference and not accurate. - /// It should really be a struct. - /// - private bool splitOutDifficulties; - public void Filter(FilterCriteria criteria) { - bool resetDisplay = criteria.SplitOutDifficulties != splitOutDifficulties; - splitOutDifficulties = criteria.SplitOutDifficulties; + bool resetDisplay = grouping.BeatmapSetsGroupedTogether != BeatmapCarouselFilterGrouping.ShouldGroupBeatmapsTogether(criteria); Criteria = criteria; diff --git a/osu.Game/Screens/SelectV2/BeatmapCarouselFilterGrouping.cs b/osu.Game/Screens/SelectV2/BeatmapCarouselFilterGrouping.cs index f35169e76b..86256ad99e 100644 --- a/osu.Game/Screens/SelectV2/BeatmapCarouselFilterGrouping.cs +++ b/osu.Game/Screens/SelectV2/BeatmapCarouselFilterGrouping.cs @@ -48,7 +48,7 @@ namespace osu.Game.Screens.SelectV2 var criteria = getCriteria(); var newItems = new List(); - BeatmapSetsGroupedTogether = criteria.Sort != SortMode.Difficulty && criteria.Group != GroupMode.Difficulty; + BeatmapSetsGroupedTogether = ShouldGroupBeatmapsTogether(criteria); var groups = getGroups((List)items, criteria); @@ -122,6 +122,11 @@ namespace osu.Game.Screens.SelectV2 }, cancellationToken).ConfigureAwait(false); } + public static bool ShouldGroupBeatmapsTogether(FilterCriteria criteria) + { + return criteria.Sort != SortMode.Difficulty && criteria.Group != GroupMode.Difficulty; + } + private List getGroups(List items, FilterCriteria criteria) { switch (criteria.Group)