mirror of
https://github.com/ppy/osu.git
synced 2024-11-14 05:43:33 +08:00
52 lines
1.4 KiB
C#
52 lines
1.4 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.Input.Events;
|
|
using osu.Game.Rulesets.Edit;
|
|
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
|
|
using osu.Game.Rulesets.Osu.Objects;
|
|
using osuTK;
|
|
using osuTK.Input;
|
|
|
|
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles
|
|
{
|
|
public class HitCirclePlacementBlueprint : PlacementBlueprint
|
|
{
|
|
public new HitCircle HitObject => (HitCircle)base.HitObject;
|
|
|
|
private readonly HitCirclePiece circlePiece;
|
|
|
|
public HitCirclePlacementBlueprint()
|
|
: base(new HitCircle())
|
|
{
|
|
InternalChild = circlePiece = new HitCirclePiece();
|
|
}
|
|
|
|
protected override void Update()
|
|
{
|
|
base.Update();
|
|
|
|
circlePiece.UpdateFrom(HitObject);
|
|
}
|
|
|
|
protected override bool OnMouseDown(MouseDownEvent e)
|
|
{
|
|
if (e.Button == MouseButton.Left)
|
|
{
|
|
BeginPlacement();
|
|
return true;
|
|
}
|
|
|
|
return base.OnMouseDown(e);
|
|
}
|
|
|
|
protected override void OnMouseUp(MouseUpEvent e)
|
|
{
|
|
if (e.Button == MouseButton.Left)
|
|
EndPlacement(true);
|
|
}
|
|
|
|
public override void UpdatePosition(Vector2 screenSpacePosition) => HitObject.Position = ToLocalSpace(screenSpacePosition);
|
|
}
|
|
}
|