mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 10:33:30 +08:00
Avoid doing a config lookup if initial conditional fails
This commit is contained in:
parent
1364de1166
commit
94fee8c31d
@ -74,8 +74,8 @@ namespace osu.Game.Skinning
|
|||||||
{
|
{
|
||||||
if (lookup is GlobalSkinColours || lookup is SkinCustomColourLookup)
|
if (lookup is GlobalSkinColours || lookup is SkinCustomColourLookup)
|
||||||
return lookupWithFallback<TLookup, TValue>(lookup, AllowColourLookup);
|
return lookupWithFallback<TLookup, TValue>(lookup, AllowColourLookup);
|
||||||
else
|
|
||||||
return lookupWithFallback<TLookup, TValue>(lookup, AllowConfigurationLookup);
|
return lookupWithFallback<TLookup, TValue>(lookup, AllowConfigurationLookup);
|
||||||
}
|
}
|
||||||
|
|
||||||
return fallbackSource?.GetConfig<TLookup, TValue>(lookup);
|
return fallbackSource?.GetConfig<TLookup, TValue>(lookup);
|
||||||
@ -83,11 +83,14 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
private IBindable<TValue> lookupWithFallback<TLookup, TValue>(TLookup lookup, bool canUseSkinLookup)
|
private IBindable<TValue> lookupWithFallback<TLookup, TValue>(TLookup lookup, bool canUseSkinLookup)
|
||||||
{
|
{
|
||||||
var bindable = skin.GetConfig<TLookup, TValue>(lookup);
|
if (canUseSkinLookup)
|
||||||
if (bindable != null && canUseSkinLookup)
|
{
|
||||||
return bindable;
|
var bindable = skin.GetConfig<TLookup, TValue>(lookup);
|
||||||
else
|
if (bindable != null)
|
||||||
return fallbackSource?.GetConfig<TLookup, TValue>(lookup);
|
return bindable;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fallbackSource?.GetConfig<TLookup, TValue>(lookup);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void TriggerSourceChanged() => SourceChanged?.Invoke();
|
protected virtual void TriggerSourceChanged() => SourceChanged?.Invoke();
|
||||||
|
Loading…
Reference in New Issue
Block a user