2020-07-29 17:02:12 +08:00
|
|
|
// 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 System;
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
using osu.Framework.Utils;
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
2020-12-04 19:25:49 +08:00
|
|
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
2020-07-29 17:02:12 +08:00
|
|
|
using osuTK;
|
|
|
|
using osuTK.Graphics;
|
|
|
|
|
2020-12-04 19:25:49 +08:00
|
|
|
namespace osu.Game.Rulesets.Osu.Skinning.Default
|
2020-07-29 17:02:12 +08:00
|
|
|
{
|
2020-07-29 19:01:01 +08:00
|
|
|
public class SpinnerCentreLayer : CompositeDrawable, IHasAccentColour
|
2020-07-29 17:02:12 +08:00
|
|
|
{
|
|
|
|
private DrawableSpinner spinner;
|
|
|
|
|
|
|
|
private CirclePiece circle;
|
|
|
|
private GlowPiece glow;
|
|
|
|
private SpriteIcon symbol;
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2020-07-29 19:01:01 +08:00
|
|
|
private void load(DrawableHitObject drawableHitObject)
|
2020-07-29 17:02:12 +08:00
|
|
|
{
|
|
|
|
spinner = (DrawableSpinner)drawableHitObject;
|
|
|
|
|
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
{
|
|
|
|
glow = new GlowPiece(),
|
|
|
|
circle = new CirclePiece
|
|
|
|
{
|
|
|
|
Position = Vector2.Zero,
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
},
|
|
|
|
new RingPiece(),
|
|
|
|
symbol = new SpriteIcon
|
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
Size = new Vector2(48),
|
|
|
|
Icon = FontAwesome.Solid.Asterisk,
|
|
|
|
Shadow = false,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void Update()
|
|
|
|
{
|
|
|
|
base.Update();
|
2020-07-29 19:01:01 +08:00
|
|
|
symbol.Rotation = (float)Interpolation.Lerp(symbol.Rotation, spinner.RotationTracker.Rotation / 2, Math.Clamp(Math.Abs(Time.Elapsed) / 40, 0, 1));
|
|
|
|
}
|
|
|
|
|
|
|
|
private Color4 accentColour;
|
|
|
|
|
|
|
|
public Color4 AccentColour
|
|
|
|
{
|
|
|
|
get => accentColour;
|
|
|
|
set
|
|
|
|
{
|
|
|
|
accentColour = value;
|
2020-07-29 17:02:12 +08:00
|
|
|
|
2020-07-29 19:01:01 +08:00
|
|
|
circle.Colour = accentColour;
|
|
|
|
glow.Colour = accentColour;
|
|
|
|
}
|
2020-07-29 17:02:12 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|