Add a skin extension for simplifying falling back on hyper-dash colours

This commit is contained in:
Salman Ahmed 2020-04-03 19:35:50 +03:00
parent 16a4525a9c
commit 7e82f5740b
3 changed files with 18 additions and 8 deletions

View File

@ -64,8 +64,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
});
var hyperDashColour =
skin.GetConfig<CatchSkinColour, Color4>(CatchSkinColour.HyperDashFruit)?.Value ??
skin.GetConfig<CatchSkinColour, Color4>(CatchSkinColour.HyperDash)?.Value ??
skin.GetHyperDashFruitColour()?.Value ??
Catcher.DefaultHyperDashColour;
if (hitObject.HyperDash)

View File

@ -0,0 +1,16 @@
// 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.
using osu.Framework.Bindables;
using osu.Game.Skinning;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Catch.Skinning
{
internal static class CatchSkinExtensions
{
public static IBindable<Color4> GetHyperDashFruitColour(this ISkin skin)
=> skin.GetConfig<CatchSkinColour, Color4>(CatchSkinColour.HyperDashFruit) ??
skin.GetConfig<CatchSkinColour, Color4>(CatchSkinColour.HyperDash);
}
}

View File

@ -54,15 +54,10 @@ namespace osu.Game.Rulesets.Catch.Skinning
if (drawableCatchObject.HitObject.HyperDash)
{
var hyperDashColour =
skin.GetConfig<CatchSkinColour, Color4>(CatchSkinColour.HyperDashFruit)?.Value ??
skin.GetConfig<CatchSkinColour, Color4>(CatchSkinColour.HyperDash)?.Value ??
Catcher.DefaultHyperDashColour;
var hyperDash = new Sprite
{
Texture = skin.GetTexture(lookupName),
Colour = hyperDashColour,
Colour = skin.GetHyperDashFruitColour()?.Value ?? Catcher.DefaultHyperDashColour,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Blending = BlendingParameters.Additive,