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

Refactor logic to work

This commit is contained in:
Dean Herbert 2021-10-26 11:42:15 +09:00
parent e7b19cb724
commit 0757044b15

View File

@ -49,15 +49,15 @@ namespace osu.Game.Rulesets.Osu.Mods
protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state) protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state)
{ {
applyHiddenState(hitObject, true, OnlyFadeApproachCircles.Value); applyHiddenState(hitObject, true);
} }
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state) protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state)
{ {
applyHiddenState(hitObject, false, OnlyFadeApproachCircles.Value); applyHiddenState(hitObject, false);
} }
private void applyHiddenState(DrawableHitObject drawableObject, bool hideApproachCircle, bool hideCirclePiece) private void applyHiddenState(DrawableHitObject drawableObject, bool increaseVisibility)
{ {
if (!(drawableObject is DrawableOsuHitObject drawableOsuObject)) if (!(drawableObject is DrawableOsuHitObject drawableOsuObject))
return; return;
@ -66,6 +66,19 @@ namespace osu.Game.Rulesets.Osu.Mods
(double fadeStartTime, double fadeDuration) = getFadeOutParameters(drawableOsuObject); (double fadeStartTime, double fadeDuration) = getFadeOutParameters(drawableOsuObject);
// process approach circle hiding first (to allow for early return below).
if (!increaseVisibility)
{
if (drawableObject is DrawableHitCircle circle)
{
using (circle.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimePreempt))
circle.ApproachCircle.Hide();
}
}
if (OnlyFadeApproachCircles.Value)
return;
switch (drawableObject) switch (drawableObject)
{ {
case DrawableSliderTail _: case DrawableSliderTail _:
@ -84,17 +97,11 @@ namespace osu.Game.Rulesets.Osu.Mods
case DrawableHitCircle circle: case DrawableHitCircle circle:
Drawable fadeTarget = circle; Drawable fadeTarget = circle;
if (hideApproachCircle) if (increaseVisibility)
{ {
// only fade the circle piece (not the approach circle) for the increased visibility object. // only fade the circle piece (not the approach circle) for the increased visibility object.
fadeTarget = circle.CirclePiece; fadeTarget = circle.CirclePiece;
} }
else
{
// we don't want to see the approach circle
using (circle.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimePreempt))
circle.ApproachCircle.Hide();
}
using (drawableObject.BeginAbsoluteSequence(fadeStartTime)) using (drawableObject.BeginAbsoluteSequence(fadeStartTime))
fadeTarget.FadeOut(fadeDuration); fadeTarget.FadeOut(fadeDuration);