mirror of
https://github.com/ppy/osu.git
synced 2025-01-29 05:52:56 +08:00
Apply notnull constraint
This commit is contained in:
parent
2d8d177807
commit
23c4f9910e
@ -52,6 +52,8 @@ namespace osu.Game.Skinning
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="lookup">The requested configuration value.</param>
|
/// <param name="lookup">The requested configuration value.</param>
|
||||||
/// <returns>A matching value boxed in an <see cref="IBindable{TValue}"/>, or null if unavailable.</returns>
|
/// <returns>A matching value boxed in an <see cref="IBindable{TValue}"/>, or null if unavailable.</returns>
|
||||||
IBindable<TValue>? GetConfig<TLookup, TValue>(TLookup lookup);
|
IBindable<TValue>? GetConfig<TLookup, TValue>(TLookup lookup)
|
||||||
|
where TLookup : notnull
|
||||||
|
where TValue : notnull;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -282,6 +282,7 @@ namespace osu.Game.Skinning
|
|||||||
=> source.ImageLookups.TryGetValue(lookup, out string image) ? new Bindable<string>(image) : null;
|
=> source.ImageLookups.TryGetValue(lookup, out string image) ? new Bindable<string>(image) : null;
|
||||||
|
|
||||||
private IBindable<TValue>? legacySettingLookup<TValue>(SkinConfiguration.LegacySetting legacySetting)
|
private IBindable<TValue>? legacySettingLookup<TValue>(SkinConfiguration.LegacySetting legacySetting)
|
||||||
|
where TValue : notnull
|
||||||
{
|
{
|
||||||
switch (legacySetting)
|
switch (legacySetting)
|
||||||
{
|
{
|
||||||
@ -294,10 +295,9 @@ namespace osu.Game.Skinning
|
|||||||
}
|
}
|
||||||
|
|
||||||
private IBindable<TValue>? genericLookup<TLookup, TValue>(TLookup lookup)
|
private IBindable<TValue>? genericLookup<TLookup, TValue>(TLookup lookup)
|
||||||
|
where TLookup : notnull
|
||||||
|
where TValue : notnull
|
||||||
{
|
{
|
||||||
if (lookup == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (Configuration.ConfigDictionary.TryGetValue(lookup.ToString(), out string val))
|
if (Configuration.ConfigDictionary.TryGetValue(lookup.ToString(), out string val))
|
||||||
|
@ -46,7 +46,10 @@ namespace osu.Game.Skinning
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IBindable<TValue>? GetConfig<TLookup, TValue>(TLookup lookup) => null;
|
public IBindable<TValue>? GetConfig<TLookup, TValue>(TLookup lookup)
|
||||||
|
where TLookup : notnull
|
||||||
|
where TValue : notnull
|
||||||
|
=> null;
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
@ -50,7 +50,9 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
public abstract Texture? GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT);
|
public abstract Texture? GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT);
|
||||||
|
|
||||||
public abstract IBindable<TValue>? GetConfig<TLookup, TValue>(TLookup lookup);
|
public abstract IBindable<TValue>? GetConfig<TLookup, TValue>(TLookup lookup)
|
||||||
|
where TLookup : notnull
|
||||||
|
where TValue : notnull;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Construct a new skin.
|
/// Construct a new skin.
|
||||||
|
Loading…
Reference in New Issue
Block a user