mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 05:53:10 +08:00
Move colours fallback logic to SkinConfiguration.ComboColours getter
This commit is contained in:
parent
8d40c1b733
commit
cef6e2a26b
@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osuTK.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Skinning
|
namespace osu.Game.Skinning
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -12,13 +10,7 @@ namespace osu.Game.Skinning
|
|||||||
{
|
{
|
||||||
public DefaultSkinConfiguration()
|
public DefaultSkinConfiguration()
|
||||||
{
|
{
|
||||||
ComboColours.AddRange(new[]
|
ComboColours = DefaultComboColours;
|
||||||
{
|
|
||||||
new Color4(255, 192, 0, 255),
|
|
||||||
new Color4(0, 202, 0, 255),
|
|
||||||
new Color4(18, 124, 255, 255),
|
|
||||||
new Color4(242, 24, 57, 255),
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,8 @@ 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);
|
||||||
@ -68,10 +70,9 @@ namespace osu.Game.Skinning
|
|||||||
switch (global)
|
switch (global)
|
||||||
{
|
{
|
||||||
case GlobalSkinConfiguration.ComboColours:
|
case GlobalSkinConfiguration.ComboColours:
|
||||||
if (Configuration.ComboColours.Any())
|
var comboColours = Configuration.ComboColours;
|
||||||
return SkinUtils.As<TValue>(new Bindable<List<Color4>>(Configuration.ComboColours));
|
if (comboColours != null)
|
||||||
else if (AllowDefaultColoursFallback)
|
return SkinUtils.As<TValue>(new Bindable<List<Color4>>(comboColours));
|
||||||
return SkinUtils.As<TValue>(new Bindable<List<Color4>>(new DefaultSkinConfiguration().ComboColours));
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,32 @@ namespace osu.Game.Skinning
|
|||||||
{
|
{
|
||||||
public readonly SkinInfo SkinInfo = new SkinInfo();
|
public readonly SkinInfo SkinInfo = new SkinInfo();
|
||||||
|
|
||||||
public List<Color4> ComboColours { get; set; } = new List<Color4>();
|
internal bool AllowDefaultColoursFallback;
|
||||||
|
|
||||||
|
public static List<Color4> DefaultComboColours = new List<Color4>
|
||||||
|
{
|
||||||
|
new Color4(255, 192, 0, 255),
|
||||||
|
new Color4(0, 202, 0, 255),
|
||||||
|
new Color4(18, 124, 255, 255),
|
||||||
|
new Color4(242, 24, 57, 255),
|
||||||
|
};
|
||||||
|
|
||||||
|
private List<Color4> comboColours = new List<Color4>();
|
||||||
|
|
||||||
|
public List<Color4> ComboColours
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (comboColours.Count > 0)
|
||||||
|
return comboColours;
|
||||||
|
|
||||||
|
if (AllowDefaultColoursFallback)
|
||||||
|
return DefaultComboColours;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
set => comboColours = value;
|
||||||
|
}
|
||||||
|
|
||||||
public Dictionary<string, Color4> CustomColours { get; set; } = new Dictionary<string, Color4>();
|
public Dictionary<string, Color4> CustomColours { get; set; } = new Dictionary<string, Color4>();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user