1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 18:27:26 +08:00

Merge pull request #11278 from peppy/frame-bundle-accuracy

This commit is contained in:
Bartłomiej Dach 2020-12-24 11:53:37 +01:00 committed by GitHub
commit dd97fcb43c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 13 deletions

View File

@ -14,6 +14,11 @@ namespace osu.Game.Online.Spectator
[Serializable] [Serializable]
public class FrameHeader public class FrameHeader
{ {
/// <summary>
/// The current accuracy of the score.
/// </summary>
public double Accuracy { get; set; }
/// <summary> /// <summary>
/// The current combo of the score. /// The current combo of the score.
/// </summary> /// </summary>
@ -42,16 +47,18 @@ namespace osu.Game.Online.Spectator
{ {
Combo = score.Combo; Combo = score.Combo;
MaxCombo = score.MaxCombo; MaxCombo = score.MaxCombo;
Accuracy = score.Accuracy;
// copy for safety // copy for safety
Statistics = new Dictionary<HitResult, int>(score.Statistics); Statistics = new Dictionary<HitResult, int>(score.Statistics);
} }
[JsonConstructor] [JsonConstructor]
public FrameHeader(int combo, int maxCombo, Dictionary<HitResult, int> statistics, DateTimeOffset receivedTime) public FrameHeader(int combo, int maxCombo, double accuracy, Dictionary<HitResult, int> statistics, DateTimeOffset receivedTime)
{ {
Combo = combo; Combo = combo;
MaxCombo = maxCombo; MaxCombo = maxCombo;
Accuracy = accuracy;
Statistics = statistics; Statistics = statistics;
ReceivedTime = receivedTime; ReceivedTime = receivedTime;
} }

View File

@ -193,7 +193,7 @@ namespace osu.Game.Rulesets.Scoring
private void updateScore() private void updateScore()
{ {
if (rollingMaxBaseScore != 0) if (rollingMaxBaseScore != 0)
Accuracy.Value = baseScore / rollingMaxBaseScore; Accuracy.Value = calculateAccuracyRatio(baseScore, true);
TotalScore.Value = getScore(Mode.Value); TotalScore.Value = getScore(Mode.Value);
} }
@ -233,13 +233,13 @@ namespace osu.Game.Rulesets.Scoring
} }
/// <summary> /// <summary>
/// Given a minimal set of inputs, return the computed score and accuracy for the tracked beatmap / mods combination, at the current point in time. /// Given a minimal set of inputs, return the computed score for the tracked beatmap / mods combination, at the current point in time.
/// </summary> /// </summary>
/// <param name="mode">The <see cref="ScoringMode"/> to compute the total score in.</param> /// <param name="mode">The <see cref="ScoringMode"/> to compute the total score in.</param>
/// <param name="maxCombo">The maximum combo achievable in the beatmap.</param> /// <param name="maxCombo">The maximum combo achievable in the beatmap.</param>
/// <param name="statistics">Statistics to be used for calculating accuracy, bonus score, etc.</param> /// <param name="statistics">Statistics to be used for calculating accuracy, bonus score, etc.</param>
/// <returns>The computed score and accuracy for provided inputs.</returns> /// <returns>The computed score for provided inputs.</returns>
public (double score, double accuracy) GetScoreAndAccuracy(ScoringMode mode, int maxCombo, Dictionary<HitResult, int> statistics) public double GetImmediateScore(ScoringMode mode, int maxCombo, Dictionary<HitResult, int> statistics)
{ {
// calculate base score from statistics pairs // calculate base score from statistics pairs
int computedBaseScore = 0; int computedBaseScore = 0;
@ -252,12 +252,7 @@ namespace osu.Game.Rulesets.Scoring
computedBaseScore += Judgement.ToNumericResult(pair.Key) * pair.Value; computedBaseScore += Judgement.ToNumericResult(pair.Key) * pair.Value;
} }
double pointInTimeAccuracy = calculateAccuracyRatio(computedBaseScore, true); return GetScore(mode, maxAchievableCombo, calculateAccuracyRatio(computedBaseScore), calculateComboRatio(maxCombo), scoreResultCounts);
double comboRatio = calculateComboRatio(maxCombo);
double score = GetScore(mode, maxAchievableCombo, calculateAccuracyRatio(computedBaseScore), comboRatio, scoreResultCounts);
return (score, pointInTimeAccuracy);
} }
/// <summary> /// <summary>

View File

@ -122,8 +122,8 @@ namespace osu.Game.Screens.Play.HUD
if (LastHeader == null) if (LastHeader == null)
return; return;
(score.Value, accuracy.Value) = processor.GetScoreAndAccuracy(mode, LastHeader.MaxCombo, LastHeader.Statistics); score.Value = processor.GetImmediateScore(mode, LastHeader.MaxCombo, LastHeader.Statistics);
accuracy.Value = LastHeader.Accuracy;
currentCombo.Value = LastHeader.Combo; currentCombo.Value = LastHeader.Combo;
} }
} }