Cleanup code in ModHidden

This commit is contained in:
PercyDan54 2021-05-14 21:23:56 +08:00
parent a1d63243a4
commit 67dfeeb1b7
No known key found for this signature in database
GPG Key ID: 6AEA7C525131BAF3
3 changed files with 8 additions and 43 deletions

View File

@ -54,7 +54,7 @@ namespace osu.Game.Rulesets.Catch.Mods
var offset = hitObject.TimePreempt * fade_out_offset_multiplier; var offset = hitObject.TimePreempt * fade_out_offset_multiplier;
var duration = offset - hitObject.TimePreempt * fade_out_duration_multiplier; var duration = offset - hitObject.TimePreempt * fade_out_duration_multiplier;
using (drawable.BeginAbsoluteSequence(hitObject.StartTime - offset, true)) using (drawable.BeginAbsoluteSequence(hitObject.StartTime - offset))
drawable.FadeOut(duration); drawable.FadeOut(duration);
} }
} }

View File

@ -65,13 +65,13 @@ namespace osu.Game.Rulesets.Osu.Mods
switch (drawableObject) switch (drawableObject)
{ {
case DrawableSliderTail _: case DrawableSliderTail _:
using (drawableObject.BeginAbsoluteSequence(fadeOut.startTime, true)) using (drawableObject.BeginAbsoluteSequence(fadeOut.startTime))
drawableObject.FadeOut(fadeOut.duration); drawableObject.FadeOut(fadeOut.duration);
break; break;
case DrawableSliderRepeat sliderRepeat: case DrawableSliderRepeat sliderRepeat:
using (drawableObject.BeginAbsoluteSequence(fadeOut.startTime, true)) using (drawableObject.BeginAbsoluteSequence(fadeOut.startTime))
// only apply to circle piece reverse arrow is not affected by hidden. // only apply to circle piece reverse arrow is not affected by hidden.
sliderRepeat.CirclePiece.FadeOut(fadeOut.duration); sliderRepeat.CirclePiece.FadeOut(fadeOut.duration);
@ -88,22 +88,22 @@ namespace osu.Game.Rulesets.Osu.Mods
else else
{ {
// we don't want to see the approach circle // we don't want to see the approach circle
using (circle.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimePreempt, true)) using (circle.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimePreempt))
circle.ApproachCircle.Hide(); circle.ApproachCircle.Hide();
} }
using (drawableObject.BeginAbsoluteSequence(fadeOut.startTime, true)) using (drawableObject.BeginAbsoluteSequence(fadeOut.startTime))
fadeTarget.FadeOut(fadeOut.duration); fadeTarget.FadeOut(fadeOut.duration);
break; break;
case DrawableSlider slider: case DrawableSlider slider:
using (slider.BeginAbsoluteSequence(fadeOut.startTime, true)) using (slider.BeginAbsoluteSequence(fadeOut.startTime))
slider.Body.FadeOut(fadeOut.duration, Easing.Out); slider.Body.FadeOut(fadeOut.duration, Easing.Out);
break; break;
case DrawableSliderTick sliderTick: case DrawableSliderTick sliderTick:
using (sliderTick.BeginAbsoluteSequence(fadeOut.startTime, true)) using (sliderTick.BeginAbsoluteSequence(fadeOut.startTime))
sliderTick.FadeOut(fadeOut.duration); sliderTick.FadeOut(fadeOut.duration);
break; break;
@ -112,7 +112,7 @@ namespace osu.Game.Rulesets.Osu.Mods
// hide elements we don't care about. // hide elements we don't care about.
// todo: hide background // todo: hide background
using (spinner.BeginAbsoluteSequence(fadeOut.startTime, true)) using (spinner.BeginAbsoluteSequence(fadeOut.startTime))
spinner.FadeOut(fadeOut.duration); spinner.FadeOut(fadeOut.duration);
break; break;

View File

@ -1,7 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
@ -18,14 +17,6 @@ namespace osu.Game.Rulesets.Mods
public override ModType Type => ModType.DifficultyIncrease; public override ModType Type => ModType.DifficultyIncrease;
public override bool Ranked => true; public override bool Ranked => true;
/// <summary>
/// Check whether the provided hitobject should be considered the "first" hideable object.
/// Can be used to skip spinners, for instance.
/// </summary>
/// <param name="hitObject">The hitobject to check.</param>
[Obsolete("Use IsFirstAdjustableObject() instead.")] // Can be removed 20210506
protected virtual bool IsFirstHideableObject(DrawableHitObject hitObject) => true;
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor) public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
{ {
// Default value of ScoreProcessor's Rank in Hidden Mod should be SS+ // Default value of ScoreProcessor's Rank in Hidden Mod should be SS+
@ -49,36 +40,10 @@ namespace osu.Game.Rulesets.Mods
protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state) protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state)
{ {
#pragma warning disable 618
ApplyFirstObjectIncreaseVisibilityState(hitObject, state);
#pragma warning restore 618
} }
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state) protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state)
{ {
#pragma warning disable 618
ApplyHiddenState(hitObject, state);
#pragma warning restore 618
}
/// <summary>
/// Apply a special visibility state to the first object in a beatmap, if the user chooses to turn on the "increase first object visibility" setting.
/// </summary>
/// <param name="hitObject">The hit object to apply the state change to.</param>
/// <param name="state">The state of the hit object.</param>
[Obsolete("Use ApplyIncreasedVisibilityState() instead.")] // Can be removed 20210506
protected virtual void ApplyFirstObjectIncreaseVisibilityState(DrawableHitObject hitObject, ArmedState state)
{
}
/// <summary>
/// Apply a hidden state to the provided object.
/// </summary>
/// <param name="hitObject">The hit object to apply the state change to.</param>
/// <param name="state">The state of the hit object.</param>
[Obsolete("Use ApplyNormalVisibilityState() instead.")] // Can be removed 20210506
protected virtual void ApplyHiddenState(DrawableHitObject hitObject, ArmedState state)
{
} }
} }
} }