1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 15:26:07 +08:00

Add initial support for spinner background layer

This commit is contained in:
Dean Herbert 2020-07-29 16:37:23 +09:00
parent d01d1ce3f1
commit e98154b432
5 changed files with 17 additions and 9 deletions

View File

@ -18,6 +18,7 @@ using osu.Game.Rulesets.Objects;
using osu.Framework.Utils;
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Ranking;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
@ -34,7 +35,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
private readonly Container mainContainer;
public readonly SpinnerBackground Background;
public readonly SkinnableDrawable Background;
private readonly Container circleContainer;
private readonly CirclePiece circle;
private readonly GlowPiece glow;
@ -96,7 +97,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
RelativeSizeAxes = Axes.Y,
Children = new[]
{
Background = new SpinnerBackground
Background = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.SpinnerBackground), _ => new SpinnerFill
{
Disc =
{
@ -104,7 +105,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
},
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
}),
Disc = new SpinnerDisc(Spinner)
{
Scale = Vector2.Zero,
@ -173,7 +174,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
normalColour = baseColour;
completeColour = colours.YellowLight;
Background.AccentColour = normalColour;
if (Background.Drawable is IHasAccentColour accent) accent.AccentColour = normalColour;
Ticks.AccentColour = normalColour;
Disc.AccentColour = fillColour;
@ -328,7 +329,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
Disc.FadeAccent(colour, duration);
Background.FadeAccent(colour.Darken(1), duration);
(Background.Drawable as IHasAccentColour)?.FadeAccent(colour.Darken(1), duration);
Ticks.FadeAccent(colour, duration);
circle.FadeColour(colour, duration);

View File

@ -45,7 +45,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
Children = new Drawable[]
{
background = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.SpinnerDisc), _ => new SpinnerBackground { Alpha = idle_alpha }),
background = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.SpinnerDisc), _ => new SpinnerFill { Alpha = idle_alpha }),
};
}

View File

@ -10,7 +10,7 @@ using osuTK.Graphics;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
public class SpinnerBackground : CircularContainer, IHasAccentColour
public class SpinnerFill : CircularContainer, IHasAccentColour
{
public readonly Box Disc;
@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
}
}
public SpinnerBackground()
public SpinnerFill()
{
RelativeSizeAxes = Axes.Both;
Masking = true;

View File

@ -17,6 +17,7 @@ namespace osu.Game.Rulesets.Osu
SliderFollowCircle,
SliderBall,
SliderBody,
SpinnerDisc
SpinnerDisc,
SpinnerBackground
}
}

View File

@ -111,6 +111,12 @@ namespace osu.Game.Rulesets.Osu.Skinning
return new Sprite { Texture = Source.GetTexture("spinner-top") };
return null;
case OsuSkinComponents.SpinnerBackground:
if (Source.GetTexture("spinner-background") != null)
return new Sprite { Texture = Source.GetTexture("spinner-background") };
return null;
}
return null;