mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 11:07:52 +08:00
Combine FollowCircle and TickFollowCircle classes
This commit is contained in:
parent
726042d9ec
commit
c2c2c505a4
@ -56,5 +56,18 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
||||
this.ScaleTo(1, duration, Easing.OutQuint)
|
||||
.FadeOut(duration / 2, Easing.OutQuint);
|
||||
}
|
||||
|
||||
protected override void OnSliderTick()
|
||||
{
|
||||
// TODO: Follow circle should bounce on each slider tick.
|
||||
|
||||
// TEMP DUMMY ANIMS
|
||||
this.ScaleTo(DrawableSliderBall.FOLLOW_AREA * 1.1f)
|
||||
.ScaleTo(DrawableSliderBall.FOLLOW_AREA, 175f);
|
||||
}
|
||||
|
||||
protected override void OnSliderBreak()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,21 +58,45 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
||||
|
||||
private void updateStateTransforms(DrawableHitObject drawableObject, ArmedState state)
|
||||
{
|
||||
if (drawableObject is not DrawableSliderTail)
|
||||
return;
|
||||
|
||||
Debug.Assert(ParentObject != null);
|
||||
|
||||
// Use ParentObject instead of drawableObject because slider tail hit state update time
|
||||
// is ~36ms before the actual slider end (aka slider tail leniency)
|
||||
using (BeginAbsoluteSequence(ParentObject.HitStateUpdateTime))
|
||||
switch (state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case ArmedState.Hit:
|
||||
OnSliderEnd();
|
||||
break;
|
||||
}
|
||||
case ArmedState.Hit:
|
||||
switch (drawableObject)
|
||||
{
|
||||
case DrawableSliderTail:
|
||||
// Use ParentObject instead of drawableObject because slider tail's
|
||||
// HitStateUpdateTime is ~36ms before the actual slider end (aka slider
|
||||
// tail leniency)
|
||||
using (BeginAbsoluteSequence(ParentObject.HitStateUpdateTime))
|
||||
OnSliderEnd();
|
||||
break;
|
||||
|
||||
case DrawableSliderTick:
|
||||
case DrawableSliderRepeat:
|
||||
using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime))
|
||||
OnSliderTick();
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case ArmedState.Miss:
|
||||
switch (drawableObject)
|
||||
{
|
||||
case DrawableSliderTail:
|
||||
case DrawableSliderTick:
|
||||
case DrawableSliderRepeat:
|
||||
// Despite above comment, ok to use drawableObject.HitStateUpdateTime
|
||||
// here, since on stable, the break anim plays right when the tail is
|
||||
// missed, not when the slider ends
|
||||
using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime))
|
||||
OnSliderBreak();
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,5 +116,9 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
||||
protected abstract void OnSliderRelease();
|
||||
|
||||
protected abstract void OnSliderEnd();
|
||||
|
||||
protected abstract void OnSliderTick();
|
||||
|
||||
protected abstract void OnSliderBreak();
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ using osu.Framework.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
||||
{
|
||||
public class LegacyFollowCircle : TickFollowCircle
|
||||
public class LegacyFollowCircle : FollowCircle
|
||||
{
|
||||
public LegacyFollowCircle(Drawable animationContent)
|
||||
{
|
||||
@ -32,6 +32,10 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
||||
.FadeTo(0).FadeTo(1f, Math.Min(60f, remainingTime));
|
||||
}
|
||||
|
||||
protected override void OnSliderRelease()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnSliderEnd()
|
||||
{
|
||||
this.ScaleTo(1.6f, 200, Easing.Out)
|
||||
|
@ -1,73 +0,0 @@
|
||||
// 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;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Skinning
|
||||
{
|
||||
public abstract class TickFollowCircle : FollowCircle
|
||||
{
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
if (ParentObject != null)
|
||||
ParentObject.ApplyCustomUpdateState += updateStateTransforms;
|
||||
}
|
||||
|
||||
private void updateStateTransforms(DrawableHitObject drawableObject, ArmedState state)
|
||||
{
|
||||
// Fine to use drawableObject.HitStateUpdateTime even for DrawableSliderTail, since on
|
||||
// stable, the break anim plays right when the tail is missed, not when the slider ends
|
||||
using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime))
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case ArmedState.Hit:
|
||||
switch (drawableObject)
|
||||
{
|
||||
case DrawableSliderTick:
|
||||
case DrawableSliderRepeat:
|
||||
OnSliderTick();
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case ArmedState.Miss:
|
||||
switch (drawableObject)
|
||||
{
|
||||
case DrawableSliderTail:
|
||||
case DrawableSliderTick:
|
||||
case DrawableSliderRepeat:
|
||||
OnSliderBreak();
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
if (ParentObject != null)
|
||||
ParentObject.ApplyCustomUpdateState -= updateStateTransforms;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sealed empty intentionally. Override <see cref="OnSliderBreak" /> instead, since
|
||||
/// animations should only play on slider ticks.
|
||||
/// </summary>
|
||||
protected sealed override void OnSliderRelease()
|
||||
{
|
||||
}
|
||||
|
||||
protected abstract void OnSliderTick();
|
||||
|
||||
protected abstract void OnSliderBreak();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user