Prepare skin transformer for mania components

This commit is contained in:
smoogipoo 2020-03-30 23:17:32 +09:00
parent 6ff2273b64
commit c1789140d5
1 changed files with 18 additions and 1 deletions

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Textures;
using osu.Framework.Audio.Sample;
@ -15,9 +16,19 @@ public class ManiaLegacySkinTransformer : ISkin
{
private readonly ISkin source;
public ManiaLegacySkinTransformer(ISkin source)
private Lazy<bool> isLegacySkin;
public ManiaLegacySkinTransformer(ISkinSource source)
{
this.source = source;
source.SourceChanged += sourceChanged;
sourceChanged();
}
private void sourceChanged()
{
isLegacySkin = new Lazy<bool>(() => source.GetConfig<LegacySkinConfiguration.LegacySetting, decimal>(LegacySkinConfiguration.LegacySetting.Version) != null);
}
public Drawable GetDrawableComponent(ISkinComponent component)
@ -26,6 +37,12 @@ public Drawable GetDrawableComponent(ISkinComponent component)
{
case GameplaySkinComponent<HitResult> resultComponent:
return getResult(resultComponent);
case ManiaSkinComponent maniaComponent:
if (!isLegacySkin.Value)
return null;
break;
}
return null;