2018-10-03 16:27:26 +09: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.Input.Events;
|
|
|
|
using osu.Game.Rulesets.Edit;
|
2018-10-26 14:01:42 +09:00
|
|
|
using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components;
|
2018-10-26 15:26:08 +09:00
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
2018-10-03 16:27:26 +09:00
|
|
|
|
2018-10-26 14:01:42 +09:00
|
|
|
namespace osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks
|
2018-10-03 16:27:26 +09:00
|
|
|
{
|
|
|
|
public class HitCirclePlacementMask : PlacementMask
|
|
|
|
{
|
2018-10-26 15:26:08 +09:00
|
|
|
public new HitCircle HitObject => (HitCircle)base.HitObject;
|
2018-10-03 16:27:26 +09:00
|
|
|
|
|
|
|
public HitCirclePlacementMask()
|
2018-10-26 15:26:08 +09:00
|
|
|
: base(new HitCircle())
|
2018-10-03 16:27:26 +09:00
|
|
|
{
|
2018-10-25 18:28:04 +09:00
|
|
|
InternalChild = new HitCirclePiece(HitObject);
|
2018-10-03 16:27:26 +09:00
|
|
|
}
|
|
|
|
|
2018-10-04 13:43:50 +09:00
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
// Fixes a 1-frame position discrpancy due to the first mouse move event happening in the next frame
|
2018-10-17 18:12:29 +09:00
|
|
|
HitObject.Position = GetContainingInputManager().CurrentState.Mouse.Position;
|
2018-10-04 13:43:50 +09:00
|
|
|
}
|
|
|
|
|
2018-10-03 16:27:26 +09:00
|
|
|
protected override bool OnClick(ClickEvent e)
|
|
|
|
{
|
2018-10-10 15:32:55 +09:00
|
|
|
HitObject.StartTime = EditorClock.CurrentTime;
|
2018-10-17 14:37:39 +09:00
|
|
|
EndPlacement();
|
2018-10-03 16:27:26 +09:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override bool OnMouseMove(MouseMoveEvent e)
|
|
|
|
{
|
2018-10-17 18:12:29 +09:00
|
|
|
HitObject.Position = e.MousePosition;
|
2018-10-04 13:43:50 +09:00
|
|
|
return true;
|
2018-10-03 16:27:26 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|