Merge branch 'master' into basic-compose-checks

This commit is contained in:
Dan Balasescu
2021-04-30 23:41:46 +09:00
committed by GitHub
68 changed files with 1351 additions and 758 deletions

View File

@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Edit
/// <summary>
/// A wrapper for a <see cref="DrawableRuleset{TObject}"/>. Handles adding visual representations of <see cref="HitObject"/>s to the underlying <see cref="DrawableRuleset{TObject}"/>.
/// </summary>
internal class DrawableEditRulesetWrapper<TObject> : CompositeDrawable
internal class DrawableEditorRulesetWrapper<TObject> : CompositeDrawable
where TObject : HitObject
{
public Playfield Playfield => drawableRuleset.Playfield;
@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Edit
[Resolved]
private EditorBeatmap beatmap { get; set; }
public DrawableEditRulesetWrapper(DrawableRuleset<TObject> drawableRuleset)
public DrawableEditorRulesetWrapper(DrawableRuleset<TObject> drawableRuleset)
{
this.drawableRuleset = drawableRuleset;

View File

@ -54,7 +54,7 @@ namespace osu.Game.Rulesets.Edit
protected ComposeBlueprintContainer BlueprintContainer { get; private set; }
private DrawableEditRulesetWrapper<TObject> drawableRulesetWrapper;
private DrawableEditorRulesetWrapper<TObject> drawableRulesetWrapper;
protected readonly Container LayerBelowRuleset = new Container { RelativeSizeAxes = Axes.Both };
@ -76,7 +76,7 @@ namespace osu.Game.Rulesets.Edit
try
{
drawableRulesetWrapper = new DrawableEditRulesetWrapper<TObject>(CreateDrawableRuleset(Ruleset, EditorBeatmap.PlayableBeatmap, new[] { Ruleset.GetAutoplayMod() }))
drawableRulesetWrapper = new DrawableEditorRulesetWrapper<TObject>(CreateDrawableRuleset(Ruleset, EditorBeatmap.PlayableBeatmap, new[] { Ruleset.GetAutoplayMod() }))
{
Clock = EditorClock,
ProcessCustomClock = false
@ -182,8 +182,7 @@ namespace osu.Game.Rulesets.Edit
/// <summary>
/// Construct a relevant blueprint container. This will manage hitobject selection/placement input handling and display logic.
/// </summary>
protected virtual ComposeBlueprintContainer CreateBlueprintContainer()
=> new ComposeBlueprintContainer(this);
protected virtual ComposeBlueprintContainer CreateBlueprintContainer() => new ComposeBlueprintContainer(this);
/// <summary>
/// Construct a drawable ruleset for the provided ruleset.

View File

@ -3,12 +3,13 @@
using osu.Framework.Graphics.Primitives;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osuTK;
namespace osu.Game.Rulesets.Edit
{
public abstract class OverlaySelectionBlueprint : SelectionBlueprint
public abstract class OverlaySelectionBlueprint : SelectionBlueprint<HitObject>
{
/// <summary>
/// The <see cref="DrawableHitObject"/> which this <see cref="OverlaySelectionBlueprint"/> applies to.
@ -33,7 +34,5 @@ namespace osu.Game.Rulesets.Edit
public override Vector2 ScreenSpaceSelectionPoint => DrawableObject.ScreenSpaceDrawQuad.Centre;
public override Quad SelectionQuad => DrawableObject.ScreenSpaceDrawQuad;
public override Vector2 GetInstantDelta(Vector2 screenSpacePosition) => DrawableObject.Parent.ToLocalSpace(screenSpacePosition) - DrawableObject.Position;
}
}

View File

@ -3,44 +3,38 @@
using System;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osuTK;
namespace osu.Game.Rulesets.Edit
{
/// <summary>
/// A blueprint placed above a <see cref="DrawableHitObject"/> adding editing functionality.
/// A blueprint placed above a displaying item adding editing functionality.
/// </summary>
public abstract class SelectionBlueprint : CompositeDrawable, IStateful<SelectionState>
public abstract class SelectionBlueprint<T> : CompositeDrawable, IStateful<SelectionState>
{
public readonly HitObject HitObject;
public readonly T Item;
/// <summary>
/// Invoked when this <see cref="SelectionBlueprint"/> has been selected.
/// Invoked when this <see cref="SelectionBlueprint{T}"/> has been selected.
/// </summary>
public event Action<SelectionBlueprint> Selected;
public event Action<SelectionBlueprint<T>> Selected;
/// <summary>
/// Invoked when this <see cref="SelectionBlueprint"/> has been deselected.
/// Invoked when this <see cref="SelectionBlueprint{T}"/> has been deselected.
/// </summary>
public event Action<SelectionBlueprint> Deselected;
public event Action<SelectionBlueprint<T>> Deselected;
public override bool HandlePositionalInput => ShouldBeAlive;
public override bool RemoveWhenNotAlive => false;
[Resolved(CanBeNull = true)]
private HitObjectComposer composer { get; set; }
protected SelectionBlueprint(HitObject hitObject)
protected SelectionBlueprint(T item)
{
HitObject = hitObject;
Item = item;
RelativeSizeAxes = Axes.Both;
AlwaysPresent = true;
@ -91,7 +85,7 @@ namespace osu.Game.Rulesets.Edit
protected virtual void OnDeselected()
{
// selection blueprints are AlwaysPresent while the related DrawableHitObject is visible
// selection blueprints are AlwaysPresent while the related item is visible
// set the body piece's alpha directly to avoid arbitrarily rendering frame buffers etc. of children.
foreach (var d in InternalChildren)
d.Hide();
@ -133,7 +127,7 @@ namespace osu.Game.Rulesets.Edit
public virtual MenuItem[] ContextMenuItems => Array.Empty<MenuItem>();
/// <summary>
/// The screen-space point that causes this <see cref="OverlaySelectionBlueprint"/> to be selected.
/// The screen-space point that causes this <see cref="OverlaySelectionBlueprint"/> to be selected via a drag.
/// </summary>
public virtual Vector2 ScreenSpaceSelectionPoint => ScreenSpaceDrawQuad.Centre;
@ -142,8 +136,6 @@ namespace osu.Game.Rulesets.Edit
/// </summary>
public virtual Quad SelectionQuad => ScreenSpaceDrawQuad;
public virtual Vector2 GetInstantDelta(Vector2 screenSpacePosition) => Parent.ToLocalSpace(screenSpacePosition) - Position;
/// <summary>
/// Handle to perform a partial deletion when the user requests a quick delete (Shift+Right Click).
/// </summary>