mirror of
https://github.com/ppy/osu
synced 2025-01-02 20:32:10 +00:00
Add ability to disallow falling back to parent skins
This commit is contained in:
parent
11b78ad849
commit
ebe0d43790
@ -38,6 +38,11 @@ namespace osu.Game.Skinning
|
||||
[CanBeNull]
|
||||
private ISkinSource fallbackSource;
|
||||
|
||||
/// <summary>
|
||||
/// Whether falling back to parent <see cref="ISkinSource"/>s is allowed in this container.
|
||||
/// </summary>
|
||||
protected virtual bool AllowFallingBackToParent => true;
|
||||
|
||||
protected virtual bool AllowDrawableLookup(ISkinComponent component) => true;
|
||||
|
||||
protected virtual bool AllowTextureLookup(string componentName) => true;
|
||||
@ -180,9 +185,12 @@ namespace osu.Game.Skinning
|
||||
{
|
||||
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||
|
||||
fallbackSource = dependencies.Get<ISkinSource>();
|
||||
if (fallbackSource != null)
|
||||
fallbackSource.SourceChanged += OnSourceChanged;
|
||||
if (AllowFallingBackToParent)
|
||||
{
|
||||
fallbackSource = dependencies.Get<ISkinSource>();
|
||||
if (fallbackSource != null)
|
||||
fallbackSource.SourceChanged += OnSourceChanged;
|
||||
}
|
||||
|
||||
dependencies.CacheAs<ISkinSource>(this);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user