From 8caf960f9ad5e4d1e92cbdef6dd75ad5dd520b63 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 Jan 2023 13:21:44 +0900 Subject: [PATCH] Revert weird nullable changes to `Skin.cs` --- osu.Game/Skinning/Skin.cs | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/osu.Game/Skinning/Skin.cs b/osu.Game/Skinning/Skin.cs index cc302a8b1e..419dacadfd 100644 --- a/osu.Game/Skinning/Skin.cs +++ b/osu.Game/Skinning/Skin.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . 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 /// /// A texture store which can be used to perform user file lookups for this skin. /// - protected TextureStore Textures { get; } + protected TextureStore? Textures { get; } /// /// A sample store which can be used to perform user file lookups for this skin. /// - protected ISampleStore Samples { get; } + protected ISampleStore? Samples { get; } public readonly Live SkinInfo; @@ -43,17 +41,17 @@ public abstract class Skin : IDisposable, ISkin private readonly Dictionary drawableComponentInfo = new Dictionary(); - 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 GetConfig(TLookup lookup) + public abstract IBindable? GetConfig(TLookup lookup) where TLookup : notnull where TValue : notnull; - private readonly RealmBackedResourceStore realmBackedStorage; + private readonly RealmBackedResourceStore? realmBackedStorage; /// /// Construct a new skin. @@ -62,7 +60,7 @@ public abstract IBindable GetConfig(TLookup lookup) /// Access to game-wide resources. /// An optional store which will *replace* all file lookups that are usually sourced from . /// An optional filename to read the skin configuration from. If not provided, the configuration will be retrieved from the storage using "skin.ini". - protected Skin(SkinInfo skin, IStorageResourceProvider resources, IResourceStore storage = null, string configurationFilename = @"skin.ini") + protected Skin(SkinInfo skin, IStorageResourceProvider? resources, IResourceStore? 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 - } }