1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-19 06:42:54 +08:00
osu-lazer/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/HitCirclePlacementBlueprint.cs

43 lines
1.3 KiB
C#
Raw Normal View History

// 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-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;
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;
2018-11-06 17:04:03 +08:00
public HitCirclePlacementBlueprint()
2018-10-26 14:26:08 +08:00
: base(new HitCircle())
{
2018-10-25 17:28:04 +08:00
InternalChild = new HitCirclePiece(HitObject);
}
protected override void LoadComplete()
{
base.LoadComplete();
// Fixes a 1-frame position discrpancy due to the first mouse move event happening in the next frame
HitObject.Position = GetContainingInputManager().CurrentState.Mouse.Position;
}
protected override bool OnClick(ClickEvent e)
{
2018-10-10 14:32:55 +08:00
HitObject.StartTime = EditorClock.CurrentTime;
EndPlacement();
return true;
}
protected override bool OnMouseMove(MouseMoveEvent e)
{
HitObject.Position = e.MousePosition;
return true;
}
}
}