Add support for indexless mascot texture lookups

This commit is contained in:
Bartłomiej Dach 2020-07-25 12:03:54 +02:00
parent 897ab4a9bb
commit ea3ef37f9a
2 changed files with 9 additions and 5 deletions

View File

@ -91,10 +91,7 @@ public override Drawable GetDrawableComponent(ISkinComponent component)
return null; return null;
case TaikoSkinComponents.Mascot: case TaikoSkinComponents.Mascot:
if (GetTexture("pippidonclear0") != null) return new DrawableTaikoMascot();
return new DrawableTaikoMascot();
return null;
} }
return Source.GetDrawableComponent(component); return Source.GetDrawableComponent(component);

View File

@ -128,6 +128,13 @@ private void load(ISkinSource skin)
} }
private static Texture getAnimationFrame(ISkin skin, TaikoMascotAnimationState state, int frameIndex) private static Texture getAnimationFrame(ISkin skin, TaikoMascotAnimationState state, int frameIndex)
=> skin.GetTexture($"pippidon{state.ToString().ToLower()}{frameIndex}"); {
var texture = skin.GetTexture($"pippidon{state.ToString().ToLower()}{frameIndex}");
if (frameIndex == 0 && texture == null)
texture = skin.GetTexture($"pippidon{state.ToString().ToLower()}");
return texture;
}
} }
} }