mirror of https://github.com/ppy/osu
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:
parent
f20146d446
commit
108a3deb27
|
@ -26,7 +26,7 @@ public RulesetSkinProvidingContainer(Ruleset ruleset, IBeatmap beatmap, [CanBeNu
|
|||
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 @@ protected virtual void UpdateSkins()
|
|||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue