1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-21 08:32:54 +08:00
osu-lazer/osu.Game.Rulesets.Catch/Edit/Blueprints/FruitPlacementBlueprint.cs

52 lines
1.4 KiB
C#
Raw Normal View History

2021-06-22 11:10:16 +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.
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Catch.Edit.Blueprints.Components;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Edit;
using osuTK.Input;
namespace osu.Game.Rulesets.Catch.Edit.Blueprints
{
2022-11-24 13:32:20 +08:00
public partial class FruitPlacementBlueprint : CatchPlacementBlueprint<Fruit>
2021-06-22 11:10:16 +08:00
{
private readonly FruitOutline outline;
public FruitPlacementBlueprint()
{
InternalChild = outline = new FruitOutline();
}
protected override void LoadComplete()
{
base.LoadComplete();
BeginPlacement();
}
protected override void Update()
{
base.Update();
2021-07-19 12:33:46 +08:00
outline.Position = CatchHitObjectUtils.GetStartPosition(HitObjectContainer, HitObject);
outline.UpdateFrom(HitObject);
2021-06-22 11:10:16 +08:00
}
protected override bool OnMouseDown(MouseDownEvent e)
{
if (e.Button != MouseButton.Left) return base.OnMouseDown(e);
EndPlacement(true);
return true;
}
public override void UpdateTimeAndPosition(SnapResult result)
{
base.UpdateTimeAndPosition(result);
HitObject.X = ToLocalSpace(result.ScreenSpacePosition).X;
}
}
}