mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 04:13:21 +08:00
Populate score with remaining "miss" statistics on fail/exit
This commit is contained in:
parent
c4089b71bd
commit
0f0b19da4a
@ -430,6 +430,7 @@ namespace osu.Game.Rulesets.Scoring
|
||||
TotalScore.Value = 0;
|
||||
Accuracy.Value = 1;
|
||||
Combo.Value = 0;
|
||||
Rank.Disabled = false;
|
||||
Rank.Value = ScoreRank.X;
|
||||
HighestCombo.Value = 0;
|
||||
}
|
||||
@ -452,6 +453,32 @@ namespace osu.Game.Rulesets.Scoring
|
||||
score.TotalScore = (long)Math.Round(ComputeFinalScore(ScoringMode.Standardised, score));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Populates the given score with remaining statistics as "missed" and marks it with <see cref="ScoreRank.F"/> rank.
|
||||
/// </summary>
|
||||
public void FailScore(ScoreInfo score)
|
||||
{
|
||||
if (Rank.Value == ScoreRank.F)
|
||||
return;
|
||||
|
||||
Rank.Value = ScoreRank.F;
|
||||
Rank.Disabled = true;
|
||||
|
||||
Debug.Assert(maximumResultCounts != null);
|
||||
|
||||
if (maximumResultCounts.TryGetValue(HitResult.LargeTickHit, out int maximumLargeTick))
|
||||
scoreResultCounts[HitResult.LargeTickMiss] = maximumLargeTick - scoreResultCounts.GetValueOrDefault(HitResult.LargeTickHit);
|
||||
|
||||
if (maximumResultCounts.TryGetValue(HitResult.SmallTickHit, out int maximumSmallTick))
|
||||
scoreResultCounts[HitResult.SmallTickMiss] = maximumSmallTick - scoreResultCounts.GetValueOrDefault(HitResult.SmallTickHit);
|
||||
|
||||
int maximumBasic = maximumResultCounts.Single(kvp => kvp.Key.IsBasic()).Value;
|
||||
int currentBasic = scoreResultCounts.Where(kvp => kvp.Key.IsBasic() && kvp.Key != HitResult.Miss).Sum(kvp => kvp.Value);
|
||||
scoreResultCounts[HitResult.Miss] = maximumBasic - currentBasic;
|
||||
|
||||
PopulateScore(score);
|
||||
}
|
||||
|
||||
public override void ResetFromReplayFrame(ReplayFrame frame)
|
||||
{
|
||||
base.ResetFromReplayFrame(frame);
|
||||
|
@ -267,12 +267,7 @@ namespace osu.Game.Screens.Play
|
||||
},
|
||||
FailOverlay = new FailOverlay
|
||||
{
|
||||
SaveReplay = () =>
|
||||
{
|
||||
Score.ScoreInfo.Passed = false;
|
||||
Score.ScoreInfo.Rank = ScoreRank.F;
|
||||
return prepareAndImportScore();
|
||||
},
|
||||
SaveReplay = prepareAndImportScore,
|
||||
OnRetry = Restart,
|
||||
OnQuit = () => PerformExit(true),
|
||||
},
|
||||
@ -831,7 +826,6 @@ namespace osu.Game.Screens.Play
|
||||
return false;
|
||||
|
||||
GameplayState.HasFailed = true;
|
||||
Score.ScoreInfo.Passed = false;
|
||||
|
||||
updateGameplayState();
|
||||
|
||||
@ -849,9 +843,17 @@ namespace osu.Game.Screens.Play
|
||||
return true;
|
||||
}
|
||||
|
||||
// Called back when the transform finishes
|
||||
/// <summary>
|
||||
/// Invoked when the fail animation has finished.
|
||||
/// </summary>
|
||||
private void onFailComplete()
|
||||
{
|
||||
// fail completion is a good point to mark a score as failed,
|
||||
// since the last judgement that caused the fail only applies to score processor after onFail.
|
||||
// todo: this should probably be handled better.
|
||||
Score.ScoreInfo.Passed = false;
|
||||
ScoreProcessor.FailScore(Score.ScoreInfo);
|
||||
|
||||
GameplayClockContainer.Stop();
|
||||
|
||||
FailOverlay.Retries = RestartCount;
|
||||
@ -1030,7 +1032,7 @@ namespace osu.Game.Screens.Play
|
||||
if (prepareScoreForDisplayTask == null)
|
||||
{
|
||||
Score.ScoreInfo.Passed = false;
|
||||
Score.ScoreInfo.Rank = ScoreRank.F;
|
||||
ScoreProcessor.FailScore(Score.ScoreInfo);
|
||||
}
|
||||
|
||||
// EndPlaying() is typically called from ReplayRecorder.Dispose(). Disposal is currently asynchronous.
|
||||
|
Loading…
Reference in New Issue
Block a user