osu/osu.Game.Rulesets.Mania/Edit/Blueprints/NotePlacementBlueprint.cs

42 lines
1.1 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.
2018-11-12 09:24:18 +00:00
using osu.Framework.Graphics;
2020-04-24 04:20:41 +00:00
using osu.Framework.Input.Events;
2018-11-12 09:24:18 +00:00
using osu.Game.Rulesets.Mania.Edit.Blueprints.Components;
using osu.Game.Rulesets.Mania.Objects;
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
{
public class NotePlacementBlueprint : ManiaPlacementBlueprint<Note>
2018-11-12 09:24:18 +00:00
{
public NotePlacementBlueprint()
: base(new Note())
{
Origin = Anchor.Centre;
AutoSizeAxes = Axes.Y;
InternalChild = new EditNotePiece { RelativeSizeAxes = Axes.X };
}
2018-11-13 05:13:29 +00:00
protected override void Update()
2018-11-12 09:24:18 +00:00
{
2018-11-13 05:13:29 +00:00
base.Update();
2018-11-19 09:40:16 +00:00
Width = SnappedWidth;
2018-11-13 05:13:29 +00:00
Position = SnappedMousePosition;
2018-11-12 09:24:18 +00:00
}
2020-04-23 03:05:34 +00:00
2020-04-24 04:20:41 +00:00
protected override bool OnMouseDown(MouseDownEvent e)
2020-04-23 03:05:34 +00:00
{
2020-04-24 04:20:41 +00:00
base.OnMouseDown(e);
2020-04-23 03:05:34 +00:00
2020-04-24 04:20:41 +00:00
// Place the note immediately.
EndPlacement(true);
return true;
2020-04-23 03:05:34 +00:00
}
2018-11-12 09:24:18 +00:00
}
}