2019-01-24 17:43:03 +09: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.
|
2018-10-03 16:27:26 +09:00
|
|
|
|
2022-06-17 16:37:17 +09:00
|
|
|
#nullable disable
|
|
|
|
|
2018-10-03 16:27:26 +09:00
|
|
|
using osu.Framework.Input.Events;
|
|
|
|
using osu.Game.Rulesets.Edit;
|
2018-11-07 16:08:56 +09:00
|
|
|
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
|
2018-10-26 15:26:08 +09:00
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
2020-04-23 12:17:11 +09:00
|
|
|
using osuTK.Input;
|
2018-10-03 16:27:26 +09:00
|
|
|
|
2018-11-07 16:08:56 +09:00
|
|
|
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles
|
2018-10-03 16:27:26 +09:00
|
|
|
{
|
2018-11-06 18:04:03 +09:00
|
|
|
public class HitCirclePlacementBlueprint : PlacementBlueprint
|
2018-10-03 16:27:26 +09:00
|
|
|
{
|
2018-10-26 15:26:08 +09:00
|
|
|
public new HitCircle HitObject => (HitCircle)base.HitObject;
|
2018-10-03 16:27:26 +09:00
|
|
|
|
2019-09-27 18:45:22 +09:00
|
|
|
private readonly HitCirclePiece circlePiece;
|
|
|
|
|
2018-11-06 18:04:03 +09:00
|
|
|
public HitCirclePlacementBlueprint()
|
2018-10-26 15:26:08 +09:00
|
|
|
: base(new HitCircle())
|
2018-10-03 16:27:26 +09:00
|
|
|
{
|
2019-09-27 18:45:22 +09:00
|
|
|
InternalChild = circlePiece = new HitCirclePiece();
|
2018-10-03 16:27:26 +09:00
|
|
|
}
|
|
|
|
|
2020-10-10 17:54:37 +02:00
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
BeginPlacement();
|
|
|
|
}
|
|
|
|
|
2019-10-07 18:49:59 +09:00
|
|
|
protected override void Update()
|
|
|
|
{
|
|
|
|
base.Update();
|
|
|
|
|
|
|
|
circlePiece.UpdateFrom(HitObject);
|
|
|
|
}
|
|
|
|
|
2020-04-23 12:17:11 +09:00
|
|
|
protected override bool OnMouseDown(MouseDownEvent e)
|
2018-10-03 16:27:26 +09:00
|
|
|
{
|
2020-04-23 12:17:11 +09:00
|
|
|
if (e.Button == MouseButton.Left)
|
|
|
|
{
|
2020-04-24 12:27:56 +09:00
|
|
|
EndPlacement(true);
|
2020-04-23 12:17:11 +09:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return base.OnMouseDown(e);
|
2018-10-03 16:27:26 +09:00
|
|
|
}
|
|
|
|
|
2020-11-26 19:16:18 +09:00
|
|
|
public override void UpdateTimeAndPosition(SnapResult result)
|
2020-05-21 14:38:40 +09:00
|
|
|
{
|
2020-11-26 19:16:18 +09:00
|
|
|
base.UpdateTimeAndPosition(result);
|
2020-05-21 14:38:40 +09:00
|
|
|
HitObject.Position = ToLocalSpace(result.ScreenSpacePosition);
|
|
|
|
}
|
2018-10-03 16:27:26 +09:00
|
|
|
}
|
|
|
|
}
|