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

Ensure past drawable objects also get their results populated in editor test play

This commit is contained in:
Bartłomiej Dach 2024-06-28 09:37:10 +02:00
parent ace6427d40
commit 7ac5bd4d37
No known key found for this signature in database

View File

@ -48,6 +48,7 @@ namespace osu.Game.Screens.Edit.GameplayTest
base.LoadComplete(); base.LoadComplete();
markPreviousObjectsHit(); markPreviousObjectsHit();
markVisibleDrawableObjectsHit();
ScoreProcessor.HasCompleted.BindValueChanged(completed => ScoreProcessor.HasCompleted.BindValueChanged(completed =>
{ {
@ -67,9 +68,10 @@ namespace osu.Game.Screens.Edit.GameplayTest
foreach (var hitObject in enumerateHitObjects(DrawableRuleset.Objects, editorState.Time)) foreach (var hitObject in enumerateHitObjects(DrawableRuleset.Objects, editorState.Time))
{ {
var judgement = hitObject.Judgement; var judgement = hitObject.Judgement;
var result = new JudgementResult(hitObject, judgement) { Type = judgement.MaxResult };
HealthProcessor.ApplyResult(new JudgementResult(hitObject, judgement) { Type = judgement.MaxResult }); HealthProcessor.ApplyResult(result);
ScoreProcessor.ApplyResult(new JudgementResult(hitObject, judgement) { Type = judgement.MaxResult }); ScoreProcessor.ApplyResult(result);
} }
static IEnumerable<HitObject> enumerateHitObjects(IEnumerable<HitObject> hitObjects, double cutoffTime) static IEnumerable<HitObject> enumerateHitObjects(IEnumerable<HitObject> hitObjects, double cutoffTime)
@ -88,6 +90,40 @@ namespace osu.Game.Screens.Edit.GameplayTest
} }
} }
private void markVisibleDrawableObjectsHit()
{
if (!DrawableRuleset.Playfield.IsLoaded)
{
Schedule(markVisibleDrawableObjectsHit);
return;
}
foreach (var drawableObjectEntry in enumerateDrawableEntries(
DrawableRuleset.Playfield.AllHitObjects
.Select(ho => ho.Entry)
.Where(e => e != null)
.Cast<HitObjectLifetimeEntry>(), editorState.Time))
{
drawableObjectEntry.Result = new JudgementResult(drawableObjectEntry.HitObject, drawableObjectEntry.HitObject.Judgement)
{ Type = drawableObjectEntry.HitObject.Judgement.MaxResult };
}
static IEnumerable<HitObjectLifetimeEntry> enumerateDrawableEntries(IEnumerable<HitObjectLifetimeEntry> entries, double cutoffTime)
{
foreach (var entry in entries)
{
foreach (var nested in enumerateDrawableEntries(entry.NestedEntries, cutoffTime))
{
if (nested.HitObject.GetEndTime() < cutoffTime)
yield return nested;
}
if (entry.HitObject.GetEndTime() < cutoffTime)
yield return entry;
}
}
}
protected override void PrepareReplay() protected override void PrepareReplay()
{ {
// don't record replays. // don't record replays.