Fix hitobjects with unknown lifetimes by enforcing non-null judgement

We've seen multiple cases where DrawableHitObject are stuck in the lifetime management container
due to not implementing a judgement (meaning they are never "hit" or "missed"). To avoid this going forward
CreateJudgement() must be implemented and return a non-null judgement.

This fixes BananaShower and JuiceStreams in osu!catch.

This also makes HitObject abstract and cleans up convert HitObject implementations.
This commit is contained in:
Dean Herbert
2020-02-23 13:01:30 +09:00
parent 66317f9fcd
commit ffc7eaa3f2
36 changed files with 72 additions and 105 deletions

View File

@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Objects
/// HitObjects may contain more properties for which you should be checking through the IHas* types.
/// </para>
/// </summary>
public class HitObject
public abstract class HitObject
{
/// <summary>
/// A small adjustment to the start time of control points to account for rounding/precision errors.
@ -83,7 +83,7 @@ namespace osu.Game.Rulesets.Objects
[JsonIgnore]
public IReadOnlyList<HitObject> NestedHitObjects => nestedHitObjects;
public HitObject()
protected HitObject()
{
StartTimeBindable.ValueChanged += time =>
{
@ -144,9 +144,10 @@ namespace osu.Game.Rulesets.Objects
/// <summary>
/// Creates the <see cref="Judgement"/> that represents the scoring information for this <see cref="HitObject"/>.
/// May be null.
/// Used to decide on drawable object lifetimes.
/// </summary>
public virtual Judgement CreateJudgement() => null;
[NotNull]
public abstract Judgement CreateJudgement();
/// <summary>
/// Creates the <see cref="HitWindows"/> for this <see cref="HitObject"/>.
@ -156,7 +157,7 @@ namespace osu.Game.Rulesets.Objects
/// </para>
/// </summary>
[NotNull]
protected virtual HitWindows CreateHitWindows() => new HitWindows();
protected abstract HitWindows CreateHitWindows();
}
public static class HitObjectExtensions