mirror of https://github.com/ppy/osu
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 @@ protected override bool AllowConfigurationLookup
|
||||||
if (beatmapSkins == null)
|
if (beatmapSkins == null)
|
||||||
throw new InvalidOperationException($"{nameof(BeatmapSkinProvidingContainer)} needs to be loaded before being consumed.");
|
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;
|
return beatmapColours.Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,8 @@ public class SkinProvidingContainer : Container, ISkinSource
|
||||||
|
|
||||||
protected virtual bool AllowConfigurationLookup => true;
|
protected virtual bool AllowConfigurationLookup => true;
|
||||||
|
|
||||||
|
protected virtual bool AllowColourLookup => true;
|
||||||
|
|
||||||
public SkinProvidingContainer(ISkin skin)
|
public SkinProvidingContainer(ISkin skin)
|
||||||
{
|
{
|
||||||
this.skin = skin;
|
this.skin = skin;
|
||||||
|
@ -68,13 +70,37 @@ public SampleChannel GetSample(ISampleInfo sampleInfo)
|
||||||
|
|
||||||
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup)
|
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup)
|
||||||
{
|
{
|
||||||
if (AllowConfigurationLookup && skin != null)
|
if (skin != null)
|
||||||
|
{
|
||||||
|
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);
|
var bindable = skin.GetConfig<TLookup, TValue>(lookup);
|
||||||
if (bindable != null)
|
if (bindable != null)
|
||||||
return bindable;
|
return bindable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return fallbackSource?.GetConfig<TLookup, TValue>(lookup);
|
return fallbackSource?.GetConfig<TLookup, TValue>(lookup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue