2020-05-29 17:58:34 +08: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.
|
|
|
|
|
2020-05-29 15:40:10 +08: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;
|
2023-04-05 00:40:10 +08:00
|
|
|
using osuTK.Input;
|
2020-05-29 15:40:10 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Edit.Blueprints
|
|
|
|
{
|
2024-09-23 22:33:36 +08:00
|
|
|
public partial class HitPlacementBlueprint : HitObjectPlacementBlueprint
|
2020-05-29 15:40:10 +08:00
|
|
|
{
|
|
|
|
private readonly HitPiece piece;
|
|
|
|
|
2021-05-21 13:21:56 +08:00
|
|
|
public new Hit HitObject => (Hit)base.HitObject;
|
2020-05-29 15:40:10 +08:00
|
|
|
|
|
|
|
public HitPlacementBlueprint()
|
2021-05-21 13:21:56 +08:00
|
|
|
: base(new Hit())
|
2020-05-29 15:40:10 +08:00
|
|
|
{
|
|
|
|
InternalChild = piece = new HitPiece
|
|
|
|
{
|
2024-01-20 04:48:05 +08:00
|
|
|
Size = new Vector2(TaikoHitObject.DEFAULT_SIZE * TaikoPlayfield.BASE_HEIGHT)
|
2020-05-29 15:40:10 +08:00
|
|
|
};
|
|
|
|
}
|
2022-10-18 23:16:24 +08:00
|
|
|
|
2022-09-27 19:08:32 +08:00
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
BeginPlacement();
|
|
|
|
}
|
2020-05-29 15:40:10 +08:00
|
|
|
|
|
|
|
protected override bool OnMouseDown(MouseDownEvent e)
|
|
|
|
{
|
2023-04-05 00:40:10 +08:00
|
|
|
if (e.Button != MouseButton.Left)
|
|
|
|
return false;
|
|
|
|
|
2023-04-03 17:14:58 +08:00
|
|
|
EndPlacement(true);
|
|
|
|
return true;
|
2020-05-29 15:40:10 +08:00
|
|
|
}
|
|
|
|
|
2020-11-26 18:16:18 +08:00
|
|
|
public override void UpdateTimeAndPosition(SnapResult result)
|
2020-05-29 15:40:10 +08:00
|
|
|
{
|
|
|
|
piece.Position = ToLocalSpace(result.ScreenSpacePosition);
|
2020-11-26 18:16:18 +08:00
|
|
|
base.UpdateTimeAndPosition(result);
|
2020-05-29 15:40:10 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|