mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 15:47:26 +08:00
Move default background implementation out of DrawableSpinner
This commit is contained in:
parent
2cd6e89cb0
commit
2a5e9fed4d
@ -0,0 +1,44 @@
|
||||
// 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.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
{
|
||||
public class DefaultSpinnerBackground : SpinnerFill
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, DrawableHitObject drawableHitObject)
|
||||
{
|
||||
Disc.Alpha = 0;
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
drawableHitObject.State.BindValueChanged(val =>
|
||||
{
|
||||
Color4 colour;
|
||||
|
||||
switch (val.NewValue)
|
||||
{
|
||||
default:
|
||||
colour = colours.BlueDark;
|
||||
break;
|
||||
|
||||
case ArmedState.Hit:
|
||||
colour = colours.YellowLight;
|
||||
break;
|
||||
}
|
||||
|
||||
this.FadeAccent(colour.Darken(1), 200);
|
||||
}, true);
|
||||
|
||||
FinishTransforms(true);
|
||||
}
|
||||
}
|
||||
}
|
@ -74,15 +74,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Children = new[]
|
||||
{
|
||||
Background = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.SpinnerBackground), _ => new SpinnerFill
|
||||
{
|
||||
Disc =
|
||||
{
|
||||
Alpha = 0f,
|
||||
},
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
}),
|
||||
Background = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.SpinnerBackground), _ => new DefaultSpinnerBackground()),
|
||||
Disc = new SpinnerDisc(Spinner)
|
||||
{
|
||||
Scale = Vector2.Zero,
|
||||
@ -151,8 +143,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
normalColour = baseColour;
|
||||
completeColour = colours.YellowLight;
|
||||
|
||||
if (Background.Drawable is IHasAccentColour accent) accent.AccentColour = normalColour;
|
||||
|
||||
Ticks.AccentColour = normalColour;
|
||||
Disc.AccentColour = fillColour;
|
||||
|
||||
@ -302,8 +292,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
private void transformFillColour(Colour4 colour, double duration)
|
||||
{
|
||||
Disc.FadeAccent(colour, duration);
|
||||
|
||||
(Background.Drawable as IHasAccentColour)?.FadeAccent(colour.Darken(1), duration);
|
||||
Ticks.FadeAccent(colour, duration);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user