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-12 17:32:44 +08:00
|
|
|
|
|
|
|
using osu.Framework.Graphics;
|
2018-11-29 18:29:36 +08:00
|
|
|
using osu.Framework.Input;
|
2018-11-13 13:13:29 +08:00
|
|
|
using osu.Framework.Input.Events;
|
2018-11-12 17:32:44 +08:00
|
|
|
using osu.Game.Rulesets.Edit;
|
|
|
|
using osu.Game.Rulesets.Mania.Objects;
|
|
|
|
using osu.Game.Rulesets.Mania.UI;
|
2020-05-13 13:43:50 +08:00
|
|
|
using osuTK.Input;
|
2018-11-12 17:32:44 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|
|
|
{
|
2018-11-29 18:29:36 +08:00
|
|
|
public abstract class ManiaPlacementBlueprint<T> : PlacementBlueprint,
|
|
|
|
IRequireHighFrequencyMousePosition // the playfield could be moving behind us
|
2018-11-12 17:32:44 +08:00
|
|
|
where T : ManiaHitObject
|
|
|
|
{
|
|
|
|
protected new T HitObject => (T)base.HitObject;
|
|
|
|
|
2018-11-29 18:29:36 +08:00
|
|
|
protected Column Column;
|
|
|
|
|
2018-11-19 16:59:52 +08:00
|
|
|
protected ManiaPlacementBlueprint(T hitObject)
|
2018-11-12 17:32:44 +08:00
|
|
|
: base(hitObject)
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.None;
|
|
|
|
}
|
|
|
|
|
2018-11-29 18:29:36 +08:00
|
|
|
protected override bool OnMouseDown(MouseDownEvent e)
|
|
|
|
{
|
2020-05-13 13:43:50 +08:00
|
|
|
if (e.Button != MouseButton.Left)
|
|
|
|
return false;
|
|
|
|
|
2018-11-29 18:29:36 +08:00
|
|
|
if (Column == null)
|
|
|
|
return base.OnMouseDown(e);
|
|
|
|
|
|
|
|
HitObject.Column = Column.Index;
|
2020-05-20 17:46:15 +08:00
|
|
|
BeginPlacement(true);
|
2018-11-29 18:29:36 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-05-20 18:05:03 +08:00
|
|
|
public override void UpdatePosition(SnapResult result)
|
2018-11-13 13:13:29 +08:00
|
|
|
{
|
2020-02-13 08:03:48 +08:00
|
|
|
if (!PlacementActive)
|
2020-05-20 18:09:04 +08:00
|
|
|
Column = (result as ManiaSnapResult)?.Column;
|
2018-11-12 17:32:44 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|