1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 07:22:54 +08:00

Rename HitObjectMask -> SelectionMask

This commit is contained in:
smoogipoo 2018-10-03 13:28:00 +09:00
parent dbe055a877
commit 4cdb6dcea5
13 changed files with 70 additions and 70 deletions

View File

@ -15,7 +15,7 @@ using OpenTK.Graphics;
namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays
{
public class HoldNoteMask : HitObjectMask
public class HoldNoteSelectionMask : SelectionMask
{
public new DrawableHoldNote HitObject => (DrawableHoldNote)base.HitObject;
@ -23,13 +23,13 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays
private readonly BodyPiece body;
public HoldNoteMask(DrawableHoldNote hold)
public HoldNoteSelectionMask(DrawableHoldNote hold)
: base(hold)
{
InternalChildren = new Drawable[]
{
new HoldNoteNoteMask(hold.Head),
new HoldNoteNoteMask(hold.Tail),
new HoldNoteNoteSelectionMask(hold.Head),
new HoldNoteNoteSelectionMask(hold.Tail),
body = new BodyPiece
{
AccentColour = Color4.Transparent
@ -59,9 +59,9 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays
Y -= HitObject.Tail.DrawHeight;
}
private class HoldNoteNoteMask : NoteMask
private class HoldNoteNoteSelectionMask : NoteSelectionMask
{
public HoldNoteNoteMask(DrawableNote note)
public HoldNoteNoteSelectionMask(DrawableNote note)
: base(note)
{
Select();

View File

@ -9,9 +9,9 @@ using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays
{
public class NoteMask : HitObjectMask
public class NoteSelectionMask : SelectionMask
{
public NoteMask(DrawableNote note)
public NoteSelectionMask(DrawableNote note)
: base(note)
{
Scale = note.Scale;

View File

@ -40,14 +40,14 @@ namespace osu.Game.Rulesets.Mania.Edit
new HitObjectCompositionTool<HoldNote>("Hold"),
};
public override HitObjectMask CreateMaskFor(DrawableHitObject hitObject)
public override SelectionMask CreateMaskFor(DrawableHitObject hitObject)
{
switch (hitObject)
{
case DrawableNote note:
return new NoteMask(note);
return new NoteSelectionMask(note);
case DrawableHoldNote holdNote:
return new HoldNoteMask(holdNote);
return new HoldNoteSelectionMask(holdNote);
}
return base.CreateMaskFor(hitObject);

View File

@ -10,9 +10,9 @@ using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays
{
public class HitCircleMask : HitObjectMask
public class HitCircleSelectionMask : SelectionMask
{
public HitCircleMask(DrawableHitCircle hitCircle)
public HitCircleSelectionMask(DrawableHitCircle hitCircle)
: base(hitCircle)
{
Origin = Anchor.Centre;

View File

@ -12,21 +12,21 @@ using OpenTK;
namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays
{
public class SliderCircleMask : HitObjectMask
public class SliderCircleSelectionMask : SelectionMask
{
public SliderCircleMask(DrawableHitCircle sliderHead, DrawableSlider slider)
public SliderCircleSelectionMask(DrawableHitCircle sliderHead, DrawableSlider slider)
: this(sliderHead, Vector2.Zero, slider)
{
}
public SliderCircleMask(DrawableSliderTail sliderTail, DrawableSlider slider)
public SliderCircleSelectionMask(DrawableSliderTail sliderTail, DrawableSlider slider)
: this(sliderTail, ((Slider)slider.HitObject).Curve.PositionAt(1), slider)
{
}
private readonly DrawableOsuHitObject hitObject;
private SliderCircleMask(DrawableOsuHitObject hitObject, Vector2 position, DrawableSlider slider)
private SliderCircleSelectionMask(DrawableOsuHitObject hitObject, Vector2 position, DrawableSlider slider)
: base(hitObject)
{
this.hitObject = hitObject;

View File

@ -14,12 +14,12 @@ using OpenTK.Graphics;
namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays
{
public class SliderMask : HitObjectMask
public class SliderSelectionMask : SelectionMask
{
private readonly SliderBody body;
private readonly DrawableSlider slider;
public SliderMask(DrawableSlider slider)
public SliderSelectionMask(DrawableSlider slider)
: base(slider)
{
this.slider = slider;
@ -35,8 +35,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays
AccentColour = Color4.Transparent,
PathWidth = sliderObject.Scale * 64
},
new SliderCircleMask(slider.HeadCircle, slider),
new SliderCircleMask(slider.TailCircle, slider),
new SliderCircleSelectionMask(slider.HeadCircle, slider),
new SliderCircleSelectionMask(slider.TailCircle, slider),
};
sliderObject.PositionChanged += _ => Position = slider.Position;

View File

@ -33,14 +33,14 @@ namespace osu.Game.Rulesets.Osu.Edit
protected override ScalableContainer CreateLayerContainer() => new ScalableContainer(OsuPlayfield.BASE_SIZE.X) { RelativeSizeAxes = Axes.Both };
public override HitObjectMask CreateMaskFor(DrawableHitObject hitObject)
public override SelectionMask CreateMaskFor(DrawableHitObject hitObject)
{
switch (hitObject)
{
case DrawableHitCircle circle:
return new HitCircleMask(circle);
return new HitCircleSelectionMask(circle);
case DrawableSlider slider:
return new SliderMask(slider);
return new SliderSelectionMask(slider);
}
return base.CreateMaskFor(hitObject);

View File

@ -348,7 +348,7 @@ namespace osu.Game.Beatmaps
OnlineBeatmapSetID = beatmap.BeatmapInfo.BeatmapSet?.OnlineBeatmapSetID,
Beatmaps = new List<BeatmapInfo>(),
Hash = computeBeatmapSetHash(reader),
Metadata = beatmap.Metadata
Metadata = beatmap.Metadata,
};
}

View File

@ -151,10 +151,10 @@ namespace osu.Game.Rulesets.Edit
protected abstract IReadOnlyList<ICompositionTool> CompositionTools { get; }
/// <summary>
/// Creates a <see cref="HitObjectMask"/> for a specific <see cref="DrawableHitObject"/>.
/// Creates a <see cref="SelectionMask"/> for a specific <see cref="DrawableHitObject"/>.
/// </summary>
/// <param name="hitObject">The <see cref="DrawableHitObject"/> to create the overlay for.</param>
public virtual HitObjectMask CreateMaskFor(DrawableHitObject hitObject) => null;
public virtual SelectionMask CreateMaskFor(DrawableHitObject hitObject) => null;
/// <summary>
/// Creates a <see cref="MaskSelection"/> which outlines <see cref="DrawableHitObject"/>s

View File

@ -16,31 +16,31 @@ namespace osu.Game.Rulesets.Edit
/// <summary>
/// A mask placed above a <see cref="DrawableHitObject"/> adding editing functionality.
/// </summary>
public class HitObjectMask : CompositeDrawable, IStateful<SelectionState>
public class SelectionMask : CompositeDrawable, IStateful<SelectionState>
{
/// <summary>
/// Invoked when this <see cref="HitObjectMask"/> has been selected.
/// Invoked when this <see cref="SelectionMask"/> has been selected.
/// </summary>
public event Action<HitObjectMask> Selected;
public event Action<SelectionMask> Selected;
/// <summary>
/// Invoked when this <see cref="HitObjectMask"/> has been deselected.
/// Invoked when this <see cref="SelectionMask"/> has been deselected.
/// </summary>
public event Action<HitObjectMask> Deselected;
public event Action<SelectionMask> Deselected;
/// <summary>
/// Invoked when this <see cref="HitObjectMask"/> has requested selection.
/// Invoked when this <see cref="SelectionMask"/> has requested selection.
/// Will fire even if already selected. Does not actually perform selection.
/// </summary>
public event Action<HitObjectMask, InputState> SelectionRequested;
public event Action<SelectionMask, InputState> SelectionRequested;
/// <summary>
/// Invoked when this <see cref="HitObjectMask"/> has requested drag.
/// Invoked when this <see cref="SelectionMask"/> has requested drag.
/// </summary>
public event Action<HitObjectMask, Vector2, InputState> DragRequested;
public event Action<SelectionMask, Vector2, InputState> DragRequested;
/// <summary>
/// The <see cref="DrawableHitObject"/> which this <see cref="HitObjectMask"/> applies to.
/// The <see cref="DrawableHitObject"/> which this <see cref="SelectionMask"/> applies to.
/// </summary>
public readonly DrawableHitObject HitObject;
@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Edit
public override bool HandlePositionalInput => ShouldBeAlive;
public override bool RemoveWhenNotAlive => false;
public HitObjectMask(DrawableHitObject hitObject)
public SelectionMask(DrawableHitObject hitObject)
{
HitObject = hitObject;
@ -83,12 +83,12 @@ namespace osu.Game.Rulesets.Edit
}
/// <summary>
/// Selects this <see cref="HitObjectMask"/>, causing it to become visible.
/// Selects this <see cref="SelectionMask"/>, causing it to become visible.
/// </summary>
public void Select() => State = SelectionState.Selected;
/// <summary>
/// Deselects this <see cref="HitObjectMask"/>, causing it to become invisible.
/// Deselects this <see cref="SelectionMask"/>, causing it to become invisible.
/// </summary>
public void Deselect() => State = SelectionState.NotSelected;
@ -130,12 +130,12 @@ namespace osu.Game.Rulesets.Edit
}
/// <summary>
/// The screen-space point that causes this <see cref="HitObjectMask"/> to be selected.
/// The screen-space point that causes this <see cref="SelectionMask"/> to be selected.
/// </summary>
public virtual Vector2 SelectionPoint => ScreenSpaceDrawQuad.Centre;
/// <summary>
/// The screen-space quad that outlines this <see cref="HitObjectMask"/> for selections.
/// The screen-space quad that outlines this <see cref="SelectionMask"/> for selections.
/// </summary>
public virtual Quad SelectionQuad => ScreenSpaceDrawQuad;
}

View File

@ -14,7 +14,7 @@ using OpenTK.Graphics;
namespace osu.Game.Screens.Edit.Screens.Compose.Layers
{
/// <summary>
/// A layer that handles and displays drag selection for a collection of <see cref="HitObjectMask"/>s.
/// A layer that handles and displays drag selection for a collection of <see cref="SelectionMask"/>s.
/// </summary>
public class DragLayer : CompositeDrawable
{
@ -30,7 +30,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
/// <summary>
/// Creates a new <see cref="DragLayer"/>.
/// </summary>
/// <param name="maskContainer">The selectable <see cref="HitObjectMask"/>s.</param>
/// <param name="maskContainer">The selectable <see cref="SelectionMask"/>s.</param>
public DragLayer(Action<RectangleF> performSelection)
{
this.performSelection = performSelection;

View File

@ -13,36 +13,36 @@ using RectangleF = osu.Framework.Graphics.Primitives.RectangleF;
namespace osu.Game.Screens.Edit.Screens.Compose.Layers
{
public class MaskContainer : Container<HitObjectMask>
public class MaskContainer : Container<SelectionMask>
{
/// <summary>
/// Invoked when any <see cref="HitObjectMask"/> is selected.
/// Invoked when any <see cref="SelectionMask"/> is selected.
/// </summary>
public event Action<HitObjectMask> MaskSelected;
public event Action<SelectionMask> MaskSelected;
/// <summary>
/// Invoked when any <see cref="HitObjectMask"/> is deselected.
/// Invoked when any <see cref="SelectionMask"/> is deselected.
/// </summary>
public event Action<HitObjectMask> MaskDeselected;
public event Action<SelectionMask> MaskDeselected;
/// <summary>
/// Invoked when any <see cref="HitObjectMask"/> requests selection.
/// Invoked when any <see cref="SelectionMask"/> requests selection.
/// </summary>
public event Action<HitObjectMask, InputState> MaskSelectionRequested;
public event Action<SelectionMask, InputState> MaskSelectionRequested;
/// <summary>
/// Invoked when any <see cref="HitObjectMask"/> requests drag.
/// Invoked when any <see cref="SelectionMask"/> requests drag.
/// </summary>
public event Action<HitObjectMask, Vector2, InputState> MaskDragRequested;
public event Action<SelectionMask, Vector2, InputState> MaskDragRequested;
private IEnumerable<HitObjectMask> aliveMasks => AliveInternalChildren.Cast<HitObjectMask>();
private IEnumerable<SelectionMask> aliveMasks => AliveInternalChildren.Cast<SelectionMask>();
public MaskContainer()
{
RelativeSizeAxes = Axes.Both;
}
public override void Add(HitObjectMask drawable)
public override void Add(SelectionMask drawable)
{
if (drawable == null) throw new ArgumentNullException(nameof(drawable));
@ -54,7 +54,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
drawable.DragRequested += onDragRequested;
}
public override bool Remove(HitObjectMask drawable)
public override bool Remove(SelectionMask drawable)
{
if (drawable == null) throw new ArgumentNullException(nameof(drawable));
@ -87,33 +87,33 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
}
/// <summary>
/// Deselects all selected <see cref="HitObjectMask"/>s.
/// Deselects all selected <see cref="SelectionMask"/>s.
/// </summary>
public void DeselectAll() => aliveMasks.ToList().ForEach(m => m.Deselect());
private void onMaskSelected(HitObjectMask mask)
private void onMaskSelected(SelectionMask mask)
{
MaskSelected?.Invoke(mask);
ChangeChildDepth(mask, 1);
}
private void onMaskDeselected(HitObjectMask mask)
private void onMaskDeselected(SelectionMask mask)
{
MaskDeselected?.Invoke(mask);
ChangeChildDepth(mask, 0);
}
private void onSelectionRequested(HitObjectMask mask, InputState state) => MaskSelectionRequested?.Invoke(mask, state);
private void onDragRequested(HitObjectMask mask, Vector2 delta, InputState state) => MaskDragRequested?.Invoke(mask, delta, state);
private void onSelectionRequested(SelectionMask mask, InputState state) => MaskSelectionRequested?.Invoke(mask, state);
private void onDragRequested(SelectionMask mask, Vector2 delta, InputState state) => MaskDragRequested?.Invoke(mask, delta, state);
protected override int Compare(Drawable x, Drawable y)
{
if (!(x is HitObjectMask xMask) || !(y is HitObjectMask yMask))
if (!(x is SelectionMask xMask) || !(y is SelectionMask yMask))
return base.Compare(x, y);
return Compare(xMask, yMask);
}
public int Compare(HitObjectMask x, HitObjectMask y)
public int Compare(SelectionMask x, SelectionMask y)
{
// dpeth is used to denote selected status (we always want selected masks to handle input first).
int d = x.Depth.CompareTo(y.Depth);

View File

@ -16,19 +16,19 @@ using OpenTK;
namespace osu.Game.Screens.Edit.Screens.Compose.Layers
{
/// <summary>
/// A box which surrounds <see cref="HitObjectMask"/>s and provides interactive handles, context menus etc.
/// A box which surrounds <see cref="SelectionMask"/>s and provides interactive handles, context menus etc.
/// </summary>
public class MaskSelection : CompositeDrawable
{
public const float BORDER_RADIUS = 2;
private readonly List<HitObjectMask> selectedMasks;
private readonly List<SelectionMask> selectedMasks;
private Drawable outline;
public MaskSelection()
{
selectedMasks = new List<HitObjectMask>();
selectedMasks = new List<SelectionMask>();
RelativeSizeAxes = Axes.Both;
AlwaysPresent = true;
@ -54,7 +54,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
#region User Input Handling
public void HandleDrag(HitObjectMask m, Vector2 delta, InputState state)
public void HandleDrag(SelectionMask m, Vector2 delta, InputState state)
{
// Todo: Various forms of snapping
@ -82,13 +82,13 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
/// Handle a mask becoming selected.
/// </summary>
/// <param name="mask">The mask.</param>
public void HandleSelected(HitObjectMask mask) => selectedMasks.Add(mask);
public void HandleSelected(SelectionMask mask) => selectedMasks.Add(mask);
/// <summary>
/// Handle a mask becoming deselected.
/// </summary>
/// <param name="mask">The mask.</param>
public void HandleDeselected(HitObjectMask mask)
public void HandleDeselected(SelectionMask mask)
{
selectedMasks.Remove(mask);
@ -101,7 +101,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
/// Handle a mask requesting selection.
/// </summary>
/// <param name="mask">The mask.</param>
public void HandleSelectionRequested(HitObjectMask mask, InputState state)
public void HandleSelectionRequested(SelectionMask mask, InputState state)
{
if (state.Keyboard.ControlPressed)
{