mirror of
https://github.com/ppy/osu.git
synced 2024-12-27 19:42:54 +08:00
57 lines
1.6 KiB
C#
57 lines
1.6 KiB
C#
// 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.Graphics;
|
|
using osu.Framework.Graphics.Containers;
|
|
using osu.Framework.Graphics.Shapes;
|
|
using osu.Game.Graphics;
|
|
using osu.Game.Rulesets.Osu.Objects;
|
|
using osu.Game.Rulesets.Osu.Skinning.Default;
|
|
using osuTK;
|
|
|
|
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components
|
|
{
|
|
public class SpinnerPiece : BlueprintPiece<Spinner>
|
|
{
|
|
private readonly CircularContainer circle;
|
|
private readonly RingPiece ring;
|
|
|
|
public SpinnerPiece()
|
|
{
|
|
Origin = Anchor.Centre;
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
FillMode = FillMode.Fit;
|
|
Size = new Vector2(1.3f);
|
|
|
|
InternalChildren = new Drawable[]
|
|
{
|
|
circle = new CircularContainer
|
|
{
|
|
RelativeSizeAxes = Axes.Both,
|
|
Masking = true,
|
|
Alpha = 0.5f,
|
|
Child = new Box { RelativeSizeAxes = Axes.Both }
|
|
},
|
|
ring = new RingPiece()
|
|
};
|
|
}
|
|
|
|
[BackgroundDependencyLoader]
|
|
private void load(OsuColour colours)
|
|
{
|
|
Colour = colours.Yellow;
|
|
}
|
|
|
|
public override void UpdateFrom(Spinner hitObject)
|
|
{
|
|
base.UpdateFrom(hitObject);
|
|
|
|
ring.Scale = new Vector2(hitObject.Scale);
|
|
}
|
|
|
|
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => circle.ReceivePositionalInputAt(screenSpacePos);
|
|
}
|
|
}
|