mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 12:23:22 +08:00
Simplify and rename time variables
This commit is contained in:
parent
27cb445c24
commit
c9d4da65d2
@ -49,35 +49,37 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
if (!(drawable is DrawableOsuHitObject d))
|
if (!(drawable is DrawableOsuHitObject d))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var fadeInTime = d.HitObject.StartTime - preEmpt;
|
var fadeInStartTime = d.HitObject.StartTime - preEmpt;
|
||||||
var fadeIn = d.HitObject.StartTime - preEmpt * fade_in_speed_multiplier - fadeInTime;
|
var fadeInDuration = preEmpt * fade_in_speed_multiplier;
|
||||||
var fadeOutTime = fadeInTime + fadeIn;
|
|
||||||
var fadeOut = d.HitObject.StartTime - preEmpt * fade_out_speed_multiplier - fadeOutTime;
|
var fadeOutStartTime = fadeInStartTime + fadeInDuration;
|
||||||
|
var fadeOutDuration = preEmpt * fade_out_speed_multiplier;
|
||||||
|
|
||||||
// new duration from completed fade in to end (before fading out)
|
// new duration from completed fade in to end (before fading out)
|
||||||
var newDuration = ((d.HitObject as IHasEndTime)?.EndTime ?? d.HitObject.StartTime) - fadeOutTime;
|
var newDuration = ((d.HitObject as IHasEndTime)?.EndTime ?? d.HitObject.StartTime) - fadeOutStartTime;
|
||||||
|
|
||||||
d.FadeIn = fadeIn;
|
d.FadeIn = fadeInDuration;
|
||||||
|
|
||||||
using (drawable.BeginAbsoluteSequence(fadeInTime, true))
|
using (drawable.BeginAbsoluteSequence(fadeInStartTime, true))
|
||||||
{
|
{
|
||||||
switch (drawable)
|
switch (drawable)
|
||||||
{
|
{
|
||||||
case DrawableHitCircle circle:
|
case DrawableHitCircle circle:
|
||||||
circle.ApproachCircle.FadeOut();
|
// we don't want to see the approach circle
|
||||||
|
circle.ApproachCircle.Hide();
|
||||||
// prolong the hitcircle long enough so misses are still possible
|
// prolong the hitcircle long enough so misses are still possible
|
||||||
circle.LifetimeEnd = circle.HitObject.StartTime + Math.Max(fadeOut, circle.HitObject.HitWindowFor(HitResult.Miss));
|
circle.LifetimeEnd = circle.HitObject.StartTime + Math.Max(fadeOutDuration, circle.HitObject.HitWindowFor(HitResult.Miss));
|
||||||
circle.FadeIn(fadeIn).Then().FadeOut(fadeOut); // override fade in as it somehow gets cut otherwise
|
circle.FadeIn(fadeInDuration).Then().FadeOut(fadeOutDuration); // override fade in as it somehow gets cut otherwise
|
||||||
break;
|
break;
|
||||||
case DrawableSlider slider:
|
case DrawableSlider slider:
|
||||||
using (slider.BeginAbsoluteSequence(fadeOutTime, true))
|
using (slider.BeginAbsoluteSequence(fadeOutStartTime, true))
|
||||||
{
|
{
|
||||||
slider.Body.FadeOut(newDuration, Easing.Out);
|
slider.Body.FadeOut(newDuration, Easing.Out);
|
||||||
// delay a bit less to let the sliderball fade out peacefully instead of having a hard cut
|
// delay a bit less to let the sliderball fade out peacefully instead of having a hard cut
|
||||||
using (slider.BeginDelayedSequence(newDuration - fadeOut, true))
|
using (slider.BeginDelayedSequence(newDuration - fadeOutDuration, true))
|
||||||
{
|
{
|
||||||
slider.Ball.FadeOut(fadeOut);
|
slider.Ball.FadeOut(fadeOutDuration);
|
||||||
slider.Delay(fadeOut).Expire();
|
slider.Delay(fadeOutDuration).Expire();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -86,17 +88,17 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
spinner.Ticks.FadeOut();
|
spinner.Ticks.FadeOut();
|
||||||
spinner.Background.FadeOut();
|
spinner.Background.FadeOut();
|
||||||
|
|
||||||
using (spinner.BeginAbsoluteSequence(fadeOutTime, true))
|
using (spinner.BeginAbsoluteSequence(fadeOutStartTime, true))
|
||||||
{
|
{
|
||||||
var sequence = spinner.Delay(newDuration).FadeOut(fadeOut);
|
var sequence = spinner.Delay(newDuration).FadeOut(fadeOutDuration);
|
||||||
// speed up the end sequence accordingly
|
// speed up the end sequence accordingly
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case ArmedState.Hit:
|
case ArmedState.Hit:
|
||||||
sequence.ScaleTo(spinner.Scale * 1.2f, fadeOut * 2, Easing.Out);
|
sequence.ScaleTo(spinner.Scale * 1.2f, fadeOutDuration * 2, Easing.Out);
|
||||||
break;
|
break;
|
||||||
case ArmedState.Miss:
|
case ArmedState.Miss:
|
||||||
sequence.ScaleTo(spinner.Scale * 0.8f, fadeOut * 2, Easing.Out);
|
sequence.ScaleTo(spinner.Scale * 0.8f, fadeOutDuration * 2, Easing.Out);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sequence.Expire();
|
sequence.Expire();
|
||||||
|
Loading…
Reference in New Issue
Block a user