1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Move early fade effect to classic mod setting

This commit is contained in:
Adam 2023-02-09 11:15:21 -06:00
parent d027d69913
commit 7bad0113cd
2 changed files with 25 additions and 4 deletions

View File

@ -4,6 +4,7 @@
using System;
using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Configuration;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects;
@ -11,6 +12,7 @@ using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Osu.UI;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Osu.Mods
@ -31,6 +33,9 @@ namespace osu.Game.Rulesets.Osu.Mods
[SettingSource("Always play a slider's tail sample", "Always plays a slider's tail sample regardless of whether it was hit or not.")]
public Bindable<bool> AlwaysPlayTailSample { get; } = new BindableBool(true);
[SettingSource("Fade out hit circles earlier", "Make hit circles fade out into a miss, rather than after it.")]
public Bindable<bool> FadeHitCircleEarly { get; } = new Bindable<bool>(true);
public void ApplyToHitObject(HitObject hitObject)
{
switch (hitObject)
@ -59,12 +64,32 @@ namespace osu.Game.Rulesets.Osu.Mods
{
case DrawableSliderHead head:
head.TrackFollowCircle = !NoSliderHeadMovement.Value;
if (FadeHitCircleEarly.Value)
applyEarlyFading(head);
break;
case DrawableSliderTail tail:
tail.SamplePlaysOnlyOnHit = !AlwaysPlayTailSample.Value;
break;
case DrawableHitCircle circle:
if (FadeHitCircleEarly.Value)
applyEarlyFading(circle);
break;
}
}
private void applyEarlyFading(DrawableHitCircle circle)
{
circle.ApplyCustomUpdateState += (o, _) =>
{
using (o.BeginAbsoluteSequence(o.StateUpdateTime))
{
double mehWindow = o.HitObject.HitWindows.WindowFor(HitResult.Meh);
double lateMissFadeTime = mehWindow / 4 + 15;
o.Delay(mehWindow - lateMissFadeTime).FadeOut(lateMissFadeTime);
}
};
}
}
}

View File

@ -200,10 +200,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
// always fade out at the circle's start time (to match user expectations).
ApproachCircle.FadeOut(50);
double mehWindow = HitObject.HitWindows.WindowFor(HitResult.Meh);
double lateMissFadeTime = mehWindow / 4 + 15;
this.Delay(mehWindow - lateMissFadeTime).FadeOut(lateMissFadeTime);
}
protected override void UpdateHitStateTransforms(ArmedState state)