diff --git a/osu.Game/Screens/Edit/GameplayTest/EditorPlayer.cs b/osu.Game/Screens/Edit/GameplayTest/EditorPlayer.cs index 2028094964..9a7c1822a3 100644 --- a/osu.Game/Screens/Edit/GameplayTest/EditorPlayer.cs +++ b/osu.Game/Screens/Edit/GameplayTest/EditorPlayer.cs @@ -48,6 +48,7 @@ namespace osu.Game.Screens.Edit.GameplayTest base.LoadComplete(); markPreviousObjectsHit(); + markVisibleDrawableObjectsHit(); ScoreProcessor.HasCompleted.BindValueChanged(completed => { @@ -67,9 +68,10 @@ namespace osu.Game.Screens.Edit.GameplayTest foreach (var hitObject in enumerateHitObjects(DrawableRuleset.Objects, editorState.Time)) { var judgement = hitObject.Judgement; + var result = new JudgementResult(hitObject, judgement) { Type = judgement.MaxResult }; - HealthProcessor.ApplyResult(new JudgementResult(hitObject, judgement) { Type = judgement.MaxResult }); - ScoreProcessor.ApplyResult(new JudgementResult(hitObject, judgement) { Type = judgement.MaxResult }); + HealthProcessor.ApplyResult(result); + ScoreProcessor.ApplyResult(result); } static IEnumerable enumerateHitObjects(IEnumerable 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(), editorState.Time)) + { + drawableObjectEntry.Result = new JudgementResult(drawableObjectEntry.HitObject, drawableObjectEntry.HitObject.Judgement) + { Type = drawableObjectEntry.HitObject.Judgement.MaxResult }; + } + + static IEnumerable enumerateDrawableEntries(IEnumerable 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() { // don't record replays.