1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 05:32:54 +08:00

Fix ticks/spinners contributing to notelock

This commit is contained in:
smoogipoo 2020-03-30 16:14:56 +09:00
parent b9277165f7
commit 0d20292992
5 changed files with 42 additions and 26 deletions

View File

@ -124,7 +124,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
case SliderTailCircle tail:
return new DrawableSliderTail(slider, tail);
case HitCircle head:
case SliderHeadCircle head:
return new DrawableSliderHead(slider, head) { OnShake = Shake };
case SliderTick tick:

View File

@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
private readonly Slider slider;
public DrawableSliderHead(Slider slider, HitCircle h)
public DrawableSliderHead(Slider slider, SliderHeadCircle h)
: base(h)
{
this.slider = slider;

View File

@ -155,7 +155,7 @@ namespace osu.Game.Rulesets.Osu.Objects
break;
case SliderEventType.Head:
AddNested(HeadCircle = new SliderCircle
AddNested(HeadCircle = new SliderHeadCircle
{
StartTime = e.Time,
Position = Position,

View File

@ -0,0 +1,9 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
namespace osu.Game.Rulesets.Osu.Objects
{
public class SliderHeadCircle : HitCircle
{
}
}

View File

@ -12,6 +12,7 @@ using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables.Connections;
using osu.Game.Rulesets.UI;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu.UI.Cursor;
using osu.Game.Skinning;
@ -126,10 +127,7 @@ namespace osu.Game.Rulesets.Osu.UI
/// <param name="result">The <see cref="JudgementResult"/> of the judged <see cref="OsuHitObject"/>.</param>
private void missAllEarlier(JudgementResult result)
{
// Hitobjects that count as bonus should not cause other hitobjects to get missed.
// E.g. For the sequence slider-head -> circle -> slider-tick, hitting the tick before the circle should not cause the circle to be missed.
// E.g. For the sequence spinner -> circle -> spinner-bonus, hitting the bonus before the circle should not cause the circle to be missed.
if (result.Judgement.IsBonus)
if (!contributesToNoteLock(result.HitObject))
return;
// The minimum start time required for hitobjects so that they aren't missed.
@ -140,35 +138,44 @@ namespace osu.Game.Rulesets.Osu.UI
if (obj.HitObject.StartTime >= minimumTime)
break;
attemptMiss(obj);
performMiss(obj);
foreach (var n in obj.NestedHitObjects)
{
if (n.HitObject.StartTime >= minimumTime)
break;
attemptMiss(n);
performMiss(n);
}
}
static void attemptMiss(DrawableHitObject obj)
{
if (!(obj is DrawableOsuHitObject osuObject))
throw new InvalidOperationException($"{obj.GetType()} is not a {nameof(DrawableOsuHitObject)}.");
// Hitobjects that have already been judged cannot be missed.
if (osuObject.Judged)
return;
// Hitobjects that count as bonus should not be missed.
// For the sequence slider-head -> slider-tick -> circle, hitting the circle before the tick should not cause the tick to be missed.
if (osuObject.Result.Judgement.IsBonus)
return;
osuObject.MissForcefully();
}
}
private void performMiss(DrawableHitObject obj)
{
if (!(obj is DrawableOsuHitObject osuObject))
throw new InvalidOperationException($"{obj.GetType()} is not a {nameof(DrawableOsuHitObject)}.");
// Hitobjects that have already been judged cannot be missed.
if (osuObject.Judged)
return;
// Hitobjects that count as bonus should not be missed.
// For the sequence slider-head -> slider-tick -> circle, hitting the circle before the tick should not cause the tick to be missed.
if (!contributesToNoteLock(obj.HitObject))
return;
osuObject.MissForcefully();
}
/// <summary>
/// Whether a hitobject contributes to notelock.
/// Only hit circles and slider start circles contribute to notelock.
/// </summary>
/// <param name="hitObject">The hitobject to test.</param>
/// <returns>Whether <paramref name="hitObject"/> contributes to notelock.</returns>
private bool contributesToNoteLock(HitObject hitObject)
=> hitObject is HitCircle && !(hitObject is SliderTailCircle);
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => HitObjectContainer.ReceivePositionalInputAt(screenSpacePos);
private class ApproachCircleProxyContainer : LifetimeManagementContainer