1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-18 11:43:22 +08:00

Apply NRT to incoming changed files

This commit is contained in:
Joseph Madamba 2024-12-10 15:02:41 -08:00
parent 88241d5b95
commit 3035e8435d
No known key found for this signature in database
GPG Key ID: 8B746C7BDDF0BD76
3 changed files with 12 additions and 20 deletions

View File

@ -1,12 +1,9 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
#nullable disable
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using JetBrains.Annotations;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Extensions.ObjectExtensions;
@ -26,7 +23,7 @@ namespace osu.Game.Beatmaps
private readonly LocalUserStatisticsProvider statisticsProvider; private readonly LocalUserStatisticsProvider statisticsProvider;
[Resolved] [Resolved]
private Bindable<RulesetInfo> gameRuleset { get; set; } private Bindable<RulesetInfo> gameRuleset { get; set; } = null!;
[Resolved] [Resolved]
private RulesetStore rulesets { get; set; } = null!; private RulesetStore rulesets { get; set; } = null!;
@ -90,15 +87,14 @@ namespace osu.Game.Beatmaps
/// </remarks> /// </remarks>
/// <param name="beatmaps">A collection of beatmaps to select a difficulty from.</param> /// <param name="beatmaps">A collection of beatmaps to select a difficulty from.</param>
/// <returns>The recommended difficulty, or null if a recommendation could not be provided.</returns> /// <returns>The recommended difficulty, or null if a recommendation could not be provided.</returns>
[CanBeNull] public BeatmapInfo? GetRecommendedBeatmap(IEnumerable<BeatmapInfo> beatmaps)
public BeatmapInfo GetRecommendedBeatmap(IEnumerable<BeatmapInfo> beatmaps)
{ {
foreach (string r in orderedRulesets) foreach (string r in orderedRulesets)
{ {
if (!recommendedDifficultyMapping.TryGetValue(r, out double recommendation)) if (!recommendedDifficultyMapping.TryGetValue(r, out double recommendation))
continue; continue;
BeatmapInfo beatmapInfo = beatmaps.Where(b => b.Ruleset.ShortName.Equals(r, StringComparison.Ordinal)).MinBy(b => BeatmapInfo? beatmapInfo = beatmaps.Where(b => b.Ruleset.ShortName.Equals(r, StringComparison.Ordinal)).MinBy(b =>
{ {
double difference = b.StarRating - recommendation; double difference = b.StarRating - recommendation;
return difference >= 0 ? difference * 2 : difference * -1; // prefer easier over harder return difference >= 0 ? difference * 2 : difference * -1; // prefer easier over harder

View File

@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
#nullable disable
using System; using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
@ -29,7 +27,7 @@ namespace osu.Game.Overlays.BeatmapListing
/// <summary> /// <summary>
/// Any time the text box receives key events (even while masked). /// Any time the text box receives key events (even while masked).
/// </summary> /// </summary>
public Action TypingStarted; public Action? TypingStarted;
public Bindable<string> Query => textBox.Current; public Bindable<string> Query => textBox.Current;
@ -51,7 +49,7 @@ namespace osu.Game.Overlays.BeatmapListing
public Bindable<SearchExplicit> ExplicitContent => explicitContentFilter.Current; public Bindable<SearchExplicit> ExplicitContent => explicitContentFilter.Current;
public APIBeatmapSet BeatmapSet public APIBeatmapSet? BeatmapSet
{ {
set set
{ {
@ -151,7 +149,7 @@ namespace osu.Game.Overlays.BeatmapListing
categoryFilter.Current.Value = SearchCategory.Leaderboard; categoryFilter.Current.Value = SearchCategory.Leaderboard;
} }
private IBindable<bool> allowExplicitContent; private IBindable<bool> allowExplicitContent = null!;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider, OsuConfigManager config) private void load(OverlayColourProvider colourProvider, OsuConfigManager config)
@ -172,7 +170,7 @@ namespace osu.Game.Overlays.BeatmapListing
/// <summary> /// <summary>
/// Any time the text box receives key events (even while masked). /// Any time the text box receives key events (even while masked).
/// </summary> /// </summary>
public Action TextChanged; public Action? TextChanged;
protected override Color4 SelectionColour => Color4.Gray; protected override Color4 SelectionColour => Color4.Gray;

View File

@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
#nullable disable
using System; using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
@ -40,7 +38,7 @@ namespace osu.Game.Overlays.BeatmapListing
private partial class FeaturedArtistsTabItem : MultipleSelectionFilterTabItem private partial class FeaturedArtistsTabItem : MultipleSelectionFilterTabItem
{ {
private Bindable<bool> disclaimerShown; private Bindable<bool> disclaimerShown = null!;
public FeaturedArtistsTabItem() public FeaturedArtistsTabItem()
: base(SearchGeneral.FeaturedArtists) : base(SearchGeneral.FeaturedArtists)
@ -48,13 +46,13 @@ namespace osu.Game.Overlays.BeatmapListing
} }
[Resolved] [Resolved]
private OsuColour colours { get; set; } private OsuColour colours { get; set; } = null!;
[Resolved] [Resolved]
private SessionStatics sessionStatics { get; set; } private SessionStatics sessionStatics { get; set; } = null!;
[Resolved(canBeNull: true)] [Resolved]
private IDialogOverlay dialogOverlay { get; set; } private IDialogOverlay? dialogOverlay { get; set; }
protected override void LoadComplete() protected override void LoadComplete()
{ {