mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 08:32:57 +08:00
Return default combo colours if none provided
This commit is contained in:
parent
281671a213
commit
5e3f0f6c95
@ -77,8 +77,6 @@ namespace osu.Game.Beatmaps.Formats
|
||||
return line;
|
||||
}
|
||||
|
||||
private bool hasComboColours;
|
||||
|
||||
private void handleColours(T output, string line)
|
||||
{
|
||||
var pair = SplitKeyVal(line);
|
||||
@ -105,13 +103,6 @@ namespace osu.Game.Beatmaps.Formats
|
||||
{
|
||||
if (!(output is IHasComboColours tHasComboColours)) return;
|
||||
|
||||
if (!hasComboColours)
|
||||
{
|
||||
// remove default colours.
|
||||
tHasComboColours.ComboColours.Clear();
|
||||
hasComboColours = true;
|
||||
}
|
||||
|
||||
tHasComboColours.ComboColours.Add(colour);
|
||||
}
|
||||
else
|
||||
|
@ -9,6 +9,9 @@ namespace osu.Game.Skinning
|
||||
{
|
||||
public class LegacyBeatmapSkin : LegacySkin
|
||||
{
|
||||
// Null should be returned in the case of no colours provided to fallback into current skin's colours.
|
||||
protected override bool AllowDefaultColoursFallback => false;
|
||||
|
||||
public LegacyBeatmapSkin(BeatmapInfo beatmap, IResourceStore<byte[]> storage, AudioManager audioManager)
|
||||
: base(createSkinInfo(beatmap), new LegacySkinResourceStore<BeatmapSetFileInfo>(beatmap.BeatmapSet, storage), audioManager, beatmap.Path)
|
||||
{
|
||||
|
@ -26,6 +26,11 @@ namespace osu.Game.Skinning
|
||||
[CanBeNull]
|
||||
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)
|
||||
: this(skin, new LegacySkinResourceStore<SkinFileInfo>(skin, storage), audioManager, "skin.ini")
|
||||
{
|
||||
@ -63,7 +68,12 @@ namespace osu.Game.Skinning
|
||||
switch (global)
|
||||
{
|
||||
case GlobalSkinConfiguration.ComboColours:
|
||||
return SkinUtils.As<TValue>(new Bindable<List<Color4>>(Configuration.ComboColours));
|
||||
if (Configuration.ComboColours.Any())
|
||||
return SkinUtils.As<TValue>(new Bindable<List<Color4>>(Configuration.ComboColours));
|
||||
else if (AllowDefaultColoursFallback)
|
||||
return SkinUtils.As<TValue>(new Bindable<List<Color4>>(new DefaultSkinConfiguration().ComboColours));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user