Revert weird nullable changes to `Skin.cs`

This commit is contained in:
Dean Herbert 2023-01-25 13:21:44 +09:00
parent 0a9b20d5d5
commit 8caf960f9a
1 changed files with 10 additions and 13 deletions

View File

@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System;
using System.Collections.Generic;
using System.Diagnostics;
@ -28,12 +26,12 @@ public abstract class Skin : IDisposable, ISkin
/// <summary>
/// A texture store which can be used to perform user file lookups for this skin.
/// </summary>
protected TextureStore Textures { get; }
protected TextureStore? Textures { get; }
/// <summary>
/// A sample store which can be used to perform user file lookups for this skin.
/// </summary>
protected ISampleStore Samples { get; }
protected ISampleStore? Samples { get; }
public readonly Live<SkinInfo> SkinInfo;
@ -43,17 +41,17 @@ public abstract class Skin : IDisposable, ISkin
private readonly Dictionary<GlobalSkinComponentLookup.LookupType, SkinnableInfo[]> drawableComponentInfo = new Dictionary<GlobalSkinComponentLookup.LookupType, SkinnableInfo[]>();
public abstract ISample GetSample(ISampleInfo sampleInfo);
public abstract ISample? GetSample(ISampleInfo sampleInfo);
public Texture GetTexture(string componentName) => GetTexture(componentName, default, default);
public Texture? GetTexture(string componentName) => GetTexture(componentName, default, default);
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;
private readonly RealmBackedResourceStore<SkinInfo> realmBackedStorage;
private readonly RealmBackedResourceStore<SkinInfo>? realmBackedStorage;
/// <summary>
/// Construct a new skin.
@ -62,7 +60,7 @@ public abstract IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup)
/// <param name="resources">Access to game-wide resources.</param>
/// <param name="storage">An optional store which will *replace* all file lookups that are usually sourced from <paramref name="skin"/>.</param>
/// <param name="configurationFilename">An optional filename to read the skin configuration from. If not provided, the configuration will be retrieved from the storage using "skin.ini".</param>
protected Skin(SkinInfo skin, IStorageResourceProvider resources, IResourceStore<byte[]> storage = null, string configurationFilename = @"skin.ini")
protected Skin(SkinInfo skin, IStorageResourceProvider? resources, IResourceStore<byte[]>? storage = null, string configurationFilename = @"skin.ini")
{
if (resources != null)
{
@ -103,7 +101,7 @@ protected Skin(SkinInfo skin, IStorageResourceProvider resources, IResourceStore
{
string filename = $"{skinnableTarget}.json";
byte[] bytes = storage?.Get(filename);
byte[]? bytes = storage?.Get(filename);
if (bytes == null)
continue;
@ -156,7 +154,7 @@ public void UpdateDrawableTarget(ISkinnableTarget targetContainer)
DrawableComponentInfo[targetContainer.Target] = targetContainer.CreateSkinnableInfo().ToArray();
}
public virtual Drawable GetDrawableComponent(ISkinComponentLookup lookup)
public virtual Drawable? GetDrawableComponent(ISkinComponentLookup lookup)
{
switch (lookup)
{
@ -212,6 +210,5 @@ protected virtual void Dispose(bool isDisposing)
}
#endregion
}
}