1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-22 19:47:22 +08:00

Add rewinding support

This commit is contained in:
smoogipoo 2020-08-19 01:37:24 +09:00
parent 99315a4aa7
commit 4d4d9b7356

View File

@ -57,7 +57,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
/// <summary>
/// Whether the hold note has been released potentially without having caused a break.
/// </summary>
private bool hasReleased;
private double? releaseTime;
public DrawableHoldNote(HoldNote hitObject)
: base(hitObject)
@ -175,8 +175,11 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
{
base.Update();
// Decrease the size of the body while the hold note is held and the head has been hit.
if (Head.IsHit && !hasReleased)
if (Time.Current < releaseTime)
releaseTime = null;
// Decrease the size of the body while the hold note is held and the head has been hit. This stops at the very first release point.
if (Head.IsHit && releaseTime == null)
{
float heightDecrease = (float)(Math.Max(0, Time.Current - HitObject.StartTime) / HitObject.Duration);
bodyContainer.Height = MathHelper.Clamp(1 - heightDecrease, 0, 1);
@ -250,7 +253,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
if (!Tail.IsHit)
HasBroken = true;
hasReleased = true;
releaseTime = Time.Current;
}
private void endHold()