2019-01-24 08:43:03 +00: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 07:27:26 +00:00
|
|
|
|
|
|
|
using osu.Framework.Input.Events;
|
|
|
|
using osu.Game.Rulesets.Edit;
|
2018-11-07 07:08:56 +00:00
|
|
|
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
|
2018-10-26 06:26:08 +00:00
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
2019-01-26 14:55:33 +00:00
|
|
|
using osuTK;
|
2018-10-03 07:27:26 +00:00
|
|
|
|
2018-11-07 07:08:56 +00:00
|
|
|
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles
|
2018-10-03 07:27:26 +00:00
|
|
|
{
|
2018-11-06 09:04:03 +00:00
|
|
|
public class HitCirclePlacementBlueprint : PlacementBlueprint
|
2018-10-03 07:27:26 +00:00
|
|
|
{
|
2018-10-26 06:26:08 +00:00
|
|
|
public new HitCircle HitObject => (HitCircle)base.HitObject;
|
2018-10-03 07:27:26 +00:00
|
|
|
|
2018-11-06 09:04:03 +00:00
|
|
|
public HitCirclePlacementBlueprint()
|
2018-10-26 06:26:08 +00:00
|
|
|
: base(new HitCircle())
|
2018-10-03 07:27:26 +00:00
|
|
|
{
|
2018-10-25 09:28:04 +00:00
|
|
|
InternalChild = new HitCirclePiece(HitObject);
|
2018-10-03 07:27:26 +00:00
|
|
|
}
|
|
|
|
|
2018-10-04 04:43:50 +00:00
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
2019-01-26 10:19:01 +00:00
|
|
|
// Fixes a 1-frame position discrepancy due to the first mouse move event happening in the next frame
|
2019-01-26 15:10:13 +00:00
|
|
|
HitObject.Position = Parent?.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position) ?? Vector2.Zero;
|
2018-10-04 04:43:50 +00:00
|
|
|
}
|
|
|
|
|
2018-10-03 07:27:26 +00:00
|
|
|
protected override bool OnClick(ClickEvent e)
|
|
|
|
{
|
2018-10-10 06:32:55 +00:00
|
|
|
HitObject.StartTime = EditorClock.CurrentTime;
|
2018-10-17 05:37:39 +00:00
|
|
|
EndPlacement();
|
2018-10-03 07:27:26 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override bool OnMouseMove(MouseMoveEvent e)
|
|
|
|
{
|
2018-10-17 09:12:29 +00:00
|
|
|
HitObject.Position = e.MousePosition;
|
2018-10-04 04:43:50 +00:00
|
|
|
return true;
|
2018-10-03 07:27:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|