1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-12 14:07:52 +08:00
osu-lazer/osu.Game.Rulesets.Taiko/Edit/Blueprints/HitPlacementBlueprint.cs
2020-05-29 16:45:47 +09:00

50 lines
1.3 KiB
C#

using osu.Framework.Input.Events;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Rulesets.Taiko.UI;
using osuTK;
using osuTK.Input;
namespace osu.Game.Rulesets.Taiko.Edit.Blueprints
{
public class HitPlacementBlueprint : PlacementBlueprint
{
private readonly HitPiece piece;
private static Hit hit;
public HitPlacementBlueprint()
: base(hit = new Hit())
{
InternalChild = piece = new HitPiece
{
Size = new Vector2(TaikoHitObject.DEFAULT_SIZE * TaikoPlayfield.DEFAULT_HEIGHT)
};
}
protected override bool OnMouseDown(MouseDownEvent e)
{
switch (e.Button)
{
case MouseButton.Left:
hit.Type = HitType.Centre;
EndPlacement(true);
return true;
case MouseButton.Right:
hit.Type = HitType.Rim;
EndPlacement(true);
return true;
}
return false;
}
public override void UpdatePosition(SnapResult result)
{
piece.Position = ToLocalSpace(result.ScreenSpacePosition);
base.UpdatePosition(result);
}
}
}