1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-05 13:13:22 +08:00

Revert "Expose the skin lookup layers of SkinManager to a property"

This reverts commit 9e652715ce.
This commit is contained in:
Salman Ahmed 2021-06-10 11:57:28 +03:00
parent 530026b675
commit 58cca9da06

View File

@ -42,24 +42,6 @@ namespace osu.Game.Skinning
public readonly Bindable<Skin> CurrentSkin = new Bindable<Skin>(); public readonly Bindable<Skin> CurrentSkin = new Bindable<Skin>();
public readonly Bindable<SkinInfo> CurrentSkinInfo = new Bindable<SkinInfo>(SkinInfo.Default) { Default = SkinInfo.Default }; public readonly Bindable<SkinInfo> CurrentSkinInfo = new Bindable<SkinInfo>(SkinInfo.Default) { Default = SkinInfo.Default };
/// <summary>
/// The skin layers of the currently selected user skin for performing lookups on,
/// in order of preference (user skin first, then fallback skins).
/// </summary>
public IEnumerable<ISkin> CurrentSkinLayers
{
get
{
yield return CurrentSkin.Value;
// TODO: we also want to return a DefaultLegacySkin here if the current *beatmap* is providing any skinned elements.
// When attempting to address this, we may want to move the full DefaultLegacySkin fallback logic to within Player itself (to better allow
// for beatmap skin visibility).
if (CurrentSkin.Value is LegacySkin)
yield return defaultLegacySkin;
}
}
public override IEnumerable<string> HandledExtensions => new[] { ".osk" }; public override IEnumerable<string> HandledExtensions => new[] { ".osk" };
protected override string[] HashableFileTypes => new[] { ".ini" }; protected override string[] HashableFileTypes => new[] { ".ini" };
@ -238,11 +220,11 @@ namespace osu.Game.Skinning
public ISkin FindProvider(Func<ISkin, bool> lookupFunction) public ISkin FindProvider(Func<ISkin, bool> lookupFunction)
{ {
foreach (var skin in CurrentSkinLayers) if (lookupFunction(CurrentSkin.Value))
{ return CurrentSkin.Value;
if (lookupFunction(skin))
return skin; if (CurrentSkin.Value is LegacySkin && lookupFunction(defaultLegacySkin))
} return defaultLegacySkin;
return null; return null;
} }
@ -250,12 +232,16 @@ namespace osu.Game.Skinning
private T lookupWithFallback<T>(Func<ISkin, T> func) private T lookupWithFallback<T>(Func<ISkin, T> func)
where T : class where T : class
{ {
foreach (var skin in CurrentSkinLayers) var selectedSkin = func(CurrentSkin.Value);
{
var result = func(skin); if (selectedSkin != null)
if (result != null) return selectedSkin;
return result;
} // TODO: we also want to return a DefaultLegacySkin here if the current *beatmap* is providing any skinned elements.
// When attempting to address this, we may want to move the full DefaultLegacySkin fallback logic to within Player itself (to better allow
// for beatmap skin visibility).
if (CurrentSkin.Value is LegacySkin)
return func(defaultLegacySkin);
return null; return null;
} }