1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 09:32:55 +08:00

fix SliderTicks appearing too late

This commit is contained in:
Aergwyn 2018-01-25 10:52:03 +01:00
parent 52c4d22c41
commit 214938b98d
4 changed files with 23 additions and 24 deletions

View File

@ -75,15 +75,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
foreach (var tick in s.NestedHitObjects.OfType<SliderTick>())
{
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);

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// 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
{
private readonly SliderTick sliderTick;
public double FadeInTime;
public double FadeOutTime;
private const double anim_duration = 150;
public bool Tracking;
@ -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;
}
}

View File

@ -137,6 +137,7 @@ namespace osu.Game.Rulesets.Osu.Objects
AddNested(new SliderTick
{
SpanIndex = span,
SliderStartTime = StartTime,
StartTime = spanStartTime + timeProgress * SpanDuration,
Position = Curve.PositionAt(distanceProgress),
StackHeight = StackHeight,

View File

@ -1,10 +1,22 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// 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 SliderStartTime { get; set; }
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
{
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
// SliderTicks appear earlier and earlier going further into a Slider.
TimePreempt = StartTime - ((StartTime - SliderStartTime) / 2 + SliderStartTime - TimeFadein * 0.66f);
}
}
}