1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 20:13:21 +08:00

Avoid unnecessary operations during score processor simulation

This commit is contained in:
Dean Herbert 2023-06-13 02:05:11 +09:00
parent 87520ae400
commit e0ebb000d6
2 changed files with 15 additions and 3 deletions

View File

@ -30,6 +30,11 @@ namespace osu.Game.Rulesets.Scoring
/// </summary>
protected int MaxHits { get; private set; }
/// <summary>
/// Whether <see cref="SimulateAutoplay"/> is currently running.
/// </summary>
protected bool IsSimulating { get; private set; }
/// <summary>
/// The total number of judged <see cref="HitObject"/>s at the current point in time.
/// </summary>
@ -146,6 +151,8 @@ namespace osu.Game.Rulesets.Scoring
/// <param name="beatmap">The <see cref="IBeatmap"/> to simulate.</param>
protected virtual void SimulateAutoplay(IBeatmap beatmap)
{
IsSimulating = true;
foreach (var obj in beatmap.HitObjects)
simulate(obj);
@ -163,6 +170,8 @@ namespace osu.Game.Rulesets.Scoring
result.Type = GetSimulatedHitResult(judgement);
ApplyResult(result);
}
IsSimulating = false;
}
protected override void Update()

View File

@ -226,10 +226,13 @@ namespace osu.Game.Rulesets.Scoring
ApplyScoreChange(result);
hitEvents.Add(CreateHitEvent(result));
lastHitObject = result.HitObject;
if (!IsSimulating)
{
hitEvents.Add(CreateHitEvent(result));
lastHitObject = result.HitObject;
updateScore();
updateScore();
}
}
/// <summary>