1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 23:12:55 +08:00

Add time elapsation to judgement simulation

This commit is contained in:
smoogipoo 2019-12-24 17:12:58 +09:00
parent 90cb9d9162
commit 985277da79

View File

@ -47,6 +47,10 @@ namespace osu.Game.Rulesets.Scoring
Reset(true); Reset(true);
} }
public virtual void ApplyElapsedTime(double elapsedTime)
{
}
/// <summary> /// <summary>
/// Applies the score change of a <see cref="JudgementResult"/> to this <see cref="ScoreProcessor"/>. /// Applies the score change of a <see cref="JudgementResult"/> to this <see cref="ScoreProcessor"/>.
/// </summary> /// </summary>
@ -115,6 +119,8 @@ namespace osu.Game.Rulesets.Scoring
/// <param name="beatmap">The <see cref="IBeatmap"/> to simulate.</param> /// <param name="beatmap">The <see cref="IBeatmap"/> to simulate.</param>
protected virtual void SimulateAutoplay(IBeatmap beatmap) protected virtual void SimulateAutoplay(IBeatmap beatmap)
{ {
HitObject lastObject = null;
foreach (var obj in beatmap.HitObjects) foreach (var obj in beatmap.HitObjects)
simulate(obj); simulate(obj);
@ -123,6 +129,9 @@ namespace osu.Game.Rulesets.Scoring
foreach (var nested in obj.NestedHitObjects) foreach (var nested in obj.NestedHitObjects)
simulate(nested); simulate(nested);
if (lastObject != null)
ApplyElapsedTime(lastObject.GetEndTime() - obj.StartTime);
var judgement = obj.CreateJudgement(); var judgement = obj.CreateJudgement();
if (judgement == null) if (judgement == null)
return; return;
@ -132,8 +141,9 @@ namespace osu.Game.Rulesets.Scoring
throw new InvalidOperationException($"{GetType().ReadableName()} must provide a {nameof(JudgementResult)} through {nameof(CreateResult)}."); throw new InvalidOperationException($"{GetType().ReadableName()} must provide a {nameof(JudgementResult)} through {nameof(CreateResult)}.");
result.Type = judgement.MaxResult; result.Type = judgement.MaxResult;
ApplyResult(result); ApplyResult(result);
lastObject = obj;
} }
} }
} }