1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-12 13:17:26 +08:00
osu-lazer/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteHead.cs
Bartłomiej Dach 9a330c4c56 Fix mania hold note heads hiding when frozen
This was an insidious regression from a3dc1d5. Prior to that commit,
`DrawableHoldNoteHead` had `UpdateStateTransforms()` overridden, to set
the hold note head's lifetime. When that method was split into
`UpdateInitialStateTransforms()` and `UpdateHitStateTransforms()`, the
lifetime set was moved to the former.

Unfortunately, that override served two purposes: both to set the
lifetime, and to suppress hit animations which would normally be added
by the base `DrawableManiaHitObject`. That fact being missed led to
`UpdateHitStateTransforms()` hiding the hold note head immediately on
hit and with a slight delay on miss.

To resolve, explicitly override `UpdateHitStateTransforms()` and
suppress the base call, with an explanatory comment.
2021-03-21 18:46:41 +01:00

45 lines
1.6 KiB
C#

// 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.
using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.Mania.Objects.Drawables
{
/// <summary>
/// The head of a <see cref="DrawableHoldNote"/>.
/// </summary>
public class DrawableHoldNoteHead : DrawableNote
{
protected override ManiaSkinComponents Component => ManiaSkinComponents.HoldNoteHead;
public DrawableHoldNoteHead(DrawableHoldNote holdNote)
: base(holdNote.HitObject.Head)
{
}
public void UpdateResult() => base.UpdateResult(true);
protected override void UpdateInitialTransforms()
{
base.UpdateInitialTransforms();
// This hitobject should never expire, so this is just a safe maximum.
LifetimeEnd = LifetimeStart + 30000;
}
protected override void UpdateHitStateTransforms(ArmedState state)
{
// suppress the base call explicitly.
// the hold note head should never change its visual state on its own due to the "freezing" mechanic
// (when hit, it remains visible in place at the judgement line; when dropped, it will scroll past the line).
// it will be hidden along with its parenting hold note when required.
}
public override bool OnPressed(ManiaAction action) => false; // Handled by the hold note
public override void OnReleased(ManiaAction action)
{
}
}
}