Avoid applying state transforms when no object is present

This commit is contained in:
Salman Ahmed 2022-04-19 08:08:02 +03:00
parent fd113953ac
commit b067924ada

View File

@ -4,6 +4,7 @@
using JetBrains.Annotations; using JetBrains.Annotations;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
@ -137,16 +138,17 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
indexInCurrentCombo.BindValueChanged(index => hitCircleText.Text = (index.NewValue + 1).ToString(), true); indexInCurrentCombo.BindValueChanged(index => hitCircleText.Text = (index.NewValue + 1).ToString(), true);
if (drawableObject != null) if (drawableObject != null)
{
drawableObject.ApplyCustomUpdateState += updateStateTransforms; drawableObject.ApplyCustomUpdateState += updateStateTransforms;
updateStateTransforms(drawableObject, drawableObject.State.Value);
updateStateTransforms(drawableObject, drawableObject?.State.Value ?? ArmedState.Idle); }
} }
private void updateStateTransforms(DrawableHitObject drawableHitObject, ArmedState state) private void updateStateTransforms(DrawableHitObject drawableHitObject, ArmedState state)
{ {
const double legacy_fade_duration = 240; const double legacy_fade_duration = 240;
using (BeginAbsoluteSequence(drawableObject?.HitStateUpdateTime ?? 0)) using (BeginAbsoluteSequence(drawableObject.AsNonNull().HitStateUpdateTime))
{ {
switch (state) switch (state)
{ {