mirror of
https://github.com/osukey/osukey.git
synced 2025-05-17 03:27:21 +09:00
Merge pull request #18977 from goodtrailer/stable-slider-ball-fadeout
Imitate stable's slider ball fade in/out animation
This commit is contained in:
commit
c07ee80dbe
@ -1,12 +1,12 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
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;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -18,8 +18,11 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
|
|
||||||
private readonly ISkin skin;
|
private readonly ISkin skin;
|
||||||
|
|
||||||
private Sprite layerNd;
|
[Resolved(canBeNull: true)]
|
||||||
private Sprite layerSpec;
|
private DrawableHitObject? parentObject { get; set; }
|
||||||
|
|
||||||
|
private Sprite layerNd = null!;
|
||||||
|
private Sprite layerSpec = null!;
|
||||||
|
|
||||||
public LegacySliderBall(Drawable animationContent, ISkin skin)
|
public LegacySliderBall(Drawable animationContent, ISkin skin)
|
||||||
{
|
{
|
||||||
@ -58,6 +61,17 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
if (parentObject != null)
|
||||||
|
{
|
||||||
|
parentObject.ApplyCustomUpdateState += updateStateTransforms;
|
||||||
|
updateStateTransforms(parentObject, parentObject.State.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override void UpdateAfterChildren()
|
protected override void UpdateAfterChildren()
|
||||||
{
|
{
|
||||||
base.UpdateAfterChildren();
|
base.UpdateAfterChildren();
|
||||||
@ -68,5 +82,28 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
layerNd.Rotation = -appliedRotation;
|
layerNd.Rotation = -appliedRotation;
|
||||||
layerSpec.Rotation = -appliedRotation;
|
layerSpec.Rotation = -appliedRotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateStateTransforms(DrawableHitObject drawableObject, ArmedState _)
|
||||||
|
{
|
||||||
|
// Gets called by slider ticks, tails, etc., leading to duplicated
|
||||||
|
// animations which in this case have no visual impact (due to
|
||||||
|
// instant fade) but may negatively affect performance
|
||||||
|
if (drawableObject is not DrawableSlider)
|
||||||
|
return;
|
||||||
|
|
||||||
|
using (BeginAbsoluteSequence(drawableObject.StateUpdateTime))
|
||||||
|
this.FadeIn();
|
||||||
|
|
||||||
|
using (BeginAbsoluteSequence(drawableObject.HitStateUpdateTime))
|
||||||
|
this.FadeOut();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
|
||||||
|
if (parentObject != null)
|
||||||
|
parentObject.ApplyCustomUpdateState -= updateStateTransforms;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user