From 7a92c7ab7e0c2c888845f0a16dbf8189ecc50ea2 Mon Sep 17 00:00:00 2001 From: Roxie Wattz Date: Mon, 25 Oct 2021 00:25:32 -0700 Subject: [PATCH] Move condition to separate switch statement No clue if this is how peppy wanted me to do it but it still works --- .../Mods/TestSceneOsuModHidden.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs | 107 +++++++++++------- 2 files changed, 65 insertions(+), 44 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModHidden.cs b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModHidden.cs index f25df90737..1fd601cec5 100644 --- a/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModHidden.cs +++ b/osu.Game.Rulesets.Osu.Tests/Mods/TestSceneOsuModHidden.cs @@ -120,7 +120,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods [Test] public void OuendanTwoHidden() => CreateModTest(new ModTestData { - Mod = new OsuModHidden { NoHitCircles = { Value = true } }, + Mod = new OsuModHidden { OnlyFadeApproachCircles = { Value = true } }, Autoplay = true, Beatmap = new Beatmap { diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs b/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs index 59ac6746a0..12e2035e80 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs @@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Mods public class OsuModHidden : ModHidden, IHidesApproachCircles { [SettingSource("Only fade approach circles", "The main object body will not fade when enabled.")] - public Bindable NoHitCircles { get; } = new BindableBool(false); + public Bindable OnlyFadeApproachCircles { get; } = new BindableBool(false); public override string Description => @"Play with no approach circles and fading circles/sliders."; public override double ScoreMultiplier => 1.06; @@ -67,69 +67,90 @@ namespace osu.Game.Rulesets.Osu.Mods (double fadeStartTime, double fadeDuration) = getFadeOutParameters(drawableOsuObject); - switch (drawableObject) + if (!OnlyFadeApproachCircles.Value) { - case DrawableSliderTail _: - using (drawableObject.BeginAbsoluteSequence(fadeStartTime)) - if (!NoHitCircles.Value) + switch (drawableObject) + { + case DrawableSliderTail _: + using (drawableObject.BeginAbsoluteSequence(fadeStartTime)) drawableObject.FadeOut(fadeDuration); - break; + break; - case DrawableSliderRepeat sliderRepeat: - using (drawableObject.BeginAbsoluteSequence(fadeStartTime)) - // only apply to circle piece – reverse arrow is not affected by hidden. - if (!NoHitCircles.Value) + case DrawableSliderRepeat sliderRepeat: + using (drawableObject.BeginAbsoluteSequence(fadeStartTime)) + // only apply to circle piece – reverse arrow is not affected by hidden. sliderRepeat.CirclePiece.FadeOut(fadeDuration); - break; + break; - case DrawableHitCircle circle: - Drawable fadeTarget = circle; + case DrawableHitCircle circle: + Drawable fadeTarget = circle; - if (increaseVisibility) - { - // only fade the circle piece (not the approach circle) for the increased visibility object. - if (!NoHitCircles.Value) + if (increaseVisibility) + { + // only fade the circle piece (not the approach circle) for the increased visibility object. fadeTarget = circle.CirclePiece; - } - else - { - // we don't want to see the approach circle - using (circle.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimePreempt)) - circle.ApproachCircle.Hide(); - } + } + else + { + // we don't want to see the approach circle + using (circle.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimePreempt)) + circle.ApproachCircle.Hide(); + } - using (drawableObject.BeginAbsoluteSequence(fadeStartTime)) - if (!NoHitCircles.Value) + using (drawableObject.BeginAbsoluteSequence(fadeStartTime)) fadeTarget.FadeOut(fadeDuration); - break; + break; - case DrawableSlider slider: - using (slider.BeginAbsoluteSequence(fadeStartTime)) - if (!NoHitCircles.Value) + case DrawableSlider slider: + using (slider.BeginAbsoluteSequence(fadeStartTime)) slider.Body.FadeOut(fadeDuration, Easing.Out); - break; + break; - case DrawableSliderTick sliderTick: - using (sliderTick.BeginAbsoluteSequence(fadeStartTime)) - if (!NoHitCircles.Value) + case DrawableSliderTick sliderTick: + using (sliderTick.BeginAbsoluteSequence(fadeStartTime)) sliderTick.FadeOut(fadeDuration); - break; + break; - case DrawableSpinner spinner: - // hide elements we don't care about. - // todo: hide background + case DrawableSpinner spinner: + // hide elements we don't care about. + // todo: hide background - spinner.Body.OnSkinChanged += () => hideSpinnerApproachCircle(spinner); - hideSpinnerApproachCircle(spinner); + spinner.Body.OnSkinChanged += () => hideSpinnerApproachCircle(spinner); + hideSpinnerApproachCircle(spinner); - using (spinner.BeginAbsoluteSequence(fadeStartTime)) - spinner.FadeOut(fadeDuration); + using (spinner.BeginAbsoluteSequence(fadeStartTime)) + spinner.FadeOut(fadeDuration); - break; + break; + } + } else + { + switch(drawableObject) + { + case DrawableHitCircle circle: + if (!increaseVisibility) + { + // we don't want to see the approach circle + using (circle.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimePreempt)) + circle.ApproachCircle.Hide(); + } + break; + + case DrawableSpinner spinner: + // hide elements we don't care about. + // todo: hide background + + spinner.Body.OnSkinChanged += () => hideSpinnerApproachCircle(spinner); + hideSpinnerApproachCircle(spinner); + break; + + default: + break; + } } }