1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 03:22:57 +08:00

Fix FindProvider incorrectly returning LegacySkinTransformer itself

This commit is contained in:
Dean Herbert 2021-06-07 23:23:44 +09:00
parent 08701b5eab
commit c0305343bc
2 changed files with 17 additions and 3 deletions

View File

@ -16,7 +16,7 @@ namespace osu.Game.Skinning
/// <summary>
/// Transformer used to handle support of legacy features for individual rulesets.
/// </summary>
public abstract class LegacySkinTransformer : ISkin
public abstract class LegacySkinTransformer : ISkinSource
{
/// <summary>
/// Source of the <see cref="ISkin"/> which is being transformed.
@ -50,5 +50,11 @@ namespace osu.Game.Skinning
public abstract IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup);
public ISkin FindProvider(Func<ISkin, bool> lookupFunction) => Source.FindProvider(lookupFunction);
public event Action SourceChanged
{
add { throw new NotSupportedException(); }
remove { }
}
}
}

View File

@ -46,8 +46,16 @@ namespace osu.Game.Skinning
public ISkin FindProvider(Func<ISkin, bool> lookupFunction)
{
if (skin != null && lookupFunction(skin))
return skin;
if (skin is ISkinSource source)
{
if (source.FindProvider(lookupFunction) is ISkin found)
return found;
}
else if (skin != null)
{
if (lookupFunction(skin))
return skin;
}
return fallbackSource?.FindProvider(lookupFunction);
}