1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 07:42:57 +08:00

Remove TryGetValue as it won't work

This commit is contained in:
Dean Herbert 2019-01-10 14:32:16 +09:00
parent 17bc933db2
commit 0a24d188b4
4 changed files with 0 additions and 30 deletions

View File

@ -22,7 +22,5 @@ namespace osu.Game.Skinning
SampleChannel GetSample(string sampleName); SampleChannel GetSample(string sampleName);
TValue GetValue<TConfiguration, TValue>(Func<TConfiguration, TValue> query) where TConfiguration : SkinConfiguration; TValue GetValue<TConfiguration, TValue>(Func<TConfiguration, TValue> query) where TConfiguration : SkinConfiguration;
bool TryGetValue<TConfiguration, TValue>(Func<TConfiguration, TValue, bool> query, out TValue val) where TConfiguration : SkinConfiguration;
} }
} }

View File

@ -53,22 +53,6 @@ namespace osu.Game.Skinning
return fallbackSource == null ? default : fallbackSource.GetValue(query); return fallbackSource == null ? default : fallbackSource.GetValue(query);
} }
public bool TryGetValue<TConfiguration, TValue>(Func<TConfiguration, TValue, bool> query, out TValue val) where TConfiguration : SkinConfiguration
{
val = default;
if ((source as Skin)?.Configuration is TConfiguration conf)
if (beatmapSkins && query(conf, val))
return true;
if (fallbackSource == null)
{
return false;
}
return fallbackSource.TryGetValue(query, out val);
}
private readonly ISkinSource source; private readonly ISkinSource source;
private ISkinSource fallbackSource; private ISkinSource fallbackSource;

View File

@ -25,16 +25,6 @@ namespace osu.Game.Skinning
public TValue GetValue<TConfiguration, TValue>(Func<TConfiguration, TValue> query) where TConfiguration : SkinConfiguration public TValue GetValue<TConfiguration, TValue>(Func<TConfiguration, TValue> query) where TConfiguration : SkinConfiguration
=> Configuration is TConfiguration conf ? query.Invoke(conf) : default; => Configuration is TConfiguration conf ? query.Invoke(conf) : default;
public bool TryGetValue<TConfiguration, TValue>(Func<TConfiguration, TValue, bool> query, out TValue val) where TConfiguration : SkinConfiguration
{
val = default;
if (Configuration is TConfiguration conf)
return query(conf, val);
return false;
}
protected Skin(SkinInfo skin) protected Skin(SkinInfo skin)
{ {
SkinInfo = skin; SkinInfo = skin;

View File

@ -117,7 +117,5 @@ namespace osu.Game.Skinning
public SampleChannel GetSample(string sampleName) => CurrentSkin.Value.GetSample(sampleName); public SampleChannel GetSample(string sampleName) => CurrentSkin.Value.GetSample(sampleName);
public TValue GetValue<TConfiguration, TValue>(Func<TConfiguration, TValue> query) where TConfiguration : SkinConfiguration => CurrentSkin.Value.GetValue(query); public TValue GetValue<TConfiguration, TValue>(Func<TConfiguration, TValue> query) where TConfiguration : SkinConfiguration => CurrentSkin.Value.GetValue(query);
public bool TryGetValue<TConfiguration, TValue>(Func<TConfiguration, TValue, bool> query, out TValue val) where TConfiguration : SkinConfiguration => CurrentSkin.Value.TryGetValue(query, out val);
} }
} }