mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 03:42:57 +08:00
Apply nullability to skinning support classes
This commit is contained in:
parent
2952dbc8fb
commit
bf26dbffc2
@ -1,9 +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 JetBrains.Annotations;
|
||||
using osu.Framework.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Judgements
|
||||
@ -21,7 +18,6 @@ namespace osu.Game.Rulesets.Judgements
|
||||
/// <summary>
|
||||
/// Get proxied content which should be displayed above all hitobjects.
|
||||
/// </summary>
|
||||
[CanBeNull]
|
||||
Drawable GetAboveHitObjectsProxiedContent();
|
||||
Drawable? GetAboveHitObjectsProxiedContent();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
@ -25,7 +24,7 @@ namespace osu.Game.Skinning
|
||||
{
|
||||
public static SkinInfo CreateInfo() => new SkinInfo
|
||||
{
|
||||
ID = osu.Game.Skinning.SkinInfo.ARGON_SKIN,
|
||||
ID = Skinning.SkinInfo.ARGON_SKIN,
|
||||
Name = "osu! \"argon\" (2022)",
|
||||
Creator = "team osu!",
|
||||
Protected = true,
|
||||
@ -68,9 +67,9 @@ namespace osu.Game.Skinning
|
||||
};
|
||||
}
|
||||
|
||||
public override Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => Textures?.Get(componentName, wrapModeS, wrapModeT);
|
||||
public override Texture? GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => Textures?.Get(componentName, wrapModeS, wrapModeT);
|
||||
|
||||
public override ISample GetSample(ISampleInfo sampleInfo)
|
||||
public override ISample? GetSample(ISampleInfo sampleInfo)
|
||||
{
|
||||
foreach (string lookup in sampleInfo.LookupNames)
|
||||
{
|
||||
@ -82,7 +81,7 @@ namespace osu.Game.Skinning
|
||||
return null;
|
||||
}
|
||||
|
||||
public override Drawable GetDrawableComponent(ISkinComponent component)
|
||||
public override Drawable? GetDrawableComponent(ISkinComponent component)
|
||||
{
|
||||
if (base.GetDrawableComponent(component) is Drawable c)
|
||||
return c;
|
||||
@ -192,7 +191,7 @@ namespace osu.Game.Skinning
|
||||
return null;
|
||||
}
|
||||
|
||||
public override IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup)
|
||||
public override IBindable<TValue>? GetConfig<TLookup, TValue>(TLookup lookup)
|
||||
{
|
||||
// todo: this code is pulled from LegacySkin and should not exist.
|
||||
// will likely change based on how databased storage of skin configuration goes.
|
||||
@ -202,7 +201,7 @@ namespace osu.Game.Skinning
|
||||
switch (global)
|
||||
{
|
||||
case GlobalSkinColours.ComboColours:
|
||||
return SkinUtils.As<TValue>(new Bindable<IReadOnlyList<Color4>>(Configuration.ComboColours));
|
||||
return SkinUtils.As<TValue>(new Bindable<IReadOnlyList<Color4>?>(Configuration.ComboColours));
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -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.Collections.Generic;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.IO.Stores;
|
||||
|
@ -1,13 +1,12 @@
|
||||
// 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.Linq;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
public class GameplaySkinComponent<T> : ISkinComponent
|
||||
where T : notnull
|
||||
{
|
||||
public readonly T Component;
|
||||
|
||||
|
@ -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
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
public enum GlobalSkinColours
|
||||
|
@ -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 osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
|
@ -1,9 +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 JetBrains.Annotations;
|
||||
using osu.Game.Audio;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
@ -18,7 +15,6 @@ namespace osu.Game.Skinning
|
||||
/// </summary>
|
||||
/// <param name="sampleInfo">The <see cref="SampleInfo"/> describing the sample to retrieve.</param>
|
||||
/// <returns>The <see cref="PoolableSkinnableSample"/>.</returns>
|
||||
[CanBeNull]
|
||||
PoolableSkinnableSample GetPooledSample(ISampleInfo sampleInfo);
|
||||
PoolableSkinnableSample? GetPooledSample(ISampleInfo sampleInfo);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
public interface ISkinComponent
|
||||
|
@ -1,11 +1,8 @@
|
||||
// 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 JetBrains.Annotations;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
@ -24,8 +21,7 @@ namespace osu.Game.Skinning
|
||||
/// This should be used for cases where subsequent lookups (for related components) need to occur on the same skin.
|
||||
/// </summary>
|
||||
/// <returns>The skin to be used for subsequent lookups, or <c>null</c> if none is available.</returns>
|
||||
[CanBeNull]
|
||||
ISkin FindProvider(Func<ISkin, bool> lookupFunction);
|
||||
ISkin? FindProvider(Func<ISkin, bool> lookupFunction);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve all sources available for lookup, with highest priority source first.
|
||||
|
@ -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 osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.TypeExtensions;
|
||||
|
@ -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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Bindables;
|
||||
|
@ -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 osu.Framework.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
|
@ -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 osu.Framework.Graphics;
|
||||
using osuTK.Graphics;
|
||||
|
||||
|
@ -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 osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
|
@ -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
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -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 osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Animations;
|
||||
@ -20,13 +18,13 @@ namespace osu.Game.Skinning
|
||||
{
|
||||
private readonly HitResult result;
|
||||
|
||||
private readonly LegacyJudgementPieceOld temporaryOldStyle;
|
||||
private readonly LegacyJudgementPieceOld? temporaryOldStyle;
|
||||
|
||||
private readonly Drawable mainPiece;
|
||||
|
||||
private readonly ParticleExplosion particles;
|
||||
private readonly ParticleExplosion? particles;
|
||||
|
||||
public LegacyJudgementPieceNew(HitResult result, Func<Drawable> createMainDrawable, Texture particleTexture)
|
||||
public LegacyJudgementPieceNew(HitResult result, Func<Drawable> createMainDrawable, Texture? particleTexture)
|
||||
{
|
||||
this.result = result;
|
||||
|
||||
@ -124,6 +122,6 @@ namespace osu.Game.Skinning
|
||||
}
|
||||
}
|
||||
|
||||
public Drawable GetAboveHitObjectsProxiedContent() => temporaryOldStyle?.CreateProxy(); // for new style judgements, only the old style temporary display is in front of objects.
|
||||
public Drawable? GetAboveHitObjectsProxiedContent() => temporaryOldStyle?.CreateProxy(); // for new style judgements, only the old style temporary display is in front of objects.
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.IO.Stores;
|
||||
@ -379,12 +380,13 @@ namespace osu.Game.Skinning
|
||||
return null;
|
||||
|
||||
case GameplaySkinComponent<HitResult> resultComponent:
|
||||
// TODO: this should be inside the judgement pieces.
|
||||
Func<Drawable?> createDrawable = () => getJudgementAnimation(resultComponent.Component);
|
||||
|
||||
// kind of wasteful that we throw this away, but should do for now.
|
||||
if (createDrawable() != null)
|
||||
if (getJudgementAnimation(resultComponent.Component) != null)
|
||||
{
|
||||
// TODO: this should be inside the judgement pieces.
|
||||
Func<Drawable> createDrawable = () => getJudgementAnimation(resultComponent.Component).AsNonNull();
|
||||
|
||||
var particle = getParticleTexture(resultComponent.Component);
|
||||
|
||||
if (particle != null)
|
||||
|
@ -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 osu.Game.Rulesets.Objects.Types;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
|
@ -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 osu.Framework.Configuration;
|
||||
|
||||
|
@ -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.Collections.Generic;
|
||||
using osu.Game.Beatmaps.Formats;
|
||||
using osuTK.Graphics;
|
||||
@ -52,7 +50,7 @@ namespace osu.Game.Skinning
|
||||
|
||||
public List<Color4> CustomComboColours { get; set; } = new List<Color4>();
|
||||
|
||||
public IReadOnlyList<Color4> ComboColours
|
||||
public IReadOnlyList<Color4>? ComboColours
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -1,12 +1,9 @@
|
||||
// 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.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Bindables;
|
||||
@ -22,10 +19,9 @@ namespace osu.Game.Skinning
|
||||
/// </summary>
|
||||
public class SkinProvidingContainer : Container, ISkinSource
|
||||
{
|
||||
public event Action SourceChanged;
|
||||
public event Action? SourceChanged;
|
||||
|
||||
[CanBeNull]
|
||||
protected ISkinSource ParentSource { get; private set; }
|
||||
protected ISkinSource? ParentSource { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether falling back to parent <see cref="ISkinSource"/>s is allowed in this container.
|
||||
@ -52,7 +48,7 @@ namespace osu.Game.Skinning
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="SkinProvidingContainer"/> initialised with a single skin source.
|
||||
/// </summary>
|
||||
public SkinProvidingContainer([CanBeNull] ISkin skin)
|
||||
public SkinProvidingContainer(ISkin? skin)
|
||||
: this()
|
||||
{
|
||||
if (skin != null)
|
||||
@ -82,7 +78,7 @@ namespace osu.Game.Skinning
|
||||
return dependencies;
|
||||
}
|
||||
|
||||
public ISkin FindProvider(Func<ISkin, bool> lookupFunction)
|
||||
public ISkin? FindProvider(Func<ISkin, bool> lookupFunction)
|
||||
{
|
||||
foreach (var (skin, lookupWrapper) in skinSources)
|
||||
{
|
||||
@ -111,11 +107,11 @@ namespace osu.Game.Skinning
|
||||
}
|
||||
}
|
||||
|
||||
public Drawable GetDrawableComponent(ISkinComponent component)
|
||||
public Drawable? GetDrawableComponent(ISkinComponent component)
|
||||
{
|
||||
foreach (var (_, lookupWrapper) in skinSources)
|
||||
{
|
||||
Drawable sourceDrawable;
|
||||
Drawable? sourceDrawable;
|
||||
if ((sourceDrawable = lookupWrapper.GetDrawableComponent(component)) != null)
|
||||
return sourceDrawable;
|
||||
}
|
||||
@ -126,11 +122,11 @@ namespace osu.Game.Skinning
|
||||
return ParentSource?.GetDrawableComponent(component);
|
||||
}
|
||||
|
||||
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT)
|
||||
public Texture? GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT)
|
||||
{
|
||||
foreach (var (_, lookupWrapper) in skinSources)
|
||||
{
|
||||
Texture sourceTexture;
|
||||
Texture? sourceTexture;
|
||||
if ((sourceTexture = lookupWrapper.GetTexture(componentName, wrapModeS, wrapModeT)) != null)
|
||||
return sourceTexture;
|
||||
}
|
||||
@ -141,11 +137,11 @@ namespace osu.Game.Skinning
|
||||
return ParentSource?.GetTexture(componentName, wrapModeS, wrapModeT);
|
||||
}
|
||||
|
||||
public ISample GetSample(ISampleInfo sampleInfo)
|
||||
public ISample? GetSample(ISampleInfo sampleInfo)
|
||||
{
|
||||
foreach (var (_, lookupWrapper) in skinSources)
|
||||
{
|
||||
ISample sourceSample;
|
||||
ISample? sourceSample;
|
||||
if ((sourceSample = lookupWrapper.GetSample(sampleInfo)) != null)
|
||||
return sourceSample;
|
||||
}
|
||||
@ -156,11 +152,13 @@ namespace osu.Game.Skinning
|
||||
return ParentSource?.GetSample(sampleInfo);
|
||||
}
|
||||
|
||||
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup)
|
||||
public IBindable<TValue>? GetConfig<TLookup, TValue>(TLookup lookup)
|
||||
where TLookup : notnull
|
||||
where TValue : notnull
|
||||
{
|
||||
foreach (var (_, lookupWrapper) in skinSources)
|
||||
{
|
||||
IBindable<TValue> bindable;
|
||||
IBindable<TValue>? bindable;
|
||||
if ((bindable = lookupWrapper.GetConfig<TLookup, TValue>(lookup)) != null)
|
||||
return bindable;
|
||||
}
|
||||
@ -240,7 +238,7 @@ namespace osu.Game.Skinning
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
public Drawable GetDrawableComponent(ISkinComponent component)
|
||||
public Drawable? GetDrawableComponent(ISkinComponent component)
|
||||
{
|
||||
if (provider.AllowDrawableLookup(component))
|
||||
return skin.GetDrawableComponent(component);
|
||||
@ -248,7 +246,7 @@ namespace osu.Game.Skinning
|
||||
return null;
|
||||
}
|
||||
|
||||
public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT)
|
||||
public Texture? GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT)
|
||||
{
|
||||
if (provider.AllowTextureLookup(componentName))
|
||||
return skin.GetTexture(componentName, wrapModeS, wrapModeT);
|
||||
@ -256,7 +254,7 @@ namespace osu.Game.Skinning
|
||||
return null;
|
||||
}
|
||||
|
||||
public ISample GetSample(ISampleInfo sampleInfo)
|
||||
public ISample? GetSample(ISampleInfo sampleInfo)
|
||||
{
|
||||
if (provider.AllowSampleLookup(sampleInfo))
|
||||
return skin.GetSample(sampleInfo);
|
||||
@ -264,7 +262,9 @@ namespace osu.Game.Skinning
|
||||
return null;
|
||||
}
|
||||
|
||||
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup)
|
||||
public IBindable<TValue>? GetConfig<TLookup, TValue>(TLookup lookup)
|
||||
where TLookup : notnull
|
||||
where TValue : notnull
|
||||
{
|
||||
switch (lookup)
|
||||
{
|
||||
|
@ -1,10 +1,9 @@
|
||||
// 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 osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Graphics.Pooling;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
@ -17,12 +16,12 @@ namespace osu.Game.Skinning
|
||||
/// <summary>
|
||||
/// Invoked when <see cref="CurrentSkin"/> has changed.
|
||||
/// </summary>
|
||||
public event Action OnSkinChanged;
|
||||
public event Action? OnSkinChanged;
|
||||
|
||||
/// <summary>
|
||||
/// The current skin source.
|
||||
/// </summary>
|
||||
protected ISkinSource CurrentSkin { get; private set; }
|
||||
protected ISkinSource CurrentSkin { get; private set; } = null!;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(ISkinSource source)
|
||||
@ -60,7 +59,7 @@ namespace osu.Game.Skinning
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
if (CurrentSkin != null)
|
||||
if (CurrentSkin.IsNotNull())
|
||||
CurrentSkin.SourceChanged -= onChange;
|
||||
|
||||
OnSkinChanged = null;
|
||||
|
@ -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 osu.Framework.Bindables;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
@ -18,6 +16,6 @@ namespace osu.Game.Skinning
|
||||
/// <param name="value">The value.</param>
|
||||
/// <typeparam name="TValue">The type of value <paramref name="value"/>, and the type of the resulting bindable.</typeparam>
|
||||
/// <returns>The resulting bindable.</returns>
|
||||
public static Bindable<TValue> As<TValue>(object value) => (Bindable<TValue>)value;
|
||||
public static Bindable<TValue>? As<TValue>(object? value) => (Bindable<TValue>?)value;
|
||||
}
|
||||
}
|
||||
|
@ -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.Linq;
|
||||
@ -27,13 +25,13 @@ namespace osu.Game.Skinning
|
||||
protected override bool ApplySizeRestrictionsToDefault => true;
|
||||
|
||||
[Resolved]
|
||||
private TextureStore textures { get; set; }
|
||||
private TextureStore textures { get; set; } = null!;
|
||||
|
||||
[SettingSource("Sprite name", "The filename of the sprite", SettingControlType = typeof(SpriteSelectorControl))]
|
||||
public Bindable<string> SpriteName { get; } = new Bindable<string>(string.Empty);
|
||||
|
||||
[Resolved]
|
||||
private ISkinSource source { get; set; }
|
||||
private ISkinSource source { get; set; } = null!;
|
||||
|
||||
public SkinnableSprite(string textureName, ConfineMode confineMode = ConfineMode.NoScaling)
|
||||
: base(new SpriteComponent(textureName), confineMode)
|
||||
@ -88,15 +86,15 @@ namespace osu.Game.Skinning
|
||||
// but that requires further thought.
|
||||
var highestPrioritySkin = getHighestPriorityUserSkin(((SkinnableSprite)SettingSourceObject).source.AllSources) as Skin;
|
||||
|
||||
string[] availableFiles = highestPrioritySkin?.SkinInfo.PerformRead(s => s.Files
|
||||
.Where(f => f.Filename.EndsWith(".png", StringComparison.Ordinal)
|
||||
|| f.Filename.EndsWith(".jpg", StringComparison.Ordinal))
|
||||
.Select(f => f.Filename).Distinct()).ToArray();
|
||||
string[]? availableFiles = highestPrioritySkin?.SkinInfo.PerformRead(s => s.Files
|
||||
.Where(f => f.Filename.EndsWith(".png", StringComparison.Ordinal)
|
||||
|| f.Filename.EndsWith(".jpg", StringComparison.Ordinal))
|
||||
.Select(f => f.Filename).Distinct()).ToArray();
|
||||
|
||||
if (availableFiles?.Length > 0)
|
||||
Items = availableFiles;
|
||||
|
||||
static ISkin getHighestPriorityUserSkin(IEnumerable<ISkin> skins)
|
||||
static ISkin? getHighestPriorityUserSkin(IEnumerable<ISkin> skins)
|
||||
{
|
||||
foreach (var skin in skins)
|
||||
{
|
||||
|
@ -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 osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Localisation;
|
||||
|
@ -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
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
public enum SkinnableTarget
|
||||
|
@ -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
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
public class SkinnableTargetComponent : ISkinComponent
|
||||
|
@ -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 Newtonsoft.Json;
|
||||
using osu.Framework.Graphics;
|
||||
@ -21,7 +19,7 @@ namespace osu.Game.Skinning
|
||||
|
||||
public bool UsesFixedAnchor { get; set; }
|
||||
|
||||
private readonly Action<Container> applyDefaults;
|
||||
private readonly Action<Container>? applyDefaults;
|
||||
|
||||
/// <summary>
|
||||
/// Construct a wrapper with defaults that should be applied once.
|
||||
|
@ -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.Linq;
|
||||
using System.Threading;
|
||||
@ -13,7 +11,7 @@ namespace osu.Game.Skinning
|
||||
{
|
||||
public class SkinnableTargetContainer : SkinReloadableDrawable, ISkinnableTarget
|
||||
{
|
||||
private SkinnableTargetComponentsContainer content;
|
||||
private SkinnableTargetComponentsContainer? content;
|
||||
|
||||
public SkinnableTarget Target { get; }
|
||||
|
||||
@ -25,7 +23,7 @@ namespace osu.Game.Skinning
|
||||
|
||||
public bool ComponentsLoaded { get; private set; }
|
||||
|
||||
private CancellationTokenSource cancellationSource;
|
||||
private CancellationTokenSource? cancellationSource;
|
||||
|
||||
public SkinnableTargetContainer(SkinnableTarget target)
|
||||
{
|
||||
|
@ -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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
@ -47,9 +45,9 @@ namespace osu.Game.Skinning
|
||||
this.resources = resources;
|
||||
}
|
||||
|
||||
public override Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => Textures?.Get(componentName, wrapModeS, wrapModeT);
|
||||
public override Texture? GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT) => Textures?.Get(componentName, wrapModeS, wrapModeT);
|
||||
|
||||
public override ISample GetSample(ISampleInfo sampleInfo)
|
||||
public override ISample? GetSample(ISampleInfo sampleInfo)
|
||||
{
|
||||
foreach (string lookup in sampleInfo.LookupNames)
|
||||
{
|
||||
@ -61,7 +59,7 @@ namespace osu.Game.Skinning
|
||||
return null;
|
||||
}
|
||||
|
||||
public override Drawable GetDrawableComponent(ISkinComponent component)
|
||||
public override Drawable? GetDrawableComponent(ISkinComponent component)
|
||||
{
|
||||
if (base.GetDrawableComponent(component) is Drawable c)
|
||||
return c;
|
||||
@ -171,7 +169,7 @@ namespace osu.Game.Skinning
|
||||
return null;
|
||||
}
|
||||
|
||||
public override IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup)
|
||||
public override IBindable<TValue>? GetConfig<TLookup, TValue>(TLookup lookup)
|
||||
{
|
||||
// todo: this code is pulled from LegacySkin and should not exist.
|
||||
// will likely change based on how databased storage of skin configuration goes.
|
||||
@ -181,7 +179,7 @@ namespace osu.Game.Skinning
|
||||
switch (global)
|
||||
{
|
||||
case GlobalSkinColours.ComboColours:
|
||||
return SkinUtils.As<TValue>(new Bindable<IReadOnlyList<Color4>>(Configuration.ComboColours));
|
||||
return SkinUtils.As<TValue>(new Bindable<IReadOnlyList<Color4>?>(Configuration.ComboColours));
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -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;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
|
Loading…
Reference in New Issue
Block a user