1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-31 18:31:01 +08:00

Code quality fixes

This commit is contained in:
Dean Herbert
2025-05-22 22:41:11 +09:00
Unverified
parent aacb1ea58d
commit 41feba120b
4 changed files with 9 additions and 5 deletions
@@ -47,6 +47,8 @@ namespace osu.Game.Tests.Visual.SongSelectV2
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Aquamarine);
public Func<IEnumerable<BeatmapInfo>, BeatmapInfo>? BeatmapRecommendationFunction { get; set; }
private OsuTextFlowContainer stats = null!;
private int beatmapCount;
@@ -69,6 +71,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
{
AddStep("create components", () =>
{
BeatmapRecommendationFunction = null;
NewItemsPresentedInvocationCount = 0;
Box topBox;
@@ -105,6 +108,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
Carousel = new TestBeatmapCarousel
{
NewItemsPresented = () => NewItemsPresentedInvocationCount++,
ChooseRecommendedBeatmap = beatmaps => BeatmapRecommendationFunction?.Invoke(beatmaps) ?? beatmaps.First(),
BleedTop = 50,
BleedBottom = 50,
Anchor = Anchor.Centre,
@@ -267,7 +267,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
AddBeatmaps(5, 3);
WaitForDrawablePanels();
AddStep("set recommendation algorithm", () => Carousel.GetRecommendedBeatmap = beatmaps => beatmaps.Last());
AddStep("set recommendation algorithm", () => BeatmapRecommendationFunction = beatmaps => beatmaps.Last());
SelectPrevGroup();
+3 -3
View File
@@ -27,9 +27,9 @@ namespace osu.Game.Screens.SelectV2
public Action<BeatmapInfo>? RequestPresentBeatmap { private get; init; }
/// <summary>
/// Accepts a list of beatmaps and returns the beatmap recommended for the user.
/// From the provided beatmaps, return the most appropriate one for the user's skill.
/// </summary>
public Func<IEnumerable<BeatmapInfo>, BeatmapInfo>? GetRecommendedBeatmap { private get; set; }
public Func<IEnumerable<BeatmapInfo>, BeatmapInfo>? ChooseRecommendedBeatmap { private get; init; }
public const float SPACING = 3f;
@@ -190,7 +190,7 @@ namespace osu.Game.Screens.SelectV2
if (grouping.SetItems.TryGetValue(setInfo, out var items))
{
var beatmaps = items.Select(i => i.Model).OfType<BeatmapInfo>();
CurrentSelection = GetRecommendedBeatmap?.Invoke(beatmaps) ?? beatmaps.First();
CurrentSelection = ChooseRecommendedBeatmap?.Invoke(beatmaps) ?? beatmaps.First();
}
return;
+1 -1
View File
@@ -165,7 +165,7 @@ namespace osu.Game.Screens.SelectV2
BleedTop = FilterControl.HEIGHT_FROM_SCREEN_TOP + 5,
BleedBottom = ScreenFooter.HEIGHT + 5,
RequestPresentBeatmap = _ => OnStart(),
GetRecommendedBeatmap = getRecommendedBeatmap,
ChooseRecommendedBeatmap = getRecommendedBeatmap,
NewItemsPresented = newItemsPresented,
RelativeSizeAxes = Axes.Both,
},