2020-01-20 15:53:59 +00: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.
|
|
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2020-01-20 15:53:59 +00:00
|
|
|
|
using osu.Framework.Graphics.Primitives;
|
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
2021-04-27 06:40:35 +00:00
|
|
|
|
using osu.Game.Rulesets.Objects;
|
2020-01-20 15:53:59 +00:00
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
|
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Edit
|
|
|
|
|
{
|
2021-05-13 10:53:32 +00:00
|
|
|
|
public abstract class HitObjectSelectionBlueprint : SelectionBlueprint<HitObject>
|
2020-01-20 15:53:59 +00:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2021-05-13 10:53:32 +00:00
|
|
|
|
/// The <see cref="DrawableHitObject"/> which this <see cref="HitObjectSelectionBlueprint"/> applies to.
|
2020-01-20 15:53:59 +00:00
|
|
|
|
/// </summary>
|
2021-05-18 05:26:26 +00:00
|
|
|
|
public DrawableHitObject DrawableObject { get; internal set; }
|
2020-01-20 15:53:59 +00:00
|
|
|
|
|
2020-05-27 04:40:16 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether the blueprint should be shown even when the <see cref="DrawableObject"/> is not alive.
|
|
|
|
|
/// </summary>
|
|
|
|
|
protected virtual bool AlwaysShowWhenSelected => false;
|
|
|
|
|
|
2021-07-07 12:02:11 +00:00
|
|
|
|
protected override bool ShouldBeAlive => (DrawableObject?.IsAlive == true && DrawableObject.IsPresent) || (AlwaysShowWhenSelected && State == SelectionState.Selected);
|
2020-01-20 15:53:59 +00:00
|
|
|
|
|
2021-05-13 10:53:32 +00:00
|
|
|
|
protected HitObjectSelectionBlueprint(HitObject hitObject)
|
|
|
|
|
: base(hitObject)
|
2020-01-20 15:53:59 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => DrawableObject.ReceivePositionalInputAt(screenSpacePos);
|
|
|
|
|
|
2020-05-20 08:48:43 +00:00
|
|
|
|
public override Vector2 ScreenSpaceSelectionPoint => DrawableObject.ScreenSpaceDrawQuad.Centre;
|
2020-01-20 15:53:59 +00:00
|
|
|
|
|
|
|
|
|
public override Quad SelectionQuad => DrawableObject.ScreenSpaceDrawQuad;
|
|
|
|
|
}
|
2021-05-13 10:53:32 +00:00
|
|
|
|
|
|
|
|
|
public abstract class HitObjectSelectionBlueprint<T> : HitObjectSelectionBlueprint
|
|
|
|
|
where T : HitObject
|
|
|
|
|
{
|
|
|
|
|
public T HitObject => (T)Item;
|
|
|
|
|
|
|
|
|
|
protected HitObjectSelectionBlueprint(T item)
|
|
|
|
|
: base(item)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-01-20 15:53:59 +00:00
|
|
|
|
}
|