1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-19 13:20:16 +08:00

Apply suggested rename

This commit is contained in:
Bartłomiej Dach
2025-08-29 09:54:42 +02:00
Unverified
parent 6ba72fa481
commit 526ee32268
9 changed files with 57 additions and 57 deletions
@@ -181,7 +181,7 @@ namespace osu.Game.Tests.Visual.Navigation
AddUntilStep("beatmap in song select", () =>
{
var songSelect = (SoloSongSelect)Game.ScreenStack.CurrentScreen;
return songSelect.ChildrenOfType<BeatmapCarousel>().Single().GetCarouselItems()!.Any(i => i.Model is BeatmapSetUnderGrouping bsug && bsug.BeatmapSet.MatchesOnlineID(getImport()));
return songSelect.ChildrenOfType<BeatmapCarousel>().Single().GetCarouselItems()!.Any(i => i.Model is GroupedBeatmapSet gbs && gbs.BeatmapSet.MatchesOnlineID(getImport()));
});
}
@@ -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<BeatmapSetUnderGrouping>().Select(setUnderGrouping => setUnderGrouping.BeatmapSet), Is.EquivalentTo(beatmapSets));
Assert.That(results.Select(r => r.Model).OfType<GroupedBeatmapSet>().Select(groupedSet => groupedSet.BeatmapSet), Is.EquivalentTo(beatmapSets));
Assert.That(results.Select(r => r.Model).OfType<BeatmapInfo>(), Is.EquivalentTo(allBeatmaps));
assertTotal(results, beatmapSets.Count + allBeatmaps.Length);
}
@@ -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()
@@ -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()));
}
}
@@ -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 }
},
@@ -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<BeatmapSetUnderGrouping>().Single().BeatmapSet.Equals(beatmapSet);
return group.Value.Select(i => i.Model).OfType<GroupedBeatmapSet>().Single().BeatmapSet.Equals(beatmapSet);
});
AddStep("add beatmap to collection", () =>
+31 -31
View File
@@ -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<BeatmapInfo>();
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<BeatmapSetUnderGrouping> visibleSetsUnderGrouping = ExpandedGroup != null
ICollection<GroupedBeatmapSet> 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<BeatmapSetUnderGrouping>().ToArray()
? grouping.GroupItems[ExpandedGroup].Select(i => i.Model).OfType<GroupedBeatmapSet>().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<BeatmapSetUnderGrouping> notYetVisitedSets =
visibleSetsUnderGrouping.ExceptBy(previouslyVisitedRandomBeatmaps.Select(b => b.BeatmapSet!), setUnderGrouping => setUnderGrouping.BeatmapSet).ToList();
ICollection<GroupedBeatmapSet> 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 <see cref="BeatmapSetInfo"/> under a <see cref="GroupDefinition"/>.
/// The purpose of this model is to support splitting beatmap sets apart when the active grouping mode demands it.
/// </summary>
public record BeatmapSetUnderGrouping([UsedImplicitly] GroupDefinition? Group, BeatmapSetInfo BeatmapSet);
public record GroupedBeatmapSet([UsedImplicitly] GroupDefinition? Group, BeatmapSetInfo BeatmapSet);
}
@@ -29,14 +29,14 @@ namespace osu.Game.Screens.SelectV2
/// <summary>
/// Beatmap sets contain difficulties as related panels. This dictionary holds the relationships between set-difficulties to allow expanding them on selection.
/// </summary>
public IDictionary<BeatmapSetUnderGrouping, HashSet<CarouselItem>> SetItems => setMap;
public IDictionary<GroupedBeatmapSet, HashSet<CarouselItem>> SetItems => setMap;
/// <summary>
/// Groups contain children which are group-selectable. This dictionary holds the relationships between groups-panels to allow expanding them on selection.
/// </summary>
public IDictionary<GroupDefinition, HashSet<CarouselItem>> GroupItems => groupMap;
private Dictionary<BeatmapSetUnderGrouping, HashSet<CarouselItem>> setMap = new Dictionary<BeatmapSetUnderGrouping, HashSet<CarouselItem>>();
private Dictionary<GroupedBeatmapSet, HashSet<CarouselItem>> setMap = new Dictionary<GroupedBeatmapSet, HashSet<CarouselItem>>();
private Dictionary<GroupDefinition, HashSet<CarouselItem>> groupMap = new Dictionary<GroupDefinition, HashSet<CarouselItem>>();
private readonly Func<FilterCriteria> 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<BeatmapSetUnderGrouping, HashSet<CarouselItem>>(setMap.Count);
var newSetMap = new Dictionary<GroupedBeatmapSet, HashSet<CarouselItem>>(setMap.Count);
var newGroupMap = new Dictionary<GroupDefinition, HashSet<CarouselItem>>(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<CarouselItem>();
if (!newSetMap.TryGetValue(groupedBeatmapSet, out currentSetItems))
newSetMap[groupedBeatmapSet] = currentSetItems = new HashSet<CarouselItem>();
}
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));
}
}
+5 -5
View File
@@ -67,12 +67,12 @@ namespace osu.Game.Screens.SelectV2
[Resolved]
private IBindable<RulesetInfo> 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<MenuItem>();
var beatmapSet = beatmapSetUnderGrouping.BeatmapSet;
var beatmapSet = groupedBeatmapSet.BeatmapSet;
List<MenuItem> items = new List<MenuItem>();
@@ -275,7 +275,7 @@ namespace osu.Game.Screens.SelectV2
private MenuItem createCollectionMenuItem(BeatmapCollection collection)
{
var beatmapSet = beatmapSetUnderGrouping.BeatmapSet;
var beatmapSet = groupedBeatmapSet.BeatmapSet;
TernaryState state;