diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 5f464402d0..5795bb8405 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -64,15 +64,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables foreach (var tick in s.NestedHitObjects.OfType()) { - var spanStartTime = s.StartTime + tick.SpanIndex * s.SpanDuration; - var fadeInTime = spanStartTime + (tick.StartTime - spanStartTime) / 2 - (tick.SpanIndex == 0 ? HitObject.TimeFadein : HitObject.TimeFadein / 2); - var fadeOutTime = spanStartTime + s.SpanDuration; - var drawableTick = new DrawableSliderTick(tick) { - FadeInTime = fadeInTime, - FadeOutTime = fadeOutTime, - Position = tick.Position, + Position = tick.Position }; ticks.Add(drawableTick); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs index ae76f1e0e1..c616d15de3 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Drawables; using OpenTK; @@ -14,10 +13,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { public class DrawableSliderTick : DrawableOsuHitObject, IRequireTracking { - private readonly SliderTick sliderTick; - - public double FadeInTime; - public double FadeOutTime; + private const double anim_duration = 150; public bool Tracking { get; set; } @@ -25,8 +21,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public DrawableSliderTick(SliderTick sliderTick) : base(sliderTick) { - this.sliderTick = sliderTick; - Size = new Vector2(16) * sliderTick.Scale; Masking = true; @@ -56,13 +50,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected override void UpdatePreemptState() { - var animIn = Math.Min(150, sliderTick.StartTime - FadeInTime); - this.Animate( - d => d.FadeIn(animIn), - d => d.ScaleTo(0.5f).ScaleTo(1.2f, animIn) + d => d.FadeIn(anim_duration), + d => d.ScaleTo(0.5f).ScaleTo(1.2f, anim_duration / 2) ).Then( - d => d.ScaleTo(1, 150, Easing.Out) + d => d.ScaleTo(1, anim_duration / 2, Easing.Out) ); } @@ -71,15 +63,15 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables switch (state) { case ArmedState.Idle: - this.Delay(FadeOutTime - sliderTick.StartTime).FadeOut(); + this.Delay(HitObject.TimePreempt).FadeOut(); break; case ArmedState.Miss: - this.FadeOut(160) - .FadeColour(Color4.Red, 80); + this.FadeOut(anim_duration) + .FadeColour(Color4.Red, anim_duration / 2); break; case ArmedState.Hit: - this.FadeOut(120, Easing.OutQuint) - .ScaleTo(Scale * 1.5f, 120, Easing.OutQuint); + this.FadeOut(anim_duration, Easing.OutQuint) + .ScaleTo(Scale * 1.5f, anim_duration, Easing.OutQuint); break; } } diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index d4444c5c5d..d1c65fcce4 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -167,6 +167,7 @@ namespace osu.Game.Rulesets.Osu.Objects AddNested(new SliderTick { SpanIndex = span, + SpanStartTime = spanStartTime, StartTime = spanStartTime + timeProgress * SpanDuration, Position = Curve.PositionAt(distanceProgress), StackHeight = StackHeight, diff --git a/osu.Game.Rulesets.Osu/Objects/SliderTick.cs b/osu.Game.Rulesets.Osu/Objects/SliderTick.cs index 5f9a978902..966db73eb9 100644 --- a/osu.Game.Rulesets.Osu/Objects/SliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/SliderTick.cs @@ -1,10 +1,30 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; + namespace osu.Game.Rulesets.Osu.Objects { public class SliderTick : OsuHitObject { public int SpanIndex { get; set; } + public double SpanStartTime { get; set; } + + protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) + { + base.ApplyDefaultsToSelf(controlPointInfo, difficulty); + + double offset; + + if (SpanIndex > 0) + // Adding 200 to include the offset stable used. + // This is so on repeats ticks don't appear too late to be visually processed by the player. + offset = 200; + else + offset = TimeFadein * 0.66f; + + TimePreempt = (StartTime - SpanStartTime) / 2 + offset; + } } } diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs index 2d26b74d01..b8e04de880 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs @@ -30,7 +30,9 @@ namespace osu.Game.Rulesets.Osu.Tests { typeof(SliderBall), typeof(SliderBody), + typeof(SliderTick), typeof(DrawableSlider), + typeof(DrawableSliderTick), typeof(DrawableRepeatPoint), typeof(DrawableOsuHitObject) }; @@ -134,7 +136,7 @@ namespace osu.Game.Rulesets.Osu.Tests var cpi = new ControlPointInfo(); cpi.DifficultyPoints.Add(new DifficultyControlPoint { SpeedMultiplier = speedMultiplier }); - slider.ApplyDefaults(cpi, new BeatmapDifficulty { CircleSize = circleSize }); + slider.ApplyDefaults(cpi, new BeatmapDifficulty { CircleSize = circleSize, SliderTickRate = 3 }); var drawable = new DrawableSlider(slider) {