mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 08:32:57 +08:00
Reverted change to AllowConfigurationLookup and added a separate AllowColourLookup bool with config case based on lookup type in SkinProvidingContainer GetConfig call.
This commit is contained in:
parent
80bcd78a48
commit
1248d39d7e
@ -25,6 +25,17 @@ namespace osu.Game.Skinning
|
||||
if (beatmapSkins == null)
|
||||
throw new InvalidOperationException($"{nameof(BeatmapSkinProvidingContainer)} needs to be loaded before being consumed.");
|
||||
|
||||
return beatmapSkins.Value;
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool AllowColourLookup
|
||||
{
|
||||
get
|
||||
{
|
||||
if (beatmapColours == null)
|
||||
throw new InvalidOperationException($"{nameof(BeatmapSkinProvidingContainer)} needs to be loaded before being consumed.");
|
||||
|
||||
return beatmapColours.Value;
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,8 @@ namespace osu.Game.Skinning
|
||||
|
||||
protected virtual bool AllowConfigurationLookup => true;
|
||||
|
||||
protected virtual bool AllowColourLookup => true;
|
||||
|
||||
public SkinProvidingContainer(ISkin skin)
|
||||
{
|
||||
this.skin = skin;
|
||||
@ -68,11 +70,35 @@ namespace osu.Game.Skinning
|
||||
|
||||
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup)
|
||||
{
|
||||
if (AllowConfigurationLookup && skin != null)
|
||||
if (skin != null)
|
||||
{
|
||||
var bindable = skin.GetConfig<TLookup, TValue>(lookup);
|
||||
if (bindable != null)
|
||||
return bindable;
|
||||
switch (lookup)
|
||||
{
|
||||
// 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:
|
||||
var bindable = skin.GetConfig<TLookup, TValue>(lookup);
|
||||
if (bindable != null && AllowColourLookup)
|
||||
return bindable;
|
||||
else
|
||||
return fallbackSource?.GetConfig<TLookup, TValue>(lookup);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
if (AllowConfigurationLookup)
|
||||
{
|
||||
var bindable = skin.GetConfig<TLookup, TValue>(lookup);
|
||||
if (bindable != null)
|
||||
return bindable;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return fallbackSource?.GetConfig<TLookup, TValue>(lookup);
|
||||
|
Loading…
Reference in New Issue
Block a user