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

convert AliveObjects to list in hit policy instead of globally

This commit is contained in:
Liam DeVoe 2023-07-19 14:28:04 -04:00
parent 15af85226c
commit 2c97ac7410
3 changed files with 7 additions and 5 deletions

View File

@ -4,6 +4,7 @@
#nullable disable
using System;
using System.Linq;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables;
@ -27,16 +28,17 @@ namespace osu.Game.Rulesets.Osu.UI
public ClickAction CheckHittable(DrawableHitObject hitObject, double time)
{
int index = HitObjectContainer.AliveObjects.IndexOf(hitObject);
var aliveObjects = HitObjectContainer.AliveObjects.ToList();
int index = aliveObjects.IndexOf(hitObject);
if (index > 0)
{
var previousHitObject = (DrawableOsuHitObject)HitObjectContainer.AliveObjects[index - 1];
var previousHitObject = (DrawableOsuHitObject)aliveObjects[index - 1];
if (previousHitObject.HitObject.StackHeight > 0 && !previousHitObject.AllJudged)
return ClickAction.Ignore;
}
foreach (DrawableHitObject testObject in HitObjectContainer.AliveObjects)
foreach (DrawableHitObject testObject in aliveObjects)
{
if (testObject.AllJudged)
continue;

View File

@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.UI
{
public IEnumerable<DrawableHitObject> Objects => InternalChildren.Cast<DrawableHitObject>().OrderBy(h => h.HitObject.StartTime);
public IList<DrawableHitObject> AliveObjects => AliveEntries.Select(pair => pair.Drawable).OrderBy(h => h.HitObject.StartTime).ToList();
public IEnumerable<DrawableHitObject> AliveObjects => AliveEntries.Select(pair => pair.Drawable).OrderBy(h => h.HitObject.StartTime);
/// <summary>
/// Invoked when a <see cref="DrawableHitObject"/> is judged.

View File

@ -19,6 +19,6 @@ namespace osu.Game.Rulesets.UI
/// <remarks>
/// If this <see cref="IHitObjectContainer"/> uses pooled objects, this is equivalent to <see cref="Objects"/>.
/// </remarks>
IList<DrawableHitObject> AliveObjects { get; }
IEnumerable<DrawableHitObject> AliveObjects { get; }
}
}