diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs index 94bcade2dc..cd72483d1e 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs @@ -3,6 +3,7 @@ using System; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Transformations; using osu.Framework.MathUtils; using osu.Game.Modes.Objects.Drawables; @@ -18,8 +19,8 @@ public class DrawableSpinner : DrawableOsuHitObject private SpinnerDisc disc; private SpinnerBackground background; + private Container circleContainer; private DrawableHitCircle circle; - private NumberPiece number; public DrawableSpinner(Spinner s) : base(s) { @@ -47,16 +48,23 @@ public DrawableSpinner(Spinner s) : base(s) Origin = Anchor.Centre, DiscColour = s.Colour }, - circle = new DrawableHitCircle(s) + circleContainer = new Container { - Interactive = false, - Position = Vector2.Zero, + AutoSizeAxes = Axes.Both, Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Children = new [] + { + circle = new DrawableHitCircle(s) + { + Interactive = false, + Position = Vector2.Zero, + Anchor = Anchor.Centre, + } + } } }; - circle.ApproachCircle.Colour = Color4.Transparent; - background.Scale = scaleToCircle; disc.Scale = scaleToCircle; } @@ -71,6 +79,9 @@ protected override void CheckJudgement(bool userTriggered) disc.ScaleTo(Interpolation.ValueAt(Math.Sqrt(Progress), scaleToCircle, Vector2.One, 0, 1), 100); + if (Progress >= 1) + disc.Complete = true; + if (!userTriggered && Time.Current >= HitObject.EndTime) { if (Progress >= 1) @@ -91,7 +102,8 @@ protected override void CheckJudgement(bool userTriggered) else { j.Score = OsuScoreResult.Miss; - j.Result = HitResult.Miss; + if (Time.Current >= HitObject.EndTime) + j.Result = HitResult.Miss; } } } @@ -109,6 +121,7 @@ protected override void UpdatePreemptState() base.UpdatePreemptState(); FadeIn(200); + circleContainer.ScaleTo(1, 400, EasingTypes.OutElastic); background.Delay(TIME_PREEMPT - 100); background.FadeIn(200); @@ -120,12 +133,14 @@ protected override void UpdatePreemptState() protected override void UpdateState(ArmedState state) { + if (!IsLoaded) return; + base.UpdateState(state); Delay(HitObject.Duration, true); FadeOut(160); - + switch (state) { case ArmedState.Hit: diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index 76fd360818..e982f52b44 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -3,6 +3,7 @@ using System; using System.Linq; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; @@ -10,6 +11,7 @@ using osu.Framework.Graphics.Transformations; using osu.Framework.Input; using osu.Framework.Logging; +using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; @@ -27,6 +29,14 @@ public SRGBColour DiscColour set { Disc.Colour = value; } } + Color4 completeColour; + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + completeColour = colours.YellowLight.Opacity(0.8f); + } + class SpinnerBorder : Container { public SpinnerBorder() @@ -120,6 +130,22 @@ public bool Tracking } } + bool complete; + public bool Complete + { + get { return complete; } + set + { + if (value == complete) return; + + complete = value; + + Disc.FadeColour(completeColour, 200); + + updateCompleteTick(); + } + } + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { Tracking = true; @@ -145,6 +171,10 @@ protected override bool OnMouseMove(InputState state) private float currentRotation; public float RotationAbsolute; + private int completeTick; + + private bool updateCompleteTick() => completeTick != (completeTick = (int)(RotationAbsolute / 720)); + protected override void Update() { base.Update(); @@ -162,6 +192,14 @@ protected override void Update() } lastAngle = thisAngle; + if (Complete && updateCompleteTick()) + { + Disc.Flush(flushType: typeof(TransformAlpha)); + Disc.FadeTo(0.75f, 30, EasingTypes.OutExpo); + Disc.Delay(30); + Disc.FadeTo(0.5f, 250, EasingTypes.OutQuint); + } + RotateTo(currentRotation, 100, EasingTypes.OutExpo); } }