Skip to content

Commit

Permalink
Here's no need to read the skin from default skin.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Oct 10, 2022
1 parent c004c84 commit f00aa30
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ namespace osu.Game.Rulesets.Karaoke.Skinning.Legacy
public class KaraokeLegacySkinTransformer : LegacySkinTransformer
{
private readonly Lazy<bool> isLegacySkin;
private readonly KaraokeBeatmapSkin defaultKaraokeSkin;
private readonly KaraokeBeatmapSkin karaokeSkin;

public KaraokeLegacySkinTransformer(ISkin source, IBeatmap beatmap)
: base(source)
{
// we should get config by default karaoke skin.
// if has resource or texture, then try to get from legacy skin.
defaultKaraokeSkin = new KaraokeBeatmapSkin(new SkinInfo(), new InternalSkinStorageResourceProvider("Default"));
karaokeSkin = new KaraokeBeatmapSkin(new SkinInfo(), new InternalSkinStorageResourceProvider("Default"));
isLegacySkin = new Lazy<bool>(() => GetConfig<SkinConfiguration.LegacySetting, decimal>(SkinConfiguration.LegacySetting.Version) != null);
}

Expand Down Expand Up @@ -82,10 +82,7 @@ public KaraokeLegacySkinTransformer(ISkin source, IBeatmap beatmap)
}

public override IBindable<TValue>? GetConfig<TLookup, TValue>(TLookup lookup)
{
var config = defaultKaraokeSkin.GetConfig<TLookup, TValue>(lookup);
return config ?? base.GetConfig<TLookup, TValue>(lookup);
}
=> karaokeSkin.GetConfig<TLookup, TValue>(lookup);

// it's a temp class for just getting SkinnableTarget.MainHUDComponents
private class TempLegacySkin : LegacySkin
Expand Down

0 comments on commit f00aa30

Please sign in to comment.