2019-01-24 16:43:03 +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.
|
2018-11-07 15:21:32 +08:00
|
|
|
|
2018-11-13 15:42:40 +08:00
|
|
|
using osu.Framework.Allocation;
|
2018-11-12 16:18:58 +08:00
|
|
|
using osu.Framework.Graphics;
|
2018-11-26 15:08:56 +08:00
|
|
|
using osu.Framework.Input.Events;
|
2018-11-13 15:42:40 +08:00
|
|
|
using osu.Framework.Timing;
|
2018-11-07 15:21:32 +08:00
|
|
|
using osu.Game.Rulesets.Edit;
|
2018-11-26 10:34:25 +08:00
|
|
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
2018-11-07 15:21:32 +08:00
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
2018-11-13 15:42:40 +08:00
|
|
|
using osu.Game.Rulesets.UI.Scrolling;
|
2018-11-21 18:59:22 +08:00
|
|
|
using osuTK;
|
2018-11-07 15:21:32 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|
|
|
{
|
2020-01-20 23:53:59 +08:00
|
|
|
public class ManiaSelectionBlueprint : OverlaySelectionBlueprint
|
2018-11-07 15:21:32 +08:00
|
|
|
{
|
2018-11-30 13:21:20 +08:00
|
|
|
public Vector2 ScreenSpaceDragPosition { get; private set; }
|
|
|
|
public Vector2 DragPosition { get; private set; }
|
2018-11-26 15:08:56 +08:00
|
|
|
|
2019-10-21 16:04:56 +08:00
|
|
|
public new DrawableManiaHitObject DrawableObject => (DrawableManiaHitObject)base.DrawableObject;
|
2018-11-26 10:34:25 +08:00
|
|
|
|
2018-11-13 15:42:40 +08:00
|
|
|
protected IClock EditorClock { get; private set; }
|
|
|
|
|
|
|
|
[Resolved]
|
|
|
|
private IScrollingInfo scrollingInfo { get; set; }
|
|
|
|
|
2018-11-15 20:37:22 +08:00
|
|
|
[Resolved]
|
|
|
|
private IManiaHitObjectComposer composer { get; set; }
|
|
|
|
|
2019-10-21 16:04:56 +08:00
|
|
|
public ManiaSelectionBlueprint(DrawableHitObject drawableObject)
|
|
|
|
: base(drawableObject)
|
2018-11-07 15:21:32 +08:00
|
|
|
{
|
2018-11-12 16:18:58 +08:00
|
|
|
RelativeSizeAxes = Axes.None;
|
2018-11-07 15:21:32 +08:00
|
|
|
}
|
|
|
|
|
2018-11-13 15:42:40 +08:00
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(IAdjustableClock clock)
|
|
|
|
{
|
|
|
|
EditorClock = clock;
|
|
|
|
}
|
|
|
|
|
2018-11-13 14:45:06 +08:00
|
|
|
protected override void Update()
|
|
|
|
{
|
|
|
|
base.Update();
|
|
|
|
|
2019-10-21 16:04:56 +08:00
|
|
|
Position = Parent.ToLocalSpace(DrawableObject.ToScreenSpace(Vector2.Zero));
|
2018-11-13 14:45:06 +08:00
|
|
|
}
|
2018-11-26 10:34:25 +08:00
|
|
|
|
2018-11-26 15:08:56 +08:00
|
|
|
protected override bool OnMouseDown(MouseDownEvent e)
|
|
|
|
{
|
2018-11-30 13:21:20 +08:00
|
|
|
ScreenSpaceDragPosition = e.ScreenSpaceMousePosition;
|
2019-10-21 16:04:56 +08:00
|
|
|
DragPosition = DrawableObject.ToLocalSpace(e.ScreenSpaceMousePosition);
|
2018-11-26 15:08:56 +08:00
|
|
|
|
|
|
|
return base.OnMouseDown(e);
|
|
|
|
}
|
|
|
|
|
2020-01-20 17:17:21 +08:00
|
|
|
protected override void OnDrag(DragEvent e)
|
2018-11-26 15:08:56 +08:00
|
|
|
{
|
2020-01-20 17:17:21 +08:00
|
|
|
base.OnDrag(e);
|
2018-11-26 15:08:56 +08:00
|
|
|
|
2018-11-30 13:21:20 +08:00
|
|
|
ScreenSpaceDragPosition = e.ScreenSpaceMousePosition;
|
2019-10-21 16:04:56 +08:00
|
|
|
DragPosition = DrawableObject.ToLocalSpace(e.ScreenSpaceMousePosition);
|
2018-11-26 15:08:56 +08:00
|
|
|
}
|
|
|
|
|
2018-11-26 10:34:25 +08:00
|
|
|
public override void Show()
|
|
|
|
{
|
2019-10-21 16:04:56 +08:00
|
|
|
DrawableObject.AlwaysAlive = true;
|
2018-11-26 10:34:25 +08:00
|
|
|
base.Show();
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void Hide()
|
|
|
|
{
|
2019-10-21 16:04:56 +08:00
|
|
|
DrawableObject.AlwaysAlive = false;
|
2018-11-26 10:34:25 +08:00
|
|
|
base.Hide();
|
2018-11-26 10:47:48 +08:00
|
|
|
}
|
2018-11-07 15:21:32 +08:00
|
|
|
}
|
|
|
|
}
|