1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-27 10:52:54 +08:00
osu-lazer/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs

55 lines
1.5 KiB
C#
Raw Normal View History

// 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;
2018-11-07 15:08:56 +08:00
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
2018-10-26 14:26:08 +08:00
using osu.Game.Rulesets.Osu.Objects;
2020-04-23 11:17:11 +08:00
using osuTK.Input;
2018-11-07 15:08:56 +08:00
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles
{
2018-11-06 17:04:03 +08:00
public class HitCirclePlacementBlueprint : PlacementBlueprint
{
2018-10-26 14:26:08 +08:00
public new HitCircle HitObject => (HitCircle)base.HitObject;
private readonly HitCirclePiece circlePiece;
2018-11-06 17:04:03 +08:00
public HitCirclePlacementBlueprint()
2018-10-26 14:26:08 +08:00
: base(new HitCircle())
{
InternalChild = circlePiece = new HitCirclePiece();
}
protected override void LoadComplete()
{
base.LoadComplete();
BeginPlacement();
}
2019-10-07 17:49:59 +08:00
protected override void Update()
{
base.Update();
circlePiece.UpdateFrom(HitObject);
}
2020-04-23 11:17:11 +08:00
protected override bool OnMouseDown(MouseDownEvent e)
{
2020-04-23 11:17:11 +08:00
if (e.Button == MouseButton.Left)
{
2020-04-24 11:27:56 +08:00
EndPlacement(true);
2020-04-23 11:17:11 +08:00
return true;
}
return base.OnMouseDown(e);
}
public override void UpdateTimeAndPosition(SnapResult result)
{
base.UpdateTimeAndPosition(result);
HitObject.Position = ToLocalSpace(result.ScreenSpacePosition);
}
}
}