Move HasFont to legacy skin extensions class instead

This commit is contained in:
Salman Ahmed 2020-08-19 07:58:23 +03:00
parent 4dbf695bca
commit 422100192c
4 changed files with 5 additions and 4 deletions

View File

@ -58,7 +58,7 @@ public override Drawable GetDrawableComponent(ISkinComponent component)
var fontOverlap = GetConfig<LegacySetting, float>(LegacySetting.ComboOverlap)?.Value ?? -2f;
// For simplicity, let's use legacy combo font texture existence as a way to identify legacy skins from default.
if (HasFont(comboFont))
if (this.HasFont(comboFont))
return new LegacyComboCounter(Source, comboFont, fontOverlap);
break;

View File

@ -94,7 +94,7 @@ public override Drawable GetDrawableComponent(ISkinComponent component)
var font = GetConfig<OsuSkinConfiguration, string>(OsuSkinConfiguration.HitCirclePrefix)?.Value ?? "default";
var overlap = GetConfig<OsuSkinConfiguration, float>(OsuSkinConfiguration.HitCircleOverlap)?.Value ?? -2;
return !HasFont(font)
return !this.HasFont(font)
? null
: new LegacySpriteText(Source, font)
{

View File

@ -62,6 +62,9 @@ IEnumerable<Texture> getTextures()
}
}
public static bool HasFont(this ISkin source, string fontPrefix)
=> source.GetTexture($"{fontPrefix}-0") != null;
public class SkinnableTextureAnimation : TextureAnimation
{
[Resolved(canBeNull: true)]

View File

@ -47,7 +47,5 @@ public virtual SampleChannel GetSample(ISampleInfo sampleInfo)
}
public abstract IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup);
protected bool HasFont(string fontPrefix) => GetTexture($"{fontPrefix}-0") != null;
}
}