1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 13:23:22 +08:00

Replace AllowDefaultHUDComponentsFallback with a temporary override at LegacyBeatmapSkin

This commit is contained in:
Salman Ahmed 2021-05-17 21:28:14 +03:00
parent df248ea41b
commit f667ea3fd0
2 changed files with 14 additions and 9 deletions

View File

@ -3,6 +3,7 @@
using osu.Framework.Audio.Sample; using osu.Framework.Audio.Sample;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.IO.Stores; using osu.Framework.IO.Stores;
using osu.Game.Audio; using osu.Game.Audio;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
@ -14,7 +15,6 @@ namespace osu.Game.Skinning
public class LegacyBeatmapSkin : LegacySkin public class LegacyBeatmapSkin : LegacySkin
{ {
protected override bool AllowManiaSkin => false; protected override bool AllowManiaSkin => false;
protected override bool AllowDefaultHUDComponentsFallback => false;
protected override bool UseCustomSampleBanks => true; protected override bool UseCustomSampleBanks => true;
public LegacyBeatmapSkin(BeatmapInfo beatmap, IResourceStore<byte[]> storage, IStorageResourceProvider resources) public LegacyBeatmapSkin(BeatmapInfo beatmap, IResourceStore<byte[]> storage, IStorageResourceProvider resources)
@ -24,6 +24,19 @@ namespace osu.Game.Skinning
Configuration.AllowDefaultComboColoursFallback = false; Configuration.AllowDefaultComboColoursFallback = false;
} }
public override Drawable GetDrawableComponent(ISkinComponent component)
{
if (component is SkinnableTargetComponent targetComponent && targetComponent.Target == SkinnableTarget.MainHUDComponents)
{
// for now, if the beatmap skin doesn't skin the score font, fall back to current skin
// instead of potentially returning default lazer skin HUD components from here.
if (!this.HasFont(LegacyFont.Score))
return null;
}
return base.GetDrawableComponent(component);
}
public override IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) public override IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup)
{ {
switch (lookup) switch (lookup)

View File

@ -38,11 +38,6 @@ namespace osu.Game.Skinning
protected virtual bool AllowManiaSkin => hasKeyTexture.Value; protected virtual bool AllowManiaSkin => hasKeyTexture.Value;
/// <summary>
/// Whether this skin will fall back to default HUD components if it has no fonts for use.
/// </summary>
protected virtual bool AllowDefaultHUDComponentsFallback => true;
/// <summary> /// <summary>
/// Whether this skin can use samples with a custom bank (custom sample set in stable terminology). /// Whether this skin can use samples with a custom bank (custom sample set in stable terminology).
/// Added in order to match sample lookup logic from stable (in stable, only the beatmap skin could use samples with a custom sample bank). /// Added in order to match sample lookup logic from stable (in stable, only the beatmap skin could use samples with a custom sample bank).
@ -336,9 +331,6 @@ namespace osu.Game.Skinning
switch (target.Target) switch (target.Target)
{ {
case SkinnableTarget.MainHUDComponents: case SkinnableTarget.MainHUDComponents:
if (!this.HasFont(LegacyFont.Score) && !AllowDefaultHUDComponentsFallback)
return null;
var skinnableTargetWrapper = new SkinnableTargetComponentsContainer(container => var skinnableTargetWrapper = new SkinnableTargetComponentsContainer(container =>
{ {
var score = container.OfType<LegacyScoreCounter>().FirstOrDefault(); var score = container.OfType<LegacyScoreCounter>().FirstOrDefault();