1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-23 20:07:26 +08:00
osu-lazer/osu.Game.Rulesets.Mania/Edit/Blueprints/ManiaSelectionBlueprint.cs

81 lines
2.3 KiB
C#
Raw Normal View History

// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
2018-11-13 15:42:40 +08:00
using osu.Framework.Allocation;
2018-11-12 16:18:58 +08:00
using osu.Framework.Graphics;
using osu.Framework.Input.Events;
2018-11-13 15:42:40 +08:00
using osu.Framework.Timing;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Objects.Drawables;
2018-11-13 15:42:40 +08:00
using osu.Game.Rulesets.UI.Scrolling;
using osuTK;
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
{
public class ManiaSelectionBlueprint : SelectionBlueprint
{
public Vector2 ScreenSpaceMouseDownPosition { get; private set; }
public Vector2 MouseDownPosition { get; private set; }
protected new DrawableManiaHitObject HitObject => (DrawableManiaHitObject)base.HitObject;
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; }
public ManiaSelectionBlueprint(DrawableHitObject hitObject)
: base(hitObject)
{
2018-11-12 16:18:58 +08:00
RelativeSizeAxes = Axes.None;
}
2018-11-13 15:42:40 +08:00
[BackgroundDependencyLoader]
private void load(IAdjustableClock clock)
{
EditorClock = clock;
}
protected override void Update()
{
base.Update();
Position = Parent.ToLocalSpace(HitObject.ToScreenSpace(Vector2.Zero));
}
protected override bool OnMouseDown(MouseDownEvent e)
{
ScreenSpaceMouseDownPosition = e.ScreenSpaceMousePosition;
MouseDownPosition = HitObject.ToLocalSpace(e.ScreenSpaceMousePosition);
return base.OnMouseDown(e);
}
protected override bool OnDrag(DragEvent e)
{
var result = base.OnDrag(e);
ScreenSpaceMouseDownPosition = e.ScreenSpaceMousePosition;
MouseDownPosition = HitObject.ToLocalSpace(e.ScreenSpaceMousePosition);
return result;
}
public override void Show()
{
HitObject.AlwaysAlive = true;
base.Show();
}
public override void Hide()
{
HitObject.AlwaysAlive = false;
base.Hide();
2018-11-26 10:47:48 +08:00
}
}
}