From eae853072298e1251f8a0cfdeecb2cead746fa23 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 13 Nov 2022 12:46:20 +0900 Subject: [PATCH] Fix `SkinnableSprite` lookups broken in lazer-first skins Regressed with removal of local `GetTexture` calls in https://github.com/ppy/osu/commit/e19ba65f9186afab21aec536a636d7d152636dde --- osu.Game/Skinning/ArgonSkin.cs | 13 +++---------- osu.Game/Skinning/LegacySkin.cs | 3 --- osu.Game/Skinning/Skin.cs | 4 ++++ osu.Game/Skinning/TrianglesSkin.cs | 13 +++---------- 4 files changed, 10 insertions(+), 23 deletions(-) diff --git a/osu.Game/Skinning/ArgonSkin.cs b/osu.Game/Skinning/ArgonSkin.cs index a2eb07eba3..6a0c4a23e5 100644 --- a/osu.Game/Skinning/ArgonSkin.cs +++ b/osu.Game/Skinning/ArgonSkin.cs @@ -82,21 +82,14 @@ public ArgonSkin(SkinInfo skin, IStorageResourceProvider resources) 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) return c; 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: switch (globalLookup.Lookup) { diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index 98618e3dcd..ea223d172d 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -396,9 +396,6 @@ protected override void ParseConfigurationStream(Stream stream) } return null; - - case SkinnableSprite.SpriteComponentLookup sprite: - return this.GetAnimation(sprite.LookupName, false, false); } return null; diff --git a/osu.Game/Skinning/Skin.cs b/osu.Game/Skinning/Skin.cs index e222b9017c..25d1dc903c 100644 --- a/osu.Game/Skinning/Skin.cs +++ b/osu.Game/Skinning/Skin.cs @@ -158,6 +158,10 @@ public void UpdateDrawableTarget(ISkinnableTarget targetContainer) { 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: if (!DrawableComponentInfo.TryGetValue(target.Lookup, out var skinnableInfo)) return null; diff --git a/osu.Game/Skinning/TrianglesSkin.cs b/osu.Game/Skinning/TrianglesSkin.cs index 2075cfb6f2..62ef94691b 100644 --- a/osu.Game/Skinning/TrianglesSkin.cs +++ b/osu.Game/Skinning/TrianglesSkin.cs @@ -60,21 +60,14 @@ public TrianglesSkin(SkinInfo skin, IStorageResourceProvider resources) 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) return c; 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: switch (target.Lookup) {