Merge pull request #21220 from peppy/fix-skinnable-sprite-lookups

Fix `SkinnableSprite` lookups broken in lazer-first skins
This commit is contained in:
Dan Balasescu 2022-11-13 15:46:04 +09:00 committed by GitHub
commit 7b9ed6a4b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 23 deletions

View File

@ -82,21 +82,14 @@ namespace osu.Game.Skinning
public override Drawable? GetDrawableComponent(ISkinComponentLookup lookup) public override Drawable? GetDrawableComponent(ISkinComponentLookup lookup)
{ {
// Temporary until default skin has a valid hit lighting.
if ((lookup as SkinnableSprite.SpriteComponentLookup)?.LookupName == @"lighting") return Drawable.Empty();
if (base.GetDrawableComponent(lookup) is Drawable c) if (base.GetDrawableComponent(lookup) is Drawable c)
return c; return c;
switch (lookup) switch (lookup)
{ {
case SkinnableSprite.SpriteComponentLookup spriteLookup:
switch (spriteLookup.LookupName)
{
// Temporary until default skin has a valid hit lighting.
case @"lighting":
return Drawable.Empty();
}
break;
case GlobalSkinComponentLookup globalLookup: case GlobalSkinComponentLookup globalLookup:
switch (globalLookup.Lookup) switch (globalLookup.Lookup)
{ {

View File

@ -396,9 +396,6 @@ namespace osu.Game.Skinning
} }
return null; return null;
case SkinnableSprite.SpriteComponentLookup sprite:
return this.GetAnimation(sprite.LookupName, false, false);
} }
return null; return null;

View File

@ -158,6 +158,10 @@ namespace osu.Game.Skinning
{ {
switch (lookup) switch (lookup)
{ {
// This fallback is important for user skins which use SkinnableSprites.
case SkinnableSprite.SpriteComponentLookup sprite:
return this.GetAnimation(sprite.LookupName, false, false);
case GlobalSkinComponentLookup target: case GlobalSkinComponentLookup target:
if (!DrawableComponentInfo.TryGetValue(target.Lookup, out var skinnableInfo)) if (!DrawableComponentInfo.TryGetValue(target.Lookup, out var skinnableInfo))
return null; return null;

View File

@ -60,21 +60,14 @@ namespace osu.Game.Skinning
public override Drawable? GetDrawableComponent(ISkinComponentLookup lookup) public override Drawable? GetDrawableComponent(ISkinComponentLookup lookup)
{ {
// Temporary until default skin has a valid hit lighting.
if ((lookup as SkinnableSprite.SpriteComponentLookup)?.LookupName == @"lighting") return Drawable.Empty();
if (base.GetDrawableComponent(lookup) is Drawable c) if (base.GetDrawableComponent(lookup) is Drawable c)
return c; return c;
switch (lookup) switch (lookup)
{ {
case SkinnableSprite.SpriteComponentLookup spriteLookup:
switch (spriteLookup.LookupName)
{
// Temporary until default skin has a valid hit lighting.
case @"lighting":
return Drawable.Empty();
}
break;
case GlobalSkinComponentLookup target: case GlobalSkinComponentLookup target:
switch (target.Lookup) switch (target.Lookup)
{ {