1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 05:32:54 +08:00

Move fallback allowance to the skin configuration only.

This commit is contained in:
iiSaLMaN 2019-11-07 15:55:34 +03:00
parent 808543885f
commit 9874ce49ce
3 changed files with 7 additions and 12 deletions

View File

@ -9,12 +9,11 @@ namespace osu.Game.Skinning
{ {
public class LegacyBeatmapSkin : LegacySkin public class LegacyBeatmapSkin : LegacySkin
{ {
// Disallow default colours fallback on beatmap skins to allow using parent skin combo colours. (via SkinProvidingContainer)
protected override bool AllowDefaultColoursFallback => false;
public LegacyBeatmapSkin(BeatmapInfo beatmap, IResourceStore<byte[]> storage, AudioManager audioManager) public LegacyBeatmapSkin(BeatmapInfo beatmap, IResourceStore<byte[]> storage, AudioManager audioManager)
: base(createSkinInfo(beatmap), new LegacySkinResourceStore<BeatmapSetFileInfo>(beatmap.BeatmapSet, storage), audioManager, beatmap.Path) : base(createSkinInfo(beatmap), new LegacySkinResourceStore<BeatmapSetFileInfo>(beatmap.BeatmapSet, storage), audioManager, beatmap.Path)
{ {
// Disallow default colours fallback on beatmap skins to allow using parent skin combo colours. (via SkinProvidingContainer)
Configuration.AllowDefaultComboColoursFallback = false;
} }
private static SkinInfo createSkinInfo(BeatmapInfo beatmap) => private static SkinInfo createSkinInfo(BeatmapInfo beatmap) =>

View File

@ -26,11 +26,6 @@ namespace osu.Game.Skinning
[CanBeNull] [CanBeNull]
protected IResourceStore<SampleChannel> Samples; protected IResourceStore<SampleChannel> Samples;
/// <summary>
/// Whether to allow default combo colours as fallback if none provided in this skin.
/// </summary>
protected virtual bool AllowDefaultColoursFallback => true;
public LegacySkin(SkinInfo skin, IResourceStore<byte[]> storage, AudioManager audioManager) public LegacySkin(SkinInfo skin, IResourceStore<byte[]> storage, AudioManager audioManager)
: this(skin, new LegacySkinResourceStore<SkinFileInfo>(skin, storage), audioManager, "skin.ini") : this(skin, new LegacySkinResourceStore<SkinFileInfo>(skin, storage), audioManager, "skin.ini")
{ {
@ -46,8 +41,6 @@ namespace osu.Game.Skinning
else else
Configuration = new SkinConfiguration(); Configuration = new SkinConfiguration();
Configuration.AllowDefaultColoursFallback = AllowDefaultColoursFallback;
if (storage != null) if (storage != null)
{ {
Samples = audioManager?.GetSampleStore(storage); Samples = audioManager?.GetSampleStore(storage);

View File

@ -16,7 +16,10 @@ namespace osu.Game.Skinning
{ {
public readonly SkinInfo SkinInfo = new SkinInfo(); public readonly SkinInfo SkinInfo = new SkinInfo();
internal bool AllowDefaultColoursFallback; /// <summary>
/// Whether to allow <see cref="DefaultComboColours"/> as a fallback list for when no combo colours are provided.
/// </summary>
internal bool AllowDefaultComboColoursFallback = true;
public static List<Color4> DefaultComboColours = new List<Color4> public static List<Color4> DefaultComboColours = new List<Color4>
{ {
@ -35,7 +38,7 @@ namespace osu.Game.Skinning
if (comboColours.Count > 0) if (comboColours.Count > 0)
return comboColours; return comboColours;
if (AllowDefaultColoursFallback) if (AllowDefaultComboColoursFallback)
return DefaultComboColours; return DefaultComboColours;
return null; return null;