1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 09:27:34 +08:00

Merge pull request #17324 from frenzibyte/score-panel-max-combo

Display beatmap maximum combo next to score combo in results panel
This commit is contained in:
Dean Herbert 2022-03-18 22:59:38 +09:00 committed by GitHub
commit fc75aa0807
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 20 deletions

View File

@ -133,6 +133,7 @@ namespace osu.Game.Tests.Resources
StarRating = diff, StarRating = diff,
Length = length, Length = length,
BPM = bpm, BPM = bpm,
MaxCombo = 1000,
Hash = Guid.NewGuid().ToString().ComputeMD5Hash(), Hash = Guid.NewGuid().ToString().ComputeMD5Hash(),
Ruleset = rulesetInfo, Ruleset = rulesetInfo,
Metadata = metadata, Metadata = metadata,

View File

@ -122,19 +122,33 @@ namespace osu.Game.Rulesets.Scoring
public static class HitResultExtensions public static class HitResultExtensions
{ {
/// <summary> /// <summary>
/// Whether a <see cref="HitResult"/> increases/decreases the combo, and affects the combo portion of the score. /// Whether a <see cref="HitResult"/> increases the combo.
/// </summary> /// </summary>
public static bool AffectsCombo(this HitResult result) public static bool IncreasesCombo(this HitResult result)
{ {
switch (result) switch (result)
{ {
case HitResult.Miss:
case HitResult.Meh: case HitResult.Meh:
case HitResult.Ok: case HitResult.Ok:
case HitResult.Good: case HitResult.Good:
case HitResult.Great: case HitResult.Great:
case HitResult.Perfect: case HitResult.Perfect:
case HitResult.LargeTickHit: case HitResult.LargeTickHit:
return true;
default:
return false;
}
}
/// <summary>
/// Whether a <see cref="HitResult"/> breaks the combo and resets it back to zero.
/// </summary>
public static bool BreaksCombo(this HitResult result)
{
switch (result)
{
case HitResult.Miss:
case HitResult.LargeTickMiss: case HitResult.LargeTickMiss:
return true; return true;
@ -143,6 +157,12 @@ namespace osu.Game.Rulesets.Scoring
} }
} }
/// <summary>
/// Whether a <see cref="HitResult"/> increases/breaks the combo, and affects the combo portion of the score.
/// </summary>
public static bool AffectsCombo(this HitResult result)
=> IncreasesCombo(result) || BreaksCombo(result);
/// <summary> /// <summary>
/// Whether a <see cref="HitResult"/> affects the accuracy portion of the score. /// Whether a <see cref="HitResult"/> affects the accuracy portion of the score.
/// </summary> /// </summary>

View File

@ -166,20 +166,10 @@ namespace osu.Game.Rulesets.Scoring
if (!result.Type.IsScorable()) if (!result.Type.IsScorable())
return; return;
if (result.Type.AffectsCombo()) if (result.Type.IncreasesCombo())
{ Combo.Value++;
switch (result.Type) else if (result.Type.BreaksCombo())
{ Combo.Value = 0;
case HitResult.Miss:
case HitResult.LargeTickMiss:
Combo.Value = 0;
break;
default:
Combo.Value++;
break;
}
}
double scoreIncrease = result.Type.IsHit() ? result.Judgement.NumericResultFor(result) : 0; double scoreIncrease = result.Type.IsHit() ? result.Judgement.NumericResultFor(result) : 0;

View File

@ -68,7 +68,7 @@ namespace osu.Game.Screens.Ranking.Expanded
var topStatistics = new List<StatisticDisplay> var topStatistics = new List<StatisticDisplay>
{ {
new AccuracyStatistic(score.Accuracy), new AccuracyStatistic(score.Accuracy),
new ComboStatistic(score.MaxCombo, !score.Statistics.TryGetValue(HitResult.Miss, out int missCount) || missCount == 0), new ComboStatistic(score.MaxCombo, beatmap.MaxCombo, score.Statistics.All(stat => !stat.Key.BreaksCombo() || stat.Value == 0)),
new PerformanceStatistic(score), new PerformanceStatistic(score),
}; };

View File

@ -25,9 +25,10 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
/// Creates a new <see cref="ComboStatistic"/>. /// Creates a new <see cref="ComboStatistic"/>.
/// </summary> /// </summary>
/// <param name="combo">The combo to be displayed.</param> /// <param name="combo">The combo to be displayed.</param>
/// <param name="maxCombo">The maximum value of <paramref name="combo"/>.</param>
/// <param name="isPerfect">Whether this is a perfect combo.</param> /// <param name="isPerfect">Whether this is a perfect combo.</param>
public ComboStatistic(int combo, bool isPerfect) public ComboStatistic(int combo, int? maxCombo, bool isPerfect)
: base("combo", combo) : base("combo", combo, maxCombo)
{ {
this.isPerfect = isPerfect; this.isPerfect = isPerfect;
} }