Simplified colour config checks in SkinProvidingContainer.cs

This commit is contained in:
Mysfit 2021-01-14 16:53:55 -05:00
parent 562634dfd2
commit 99e43c77c2
1 changed files with 6 additions and 15 deletions

View File

@ -10,6 +10,7 @@
using osu.Framework.Graphics.OpenGL.Textures; using osu.Framework.Graphics.OpenGL.Textures;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Game.Audio; using osu.Game.Audio;
using osuTK.Graphics;
namespace osu.Game.Skinning namespace osu.Game.Skinning
{ {
@ -72,22 +73,12 @@ public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup)
{ {
if (skin != null) if (skin != null)
{ {
switch (lookup) TValue tValueTypeCheck = default;
{
// todo: the GlobalSkinColours switch is pulled from LegacySkin and should not exist.
// will likely change based on how databased storage of skin configuration goes.
case GlobalSkinColours global:
switch (global)
{
case GlobalSkinColours.ComboColours:
return getBindable<TLookup, TValue>(lookup, AllowColourLookup);
}
break; if (lookup is GlobalSkinColours || tValueTypeCheck is Color4)
return lookupWithFallback<TLookup, TValue>(lookup, AllowColourLookup);
default: else
return getBindable<TLookup, TValue>(lookup, AllowConfigurationLookup); return lookupWithFallback<TLookup, TValue>(lookup, AllowConfigurationLookup);
}
} }
return fallbackSource?.GetConfig<TLookup, TValue>(lookup); return fallbackSource?.GetConfig<TLookup, TValue>(lookup);