mirror of
https://github.com/ppy/osu
synced 2024-12-23 23:33:36 +00:00
Fix FindProvider
incorrectly returning LegacySkinTransformer
itself
This commit is contained in:
parent
08701b5eab
commit
c0305343bc
@ -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 { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user