osu/osu.Game.Rulesets.Taiko/Edit/Blueprints/HitPlacementBlueprint.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

55 lines
1.5 KiB
C#
Raw Normal View History

2020-05-29 09:58:34 +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.
2022-06-17 07:37:17 +00:00
#nullable disable
2020-05-29 07:40:10 +00:00
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;
2021-05-21 05:21:56 +00:00
public new Hit HitObject => (Hit)base.HitObject;
2020-05-29 07:40:10 +00:00
public HitPlacementBlueprint()
2021-05-21 05:21:56 +00:00
: base(new Hit())
2020-05-29 07:40:10 +00:00
{
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:
2021-05-21 05:21:56 +00:00
HitObject.Type = HitType.Centre;
2020-05-29 07:40:10 +00:00
EndPlacement(true);
return true;
case MouseButton.Right:
2021-05-21 05:21:56 +00:00
HitObject.Type = HitType.Rim;
2020-05-29 07:40:10 +00:00
EndPlacement(true);
return true;
}
return false;
}
public override void UpdateTimeAndPosition(SnapResult result)
2020-05-29 07:40:10 +00:00
{
piece.Position = ToLocalSpace(result.ScreenSpacePosition);
base.UpdateTimeAndPosition(result);
2020-05-29 07:40:10 +00:00
}
}
}