Also move `GetMaxAchievableCombo`

This commit is contained in:
Dean Herbert 2023-06-16 15:26:13 +09:00
parent ce41ef6e5d
commit 362aa4b376
3 changed files with 9 additions and 10 deletions

View File

@ -1,11 +1,10 @@
// 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.
#nullable disable
using System.Collections.Generic;
using System.Linq;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Scoring
{
@ -26,5 +25,12 @@ public static IEnumerable<ScoreInfo> OrderByTotalScore(this IEnumerable<ScoreInf
.ThenBy(s => s.OnlineID)
// Local scores may not have an online ID. Fall back to date in these cases.
.ThenBy(s => s.Date);
/// <summary>
/// Retrieves the maximum achievable combo for the provided score.
/// </summary>
/// <param name="score">The <see cref="ScoreInfo"/> to compute the maximum achievable combo for.</param>
/// <returns>The maximum achievable combo.</returns>
public static int GetMaximumAchievableCombo(this ScoreInfo score) => score.MaximumStatistics.Where(kvp => kvp.Key.AffectsCombo()).Sum(kvp => kvp.Value);
}
}

View File

@ -89,13 +89,6 @@ public ScoreInfo Query(Expression<Func<ScoreInfo, bool>> query)
/// <returns>The bindable containing the formatted total score string.</returns>
public Bindable<string> GetBindableTotalScoreString([NotNull] ScoreInfo score) => new TotalScoreStringBindable(GetBindableTotalScore(score));
/// <summary>
/// Retrieves the maximum achievable combo for the provided score.
/// </summary>
/// <param name="score">The <see cref="ScoreInfo"/> to compute the maximum achievable combo for.</param>
/// <returns>The maximum achievable combo.</returns>
public int GetMaximumAchievableCombo([NotNull] ScoreInfo score) => score.MaximumStatistics.Where(kvp => kvp.Key.AffectsCombo()).Sum(kvp => kvp.Value);
/// <summary>
/// Provides the total score of a <see cref="ScoreInfo"/>. Responds to changes in the currently-selected <see cref="ScoringMode"/>.
/// </summary>

View File

@ -73,7 +73,7 @@ private void load(BeatmapDifficultyCache beatmapDifficultyCache)
var topStatistics = new List<StatisticDisplay>
{
new AccuracyStatistic(score.Accuracy),
new ComboStatistic(score.MaxCombo, scoreManager.GetMaximumAchievableCombo(score)),
new ComboStatistic(score.MaxCombo, score.GetMaximumAchievableCombo()),
new PerformanceStatistic(score),
};