From 526ee32268fd74a65ebe42fe53bcdb9cfe32fe12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 29 Aug 2025 09:54:42 +0200 Subject: [PATCH] Apply suggested rename --- .../Navigation/TestScenePresentBeatmap.cs | 2 +- .../BeatmapCarouselFilterGroupingTest.cs | 2 +- .../SongSelectV2/BeatmapCarouselTestScene.cs | 4 +- .../TestSceneBeatmapCarouselFiltering.cs | 8 +-- .../Visual/SongSelectV2/TestScenePanelSet.cs | 8 +-- .../TestSceneSongSelectGrouping.cs | 2 +- osu.Game/Screens/SelectV2/BeatmapCarousel.cs | 62 +++++++++---------- .../SelectV2/BeatmapCarouselFilterGrouping.cs | 16 ++--- osu.Game/Screens/SelectV2/PanelBeatmapSet.cs | 10 +-- 9 files changed, 57 insertions(+), 57 deletions(-) diff --git a/osu.Game.Tests/Visual/Navigation/TestScenePresentBeatmap.cs b/osu.Game.Tests/Visual/Navigation/TestScenePresentBeatmap.cs index 6092bdde3a..1dd39e5bf9 100644 --- a/osu.Game.Tests/Visual/Navigation/TestScenePresentBeatmap.cs +++ b/osu.Game.Tests/Visual/Navigation/TestScenePresentBeatmap.cs @@ -181,7 +181,7 @@ namespace osu.Game.Tests.Visual.Navigation AddUntilStep("beatmap in song select", () => { var songSelect = (SoloSongSelect)Game.ScreenStack.CurrentScreen; - return songSelect.ChildrenOfType().Single().GetCarouselItems()!.Any(i => i.Model is BeatmapSetUnderGrouping bsug && bsug.BeatmapSet.MatchesOnlineID(getImport())); + return songSelect.ChildrenOfType().Single().GetCarouselItems()!.Any(i => i.Model is GroupedBeatmapSet gbs && gbs.BeatmapSet.MatchesOnlineID(getImport())); }); } diff --git a/osu.Game.Tests/Visual/SongSelectV2/BeatmapCarouselFilterGroupingTest.cs b/osu.Game.Tests/Visual/SongSelectV2/BeatmapCarouselFilterGroupingTest.cs index efd4eb7b03..32a7b89424 100644 --- a/osu.Game.Tests/Visual/SongSelectV2/BeatmapCarouselFilterGroupingTest.cs +++ b/osu.Game.Tests/Visual/SongSelectV2/BeatmapCarouselFilterGroupingTest.cs @@ -42,7 +42,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2 ]; var results = await runGrouping(GroupMode.None, beatmapSets); - Assert.That(results.Select(r => r.Model).OfType().Select(setUnderGrouping => setUnderGrouping.BeatmapSet), Is.EquivalentTo(beatmapSets)); + Assert.That(results.Select(r => r.Model).OfType().Select(groupedSet => groupedSet.BeatmapSet), Is.EquivalentTo(beatmapSets)); Assert.That(results.Select(r => r.Model).OfType(), Is.EquivalentTo(allBeatmaps)); assertTotal(results, beatmapSets.Count + allBeatmaps.Length); } diff --git a/osu.Game.Tests/Visual/SongSelectV2/BeatmapCarouselTestScene.cs b/osu.Game.Tests/Visual/SongSelectV2/BeatmapCarouselTestScene.cs index 2664062fc2..f18e1e9b52 100644 --- a/osu.Game.Tests/Visual/SongSelectV2/BeatmapCarouselTestScene.cs +++ b/osu.Game.Tests/Visual/SongSelectV2/BeatmapCarouselTestScene.cs @@ -237,7 +237,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2 // Using groupingFilter.SetItems.Count alone doesn't work. // When sorting by difficulty, there can be more than one set panel for the same set displayed. - return groupingFilter.SetItems.Sum(s => s.Value.Count(i => i.Model is BeatmapSetUnderGrouping)); + return groupingFilter.SetItems.Sum(s => s.Value.Count(i => i.Model is GroupedBeatmapSet)); }, () => Is.EqualTo(expected)); } @@ -440,7 +440,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2 public BeatmapInfo? SelectedBeatmapInfo => CurrentSelection as BeatmapInfo; public BeatmapSetInfo? SelectedBeatmapSet => SelectedBeatmapInfo?.BeatmapSet; - public new BeatmapSetUnderGrouping? ExpandedBeatmapSet => base.ExpandedBeatmapSet; + public new GroupedBeatmapSet? ExpandedBeatmapSet => base.ExpandedBeatmapSet; public new GroupDefinition? ExpandedGroup => base.ExpandedGroup; public TestBeatmapCarousel() diff --git a/osu.Game.Tests/Visual/SongSelectV2/TestSceneBeatmapCarouselFiltering.cs b/osu.Game.Tests/Visual/SongSelectV2/TestSceneBeatmapCarouselFiltering.cs index d599c07f27..687c4c23be 100644 --- a/osu.Game.Tests/Visual/SongSelectV2/TestSceneBeatmapCarouselFiltering.cs +++ b/osu.Game.Tests/Visual/SongSelectV2/TestSceneBeatmapCarouselFiltering.cs @@ -397,7 +397,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2 SelectNextPanel(); AddAssert("keyboard selected is first set", - () => (GetKeyboardSelectedPanel()?.Item?.Model as BeatmapSetUnderGrouping)?.BeatmapSet, + () => (GetKeyboardSelectedPanel()?.Item?.Model as GroupedBeatmapSet)?.BeatmapSet, () => Is.EqualTo(BeatmapSets.First())); } @@ -416,7 +416,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2 SelectPrevPanel(); AddAssert("keyboard selected is last set", - () => (GetKeyboardSelectedPanel()?.Item?.Model as BeatmapSetUnderGrouping)?.BeatmapSet, + () => (GetKeyboardSelectedPanel()?.Item?.Model as GroupedBeatmapSet)?.BeatmapSet, () => Is.EqualTo(BeatmapSets.Last())); } @@ -433,7 +433,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2 SelectPrevPanel(); AddAssert("keyboard selected is first set", - () => (GetKeyboardSelectedPanel()?.Item?.Model as BeatmapSetUnderGrouping)?.BeatmapSet, + () => (GetKeyboardSelectedPanel()?.Item?.Model as GroupedBeatmapSet)?.BeatmapSet, () => Is.EqualTo(BeatmapSets.First())); } @@ -451,7 +451,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2 // Single result is automatically selected for us, so we iterate once backwards to the set header. SelectPrevPanel(); AddAssert("keyboard selected is second set", - () => (GetKeyboardSelectedPanel()?.Item?.Model as BeatmapSetUnderGrouping)?.BeatmapSet, + () => (GetKeyboardSelectedPanel()?.Item?.Model as GroupedBeatmapSet)?.BeatmapSet, () => Is.EqualTo(BeatmapSets.Last())); } } diff --git a/osu.Game.Tests/Visual/SongSelectV2/TestScenePanelSet.cs b/osu.Game.Tests/Visual/SongSelectV2/TestScenePanelSet.cs index 6a212381a8..b574262d55 100644 --- a/osu.Game.Tests/Visual/SongSelectV2/TestScenePanelSet.cs +++ b/osu.Game.Tests/Visual/SongSelectV2/TestScenePanelSet.cs @@ -75,21 +75,21 @@ namespace osu.Game.Tests.Visual.SongSelectV2 { new PanelBeatmapSet { - Item = new CarouselItem(new BeatmapSetUnderGrouping(null, beatmapSet)) + Item = new CarouselItem(new GroupedBeatmapSet(null, beatmapSet)) }, new PanelBeatmapSet { - Item = new CarouselItem(new BeatmapSetUnderGrouping(null, beatmapSet)), + Item = new CarouselItem(new GroupedBeatmapSet(null, beatmapSet)), KeyboardSelected = { Value = true } }, new PanelBeatmapSet { - Item = new CarouselItem(new BeatmapSetUnderGrouping(null, beatmapSet)), + Item = new CarouselItem(new GroupedBeatmapSet(null, beatmapSet)), Expanded = { Value = true } }, new PanelBeatmapSet { - Item = new CarouselItem(new BeatmapSetUnderGrouping(null, beatmapSet)), + Item = new CarouselItem(new GroupedBeatmapSet(null, beatmapSet)), KeyboardSelected = { Value = true }, Expanded = { Value = true } }, diff --git a/osu.Game.Tests/Visual/SongSelectV2/TestSceneSongSelectGrouping.cs b/osu.Game.Tests/Visual/SongSelectV2/TestSceneSongSelectGrouping.cs index be7f705532..0772607a57 100644 --- a/osu.Game.Tests/Visual/SongSelectV2/TestSceneSongSelectGrouping.cs +++ b/osu.Game.Tests/Visual/SongSelectV2/TestSceneSongSelectGrouping.cs @@ -94,7 +94,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2 AddAssert("no-collection group present", () => { var group = grouping.GroupItems.Single(g => g.Key.Title == "Not in collection"); - return group.Value.Select(i => i.Model).OfType().Single().BeatmapSet.Equals(beatmapSet); + return group.Value.Select(i => i.Model).OfType().Single().BeatmapSet.Equals(beatmapSet); }); AddStep("add beatmap to collection", () => diff --git a/osu.Game/Screens/SelectV2/BeatmapCarousel.cs b/osu.Game/Screens/SelectV2/BeatmapCarousel.cs index 95fb26c6dd..22079ea91f 100644 --- a/osu.Game/Screens/SelectV2/BeatmapCarousel.cs +++ b/osu.Game/Screens/SelectV2/BeatmapCarousel.cs @@ -70,11 +70,11 @@ namespace osu.Game.Screens.SelectV2 if (grouping.BeatmapSetsGroupedTogether) { // Give some space around the expanded beatmap set, at the top.. - if (bottom.Model is BeatmapSetUnderGrouping && bottom.IsExpanded) + if (bottom.Model is GroupedBeatmapSet && bottom.IsExpanded) return SPACING * 2; // ..and the bottom. - if (top.Model is BeatmapInfo && bottom.Model is BeatmapSetUnderGrouping) + if (top.Model is BeatmapInfo && bottom.Model is GroupedBeatmapSet) return SPACING * 2; // Beatmap difficulty panels do not overlap with themselves or any other panel. @@ -207,12 +207,12 @@ namespace osu.Game.Screens.SelectV2 return true; } - if (item.Model is BeatmapSetUnderGrouping setUnderGrouping) + if (item.Model is GroupedBeatmapSet groupedSet) { - if (oldItems.Contains(setUnderGrouping.BeatmapSet)) + if (oldItems.Contains(groupedSet.BeatmapSet)) return false; - RequestRecommendedSelection(setUnderGrouping.BeatmapSet.Beatmaps); + RequestRecommendedSelection(groupedSet.BeatmapSet.Beatmaps); return true; } } @@ -283,7 +283,7 @@ namespace osu.Game.Screens.SelectV2 protected GroupDefinition? ExpandedGroup { get; private set; } - protected BeatmapSetUnderGrouping? ExpandedBeatmapSet { get; private set; } + protected GroupedBeatmapSet? ExpandedBeatmapSet { get; private set; } protected override bool ShouldActivateOnKeyboardSelection(CarouselItem item) => grouping.BeatmapSetsGroupedTogether && item.Model is BeatmapInfo; @@ -311,8 +311,8 @@ namespace osu.Game.Screens.SelectV2 return; - case BeatmapSetUnderGrouping setUnderGrouping: - selectRecommendedDifficultyForBeatmapSet(setUnderGrouping); + case GroupedBeatmapSet groupedSet: + selectRecommendedDifficultyForBeatmapSet(groupedSet); return; case BeatmapInfo beatmapInfo: @@ -338,7 +338,7 @@ namespace osu.Game.Screens.SelectV2 switch (model) { - case BeatmapSetUnderGrouping: + case GroupedBeatmapSet: case GroupDefinition: throw new InvalidOperationException("Groups should never become selected"); @@ -349,7 +349,7 @@ namespace osu.Game.Screens.SelectV2 setExpandedGroup(containingGroup); if (grouping.BeatmapSetsGroupedTogether) - setExpandedSet(new BeatmapSetUnderGrouping(containingGroup, beatmapInfo.BeatmapSet!)); + setExpandedSet(new GroupedBeatmapSet(containingGroup, beatmapInfo.BeatmapSet!)); break; } } @@ -373,10 +373,10 @@ namespace osu.Game.Screens.SelectV2 setExpandedGroup(groupForReselection); } - private void selectRecommendedDifficultyForBeatmapSet(BeatmapSetUnderGrouping setUnderGrouping) + private void selectRecommendedDifficultyForBeatmapSet(GroupedBeatmapSet set) { // Selecting a set isn't valid – let's re-select the first visible difficulty. - if (grouping.SetItems.TryGetValue(setUnderGrouping, out var items)) + if (grouping.SetItems.TryGetValue(set, out var items)) { var beatmaps = items.Select(i => i.Model).OfType(); RequestRecommendedSelection(beatmaps); @@ -424,7 +424,7 @@ namespace osu.Game.Screens.SelectV2 { switch (item.Model) { - case BeatmapSetUnderGrouping: + case GroupedBeatmapSet: return true; case BeatmapInfo: @@ -463,11 +463,11 @@ namespace osu.Game.Screens.SelectV2 i.IsExpanded = true; break; - case BeatmapSetUnderGrouping setUnderGrouping: + case GroupedBeatmapSet groupedSet: // Case where there are set headers, header should be visible // and items should use the set's expanded state. i.IsVisible = true; - setExpansionStateOfSetItems(setUnderGrouping, i.IsExpanded); + setExpansionStateOfSetItems(groupedSet, i.IsExpanded); break; default: @@ -497,21 +497,21 @@ namespace osu.Game.Screens.SelectV2 } } - private void setExpandedSet(BeatmapSetUnderGrouping setUnderGrouping) + private void setExpandedSet(GroupedBeatmapSet set) { if (ExpandedBeatmapSet != null) setExpansionStateOfSetItems(ExpandedBeatmapSet, false); - ExpandedBeatmapSet = setUnderGrouping; + ExpandedBeatmapSet = set; setExpansionStateOfSetItems(ExpandedBeatmapSet, true); } - private void setExpansionStateOfSetItems(BeatmapSetUnderGrouping set, bool expanded) + private void setExpansionStateOfSetItems(GroupedBeatmapSet set, bool expanded) { if (grouping.SetItems.TryGetValue(set, out var items)) { foreach (var i in items) { - if (i.Model is BeatmapSetUnderGrouping) + if (i.Model is GroupedBeatmapSet) i.IsExpanded = expanded; else i.IsVisible = expanded; @@ -549,7 +549,7 @@ namespace osu.Game.Screens.SelectV2 sampleToggleGroup?.Play(); return; - case BeatmapSetUnderGrouping: + case GroupedBeatmapSet: sampleChangeSet?.Play(); return; @@ -688,8 +688,8 @@ namespace osu.Game.Screens.SelectV2 // it is doing a Replace operation on the list. If it is, then check the local handling in beatmapSetsChanged // before changing matching requirements here. - if (x is BeatmapSetUnderGrouping setUnderGroupingX && y is BeatmapSetUnderGrouping setUnderGroupingY) - return setUnderGroupingX.Equals(setUnderGroupingY); + if (x is GroupedBeatmapSet groupedSetX && y is GroupedBeatmapSet groupedSetY) + return groupedSetX.Equals(groupedSetY); if (x is BeatmapInfo beatmapX && y is BeatmapInfo beatmapY) return beatmapX.Equals(beatmapY); @@ -719,7 +719,7 @@ namespace osu.Game.Screens.SelectV2 return beatmapPanelPool.Get(); - case BeatmapSetUnderGrouping: + case GroupedBeatmapSet: return setPanelPool.Get(); } @@ -829,31 +829,31 @@ namespace osu.Game.Screens.SelectV2 private bool nextRandomSet() { - ICollection visibleSetsUnderGrouping = ExpandedGroup != null + ICollection visibleSetsUnderGrouping = ExpandedGroup != null // In the case of grouping, users expect random to only operate on the expanded group. // This is going to incur some overhead as we don't have a group-beatmapset mapping currently. // // If this becomes an issue, we could either store a mapping, or run the random algorithm many times // using the `SetItems` method until we get a group HIT. - ? grouping.GroupItems[ExpandedGroup].Select(i => i.Model).OfType().ToArray() + ? grouping.GroupItems[ExpandedGroup].Select(i => i.Model).OfType().ToArray() // This is the fastest way to retrieve sets for randomisation. : grouping.SetItems.Keys; - BeatmapSetUnderGrouping set; + GroupedBeatmapSet set; switch (randomAlgorithm.Value) { case RandomSelectAlgorithm.RandomPermutation: { - ICollection notYetVisitedSets = - visibleSetsUnderGrouping.ExceptBy(previouslyVisitedRandomBeatmaps.Select(b => b.BeatmapSet!), setUnderGrouping => setUnderGrouping.BeatmapSet).ToList(); + ICollection notYetVisitedSets = + visibleSetsUnderGrouping.ExceptBy(previouslyVisitedRandomBeatmaps.Select(b => b.BeatmapSet!), groupedSet => groupedSet.BeatmapSet).ToList(); if (!notYetVisitedSets.Any()) { - previouslyVisitedRandomBeatmaps.RemoveAll(b => visibleSetsUnderGrouping.Any(setUnderGrouping => setUnderGrouping.BeatmapSet.Equals(b.BeatmapSet!))); + previouslyVisitedRandomBeatmaps.RemoveAll(b => visibleSetsUnderGrouping.Any(groupedSet => groupedSet.BeatmapSet.Equals(b.BeatmapSet!))); notYetVisitedSets = visibleSetsUnderGrouping; if (CurrentSelection is BeatmapInfo beatmapInfo) - notYetVisitedSets = notYetVisitedSets.ExceptBy([beatmapInfo.BeatmapSet!], setUnderGrouping => setUnderGrouping.BeatmapSet).ToList(); + notYetVisitedSets = notYetVisitedSets.ExceptBy([beatmapInfo.BeatmapSet!], groupedSet => groupedSet.BeatmapSet).ToList(); } if (notYetVisitedSets.Count == 0) @@ -966,5 +966,5 @@ namespace osu.Game.Screens.SelectV2 /// Used to represent a portion of a under a . /// The purpose of this model is to support splitting beatmap sets apart when the active grouping mode demands it. /// - public record BeatmapSetUnderGrouping([UsedImplicitly] GroupDefinition? Group, BeatmapSetInfo BeatmapSet); + public record GroupedBeatmapSet([UsedImplicitly] GroupDefinition? Group, BeatmapSetInfo BeatmapSet); } diff --git a/osu.Game/Screens/SelectV2/BeatmapCarouselFilterGrouping.cs b/osu.Game/Screens/SelectV2/BeatmapCarouselFilterGrouping.cs index 63bc94b087..0d2489c304 100644 --- a/osu.Game/Screens/SelectV2/BeatmapCarouselFilterGrouping.cs +++ b/osu.Game/Screens/SelectV2/BeatmapCarouselFilterGrouping.cs @@ -29,14 +29,14 @@ namespace osu.Game.Screens.SelectV2 /// /// Beatmap sets contain difficulties as related panels. This dictionary holds the relationships between set-difficulties to allow expanding them on selection. /// - public IDictionary> SetItems => setMap; + public IDictionary> SetItems => setMap; /// /// Groups contain children which are group-selectable. This dictionary holds the relationships between groups-panels to allow expanding them on selection. /// public IDictionary> GroupItems => groupMap; - private Dictionary> setMap = new Dictionary>(); + private Dictionary> setMap = new Dictionary>(); private Dictionary> groupMap = new Dictionary>(); private readonly Func getCriteria; @@ -56,7 +56,7 @@ namespace osu.Game.Screens.SelectV2 return await Task.Run(() => { // preallocate space for the new mappings using last known estimates - var newSetMap = new Dictionary>(setMap.Count); + var newSetMap = new Dictionary>(setMap.Count); var newGroupMap = new Dictionary>(groupMap.Count); var criteria = getCriteria(); @@ -94,12 +94,12 @@ namespace osu.Game.Screens.SelectV2 var beatmap = (BeatmapInfo)item.Model; bool newBeatmapSet = lastBeatmap?.BeatmapSet!.ID != beatmap.BeatmapSet!.ID; - var beatmapSetUnderGrouping = new BeatmapSetUnderGrouping(group, beatmap.BeatmapSet!); + var groupedBeatmapSet = new GroupedBeatmapSet(group, beatmap.BeatmapSet!); if (newBeatmapSet) { - if (!newSetMap.TryGetValue(beatmapSetUnderGrouping, out currentSetItems)) - newSetMap[beatmapSetUnderGrouping] = currentSetItems = new HashSet(); + if (!newSetMap.TryGetValue(groupedBeatmapSet, out currentSetItems)) + newSetMap[groupedBeatmapSet] = currentSetItems = new HashSet(); } if (BeatmapSetsGroupedTogether) @@ -109,7 +109,7 @@ namespace osu.Game.Screens.SelectV2 if (groupItem != null) groupItem.NestedItemCount++; - addItem(new CarouselItem(beatmapSetUnderGrouping) + addItem(new CarouselItem(groupedBeatmapSet) { DrawHeight = PanelBeatmapSet.HEIGHT, DepthLayer = -1 @@ -136,7 +136,7 @@ namespace osu.Game.Screens.SelectV2 currentGroupItems?.Add(i); currentSetItems?.Add(i); - i.IsVisible = i.Model is GroupDefinition || (group == null && (i.Model is BeatmapSetUnderGrouping || !BeatmapSetsGroupedTogether)); + i.IsVisible = i.Model is GroupDefinition || (group == null && (i.Model is GroupedBeatmapSet || !BeatmapSetsGroupedTogether)); } } diff --git a/osu.Game/Screens/SelectV2/PanelBeatmapSet.cs b/osu.Game/Screens/SelectV2/PanelBeatmapSet.cs index 7b07076975..1a6e886cb7 100644 --- a/osu.Game/Screens/SelectV2/PanelBeatmapSet.cs +++ b/osu.Game/Screens/SelectV2/PanelBeatmapSet.cs @@ -67,12 +67,12 @@ namespace osu.Game.Screens.SelectV2 [Resolved] private IBindable ruleset { get; set; } = null!; - private BeatmapSetUnderGrouping beatmapSetUnderGrouping + private GroupedBeatmapSet groupedBeatmapSet { get { Debug.Assert(Item != null); - return (BeatmapSetUnderGrouping)Item!.Model; + return (GroupedBeatmapSet)Item!.Model; } } @@ -188,7 +188,7 @@ namespace osu.Game.Screens.SelectV2 { base.PrepareForUse(); - var beatmapSet = beatmapSetUnderGrouping.BeatmapSet; + var beatmapSet = groupedBeatmapSet.BeatmapSet; // Choice of background image matches BSS implementation (always uses the lowest `beatmap_id` from the set). setBackground.Beatmap = beatmaps.GetWorkingBeatmap(beatmapSet.Beatmaps.MinBy(b => b.OnlineID)); @@ -222,7 +222,7 @@ namespace osu.Game.Screens.SelectV2 if (Item == null) return Array.Empty(); - var beatmapSet = beatmapSetUnderGrouping.BeatmapSet; + var beatmapSet = groupedBeatmapSet.BeatmapSet; List items = new List(); @@ -275,7 +275,7 @@ namespace osu.Game.Screens.SelectV2 private MenuItem createCollectionMenuItem(BeatmapCollection collection) { - var beatmapSet = beatmapSetUnderGrouping.BeatmapSet; + var beatmapSet = groupedBeatmapSet.BeatmapSet; TernaryState state;