1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 09:32:55 +08:00

Fix score not updating when TrackHitEvents is set to false

This commit is contained in:
Dean Herbert 2023-06-13 11:44:52 +09:00
parent 422e87f0ec
commit 0ab9a48f00

View File

@ -33,6 +33,9 @@ namespace osu.Game.Rulesets.Scoring
/// <summary> /// <summary>
/// Whether <see cref="HitEvents"/> should be populated during application of results. /// Whether <see cref="HitEvents"/> should be populated during application of results.
/// </summary> /// </summary>
/// <remarks>
/// Should only be disabled for special cases.
/// When disabled, <see cref="JudgementProcessor.RevertResult"/> cannot be used.</remarks>
internal bool TrackHitEvents = true; internal bool TrackHitEvents = true;
/// <summary> /// <summary>
@ -231,10 +234,13 @@ namespace osu.Game.Rulesets.Scoring
ApplyScoreChange(result); ApplyScoreChange(result);
if (!IsSimulating && TrackHitEvents) if (!IsSimulating)
{ {
hitEvents.Add(CreateHitEvent(result)); if (TrackHitEvents)
lastHitObject = result.HitObject; {
hitEvents.Add(CreateHitEvent(result));
lastHitObject = result.HitObject;
}
updateScore(); updateScore();
} }
@ -250,6 +256,9 @@ namespace osu.Game.Rulesets.Scoring
protected sealed override void RevertResultInternal(JudgementResult result) protected sealed override void RevertResultInternal(JudgementResult result)
{ {
if (!TrackHitEvents)
throw new InvalidOperationException(@$"Rewind is not supported when {nameof(TrackHitEvents)} is disabled.");
Combo.Value = result.ComboAtJudgement; Combo.Value = result.ComboAtJudgement;
HighestCombo.Value = result.HighestComboAtJudgement; HighestCombo.Value = result.HighestComboAtJudgement;