Add support for animated legacy hit circle overlay

This commit is contained in:
Bartłomiej Dach 2021-12-28 15:53:54 +01:00
parent b29c2bf9f3
commit eea0fea69f
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497
1 changed files with 16 additions and 2 deletions

View File

@ -69,7 +69,6 @@ private void load()
// at this point, any further texture fetches should be correctly using the priority source if the base texture was retrieved using it.
// the flow above handles the case where a sliderendcircle.png is retrieved from the skin, but sliderendcircleoverlay.png doesn't exist.
// expected behaviour in this scenario is not showing the overlay, rather than using hitcircleoverlay.png (potentially from the default/fall-through skin).
Texture overlayTexture = getTextureWithFallback("overlay");
InternalChildren = new[]
{
@ -82,7 +81,7 @@ private void load()
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Child = hitCircleOverlay = new KiaiFlashingDrawable(() => new Sprite { Texture = overlayTexture })
Child = hitCircleOverlay = new KiaiFlashingDrawable(() => getAnimationWithFallback(@"overlay", 1000 / 2d))
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
@ -125,6 +124,21 @@ Texture getTextureWithFallback(string name)
return tex ?? skin.GetTexture($"hitcircle{name}");
}
Drawable getAnimationWithFallback(string name, double frameLength)
{
Drawable animation = null;
if (!string.IsNullOrEmpty(priorityLookup))
{
animation = skin.GetAnimation($"{priorityLookup}{name}", true, true, frameLength: frameLength);
if (!allowFallback)
return animation;
}
return animation ?? skin.GetAnimation($"hitcircle{name}", true, true, frameLength: frameLength);
}
}
protected override void LoadComplete()