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