1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 22:07:25 +08:00

Add initial support for spinner disc skinning

This commit is contained in:
Dean Herbert 2020-07-29 16:25:10 +09:00
parent c3c60334ec
commit d01d1ce3f1
13 changed files with 31 additions and 11 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -175,8 +175,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
Background.AccentColour = normalColour;
Ticks.AccentColour = normalColour;
Disc.AccentColour = fillColour;
circle.Colour = colours.BlueDark;
glow.Colour = colours.BlueDark;

View File

@ -9,6 +9,7 @@ using osu.Game.Graphics;
using osuTK;
using osuTK.Graphics;
using osu.Framework.Utils;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
@ -16,13 +17,20 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
private readonly Spinner spinner;
private Color4 accentColour;
public Color4 AccentColour
{
get => background.AccentColour;
set => background.AccentColour = value;
get => accentColour;
set
{
accentColour = value;
if (background.Drawable is IHasAccentColour accent)
accent.AccentColour = value;
}
}
private readonly SpinnerBackground background;
private readonly SkinnableDrawable background;
private const float idle_alpha = 0.2f;
private const float tracking_alpha = 0.4f;
@ -37,7 +45,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
Children = new Drawable[]
{
background = new SpinnerBackground { Alpha = idle_alpha },
background = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.SpinnerDisc), _ => new SpinnerBackground { Alpha = idle_alpha }),
};
}
@ -54,7 +62,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
tracking = value;
background.FadeTo(tracking ? tracking_alpha : idle_alpha, 100);
// todo: new default only
background.Drawable.FadeTo(tracking ? tracking_alpha : idle_alpha, 100);
}
}
@ -121,8 +130,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
if (Complete && updateCompleteTick())
{
background.FinishTransforms(false, nameof(Alpha));
background
// todo: new default only
background.Drawable.FinishTransforms(false, nameof(Alpha));
background.Drawable
.FadeTo(tracking_alpha + 0.2f, 60, Easing.OutExpo)
.Then()
.FadeTo(tracking_alpha, 250, Easing.OutQuint);

View File

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

View File

@ -4,6 +4,7 @@
using System;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Skinning;
using osuTK;
@ -102,6 +103,14 @@ namespace osu.Game.Rulesets.Osu.Skinning
Scale = new Vector2(0.8f),
Spacing = new Vector2(-overlap, 0)
};
case OsuSkinComponents.SpinnerDisc:
if (Source.GetTexture("spinner-background") != null)
return new Sprite { Texture = Source.GetTexture("spinner-circle") };
else if (Source.GetTexture("spinner-top") != null)
return new Sprite { Texture = Source.GetTexture("spinner-top") };
return null;
}
return null;