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

Fix hitobjects sometimes not fading in completely with HD mod

This commit is contained in:
smoogipoo 2020-11-11 16:35:48 +09:00
parent 09324c4598
commit 5d55af5818
2 changed files with 17 additions and 2 deletions

View File

@ -27,17 +27,23 @@ namespace osu.Game.Rulesets.Osu.Mods
public override void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
{
foreach (var d in drawables)
d.ApplyCustomUpdateState += applyFadeInAdjustment;
{
d.HitObjectApplied += applyFadeInAdjustment;
applyFadeInAdjustment(d);
}
base.ApplyToDrawableHitObjects(drawables);
}
private void applyFadeInAdjustment(DrawableHitObject hitObject, ArmedState state)
private void applyFadeInAdjustment(DrawableHitObject hitObject)
{
if (!(hitObject is DrawableOsuHitObject d))
return;
d.HitObject.TimeFadeIn = d.HitObject.TimePreempt * fade_in_duration_multiplier;
foreach (var nested in d.NestedHitObjects)
applyFadeInAdjustment(nested);
}
private double lastSliderHeadFadeOutStartTime;

View File

@ -26,8 +26,16 @@ namespace osu.Game.Rulesets.Objects.Drawables
[Cached(typeof(DrawableHitObject))]
public abstract class DrawableHitObject : SkinReloadableDrawable
{
/// <summary>
/// Invoked after this <see cref="DrawableHitObject"/>'s applied <see cref="HitObject"/> has had its defaults applied.
/// </summary>
public event Action<DrawableHitObject> DefaultsApplied;
/// <summary>
/// Invoked after a <see cref="HitObject"/> has been applied to this <see cref="DrawableHitObject"/>.
/// </summary>
public event Action<DrawableHitObject> HitObjectApplied;
/// <summary>
/// The <see cref="HitObject"/> currently represented by this <see cref="DrawableHitObject"/>.
/// </summary>
@ -192,6 +200,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
HitObject.DefaultsApplied += onDefaultsApplied;
OnApply(hitObject);
HitObjectApplied?.Invoke(this);
// If not loaded, the state update happens in LoadComplete(). Otherwise, the update is scheduled to allow for lifetime updates.
if (IsLoaded)