2018-10-03 13:35:26 +08:00
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
|
|
|
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
|
|
|
using OpenTK;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Edit.Masks
|
|
|
|
{
|
|
|
|
public class HitCircleMask : CompositeDrawable
|
|
|
|
{
|
2018-10-03 15:27:26 +08:00
|
|
|
private readonly HitCircle hitCircle;
|
|
|
|
|
2018-10-03 13:35:26 +08:00
|
|
|
public HitCircleMask(HitCircle hitCircle)
|
|
|
|
{
|
2018-10-03 15:27:26 +08:00
|
|
|
this.hitCircle = hitCircle;
|
2018-10-25 17:16:25 +08:00
|
|
|
|
2018-10-03 13:35:26 +08:00
|
|
|
Origin = Anchor.Centre;
|
|
|
|
|
|
|
|
Size = new Vector2((float)OsuHitObject.OBJECT_RADIUS * 2);
|
|
|
|
CornerRadius = Size.X / 2;
|
|
|
|
|
2018-10-25 17:16:25 +08:00
|
|
|
InternalChild = new RingPiece();
|
|
|
|
|
|
|
|
hitCircle.PositionChanged += _ => UpdatePosition();
|
|
|
|
hitCircle.StackHeightChanged += _ => UpdatePosition();
|
2018-10-03 13:35:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(OsuColour colours)
|
|
|
|
{
|
|
|
|
Colour = colours.Yellow;
|
2018-10-25 17:16:25 +08:00
|
|
|
|
|
|
|
UpdatePosition();
|
2018-10-03 13:35:26 +08:00
|
|
|
}
|
2018-10-03 15:27:26 +08:00
|
|
|
|
2018-10-25 17:16:25 +08:00
|
|
|
protected virtual void UpdatePosition() => Position = hitCircle.StackedPosition;
|
|
|
|
|
2018-10-03 15:27:26 +08:00
|
|
|
protected override void Update()
|
|
|
|
{
|
|
|
|
base.Update();
|
|
|
|
|
|
|
|
Scale = new Vector2(hitCircle.Scale);
|
|
|
|
}
|
2018-10-03 13:35:26 +08:00
|
|
|
}
|
|
|
|
}
|