1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Also handle null Ruleset.CreateLegacySkinProvider values

Let's just go this way for now, maybe it's a better choice to always create transformers and disallow null, but it's too much work and out of scope at this point
This commit is contained in:
Salman Ahmed 2021-06-11 16:26:53 +03:00
parent f20146d446
commit 108a3deb27

View File

@ -26,7 +26,7 @@ namespace osu.Game.Skinning
Ruleset = ruleset;
Beatmap = beatmap;
InternalChild = new BeatmapSkinProvidingContainer(beatmapSkin == null ? null : ruleset.CreateLegacySkinProvider(beatmapSkin, beatmap))
InternalChild = new BeatmapSkinProvidingContainer(GetRulesetTransformedSkin(beatmapSkin))
{
Child = Content = new Container
{
@ -54,13 +54,25 @@ namespace osu.Game.Skinning
{
SkinSources.Clear();
SkinSources.Add(Ruleset.CreateLegacySkinProvider(skinManager.CurrentSkin.Value, Beatmap));
SkinSources.Add(GetRulesetTransformedSkin(skinManager.CurrentSkin.Value));
// TODO: we also want to return a DefaultLegacySkin here if the current *beatmap* is providing any skinned elements.
if (skinManager.CurrentSkin.Value is LegacySkin)
SkinSources.Add(Ruleset.CreateLegacySkinProvider(skinManager.DefaultLegacySkin, Beatmap));
SkinSources.Add(GetRulesetTransformedSkin(skinManager.DefaultLegacySkin));
SkinSources.Add(Ruleset.CreateLegacySkinProvider(skinManager.DefaultSkin, Beatmap));
SkinSources.Add(GetRulesetTransformedSkin(skinManager.DefaultSkin));
}
protected ISkin GetRulesetTransformedSkin(ISkin skin)
{
if (skin == null)
return null;
var rulesetTransformed = Ruleset.CreateLegacySkinProvider(skin, Beatmap);
if (rulesetTransformed != null)
return rulesetTransformed;
return skin;
}
}
}