mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Apply nullability to osu!catch skinning classes
This commit is contained in:
@ -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;
|
||||
@ -19,19 +17,20 @@ namespace osu.Game.Rulesets.Catch.Skinning.Legacy
|
||||
{
|
||||
public abstract class LegacyCatchHitObjectPiece : PoolableDrawable
|
||||
{
|
||||
public readonly Bindable<Color4> AccentColour = new Bindable<Color4>();
|
||||
public readonly Bindable<bool> HyperDash = new Bindable<bool>();
|
||||
public readonly Bindable<int> IndexInBeatmap = new Bindable<int>();
|
||||
protected readonly Bindable<int> IndexInBeatmap = new Bindable<int>();
|
||||
|
||||
private readonly Bindable<Color4> accentColour = new Bindable<Color4>();
|
||||
private readonly Bindable<bool> hyperDash = new Bindable<bool>();
|
||||
|
||||
private readonly Sprite colouredSprite;
|
||||
private readonly Sprite overlaySprite;
|
||||
private readonly Sprite hyperSprite;
|
||||
|
||||
[Resolved]
|
||||
protected ISkinSource Skin { get; private set; }
|
||||
protected ISkinSource Skin { get; private set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
protected IHasCatchObjectState ObjectState { get; private set; }
|
||||
protected IHasCatchObjectState ObjectState { get; private set; } = null!;
|
||||
|
||||
protected LegacyCatchHitObjectPiece()
|
||||
{
|
||||
@ -65,26 +64,26 @@ namespace osu.Game.Rulesets.Catch.Skinning.Legacy
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
AccentColour.BindTo(ObjectState.AccentColour);
|
||||
HyperDash.BindTo(ObjectState.HyperDash);
|
||||
accentColour.BindTo(ObjectState.AccentColour);
|
||||
hyperDash.BindTo(ObjectState.HyperDash);
|
||||
IndexInBeatmap.BindTo(ObjectState.IndexInBeatmap);
|
||||
|
||||
hyperSprite.Colour = Skin.GetConfig<CatchSkinColour, Color4>(CatchSkinColour.HyperDashFruit)?.Value ??
|
||||
Skin.GetConfig<CatchSkinColour, Color4>(CatchSkinColour.HyperDash)?.Value ??
|
||||
Catcher.DEFAULT_HYPER_DASH_COLOUR;
|
||||
|
||||
AccentColour.BindValueChanged(colour =>
|
||||
accentColour.BindValueChanged(colour =>
|
||||
{
|
||||
colouredSprite.Colour = LegacyColourCompatibility.DisallowZeroAlpha(colour.NewValue);
|
||||
}, true);
|
||||
|
||||
HyperDash.BindValueChanged(hyper =>
|
||||
hyperDash.BindValueChanged(hyper =>
|
||||
{
|
||||
hyperSprite.Alpha = hyper.NewValue ? 0.7f : 0;
|
||||
}, true);
|
||||
}
|
||||
|
||||
protected void SetTexture(Texture texture, Texture overlayTexture)
|
||||
protected void SetTexture(Texture? texture, Texture? overlayTexture)
|
||||
{
|
||||
colouredSprite.Texture = texture;
|
||||
overlaySprite.Texture = overlayTexture;
|
||||
|
Reference in New Issue
Block a user