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

Commenting + cleanup of HitObjectMask/HitObjectMaskLayer

This commit is contained in:
smoogipoo 2018-03-29 22:27:14 +09:00
parent d8f26f2260
commit 4446aeaa0d
2 changed files with 25 additions and 15 deletions

View File

@ -16,14 +16,29 @@ namespace osu.Game.Rulesets.Edit
/// </summary>
public class HitObjectMask : VisibilityContainer
{
/// <summary>
/// Invoked when this <see cref="HitObjectMask"/> has been selected.
/// </summary>
public event Action<HitObjectMask> Selected;
/// <summary>
/// Invoked when this <see cref="HitObjectMask"/> has been deselected.
/// </summary>
public event Action<HitObjectMask> Deselected;
/// <summary>
/// Invoked when this <see cref="HitObjectMask"/> is requesting to be the single selection.
/// This <see cref="HitObjectMask"/> has not been selected at this point, but will be selected immediately afterwards.
/// </summary>
public event Action<HitObjectMask> SingleSelectionRequested;
/// <summary>
/// The <see cref="DrawableHitObject"/> which this <see cref="HitObjectMask"/> applies to.
/// </summary>
public readonly DrawableHitObject HitObject;
protected override bool ShouldBeAlive => HitObject.IsAlive || State == Visibility.Visible;
public override bool HandleMouseInput => true;
public override bool HandleMouseInput => HitObject.IsPresent;
public HitObjectMask(DrawableHitObject hitObject)
{
@ -63,14 +78,9 @@ namespace osu.Game.Rulesets.Edit
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
{
if (HitObject.IsPresent)
{
SingleSelectionRequested?.Invoke(this);
Select();
return true;
}
return false;
SingleSelectionRequested?.Invoke(this);
Select();
return true;
}
protected override bool OnDragStart(InputState state) => true;

View File

@ -17,9 +17,9 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
{
private readonly Playfield playfield;
private readonly HitObjectComposer composer;
private readonly Container<HitObjectMask> maskContainer;
private readonly SelectionBox selectionBox;
private Container<HitObjectMask> maskContainer;
private SelectionBox selectionBox;
private readonly HashSet<HitObjectMask> selectedMasks = new HashSet<HitObjectMask>();
@ -29,7 +29,11 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
this.composer = composer;
RelativeSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
private void load()
{
maskContainer = new Container<HitObjectMask>();
selectionBox = composer.CreateSelectionBox();
@ -43,11 +47,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
selectionBox,
dragBox.CreateProxy()
};
}
[BackgroundDependencyLoader]
private void load()
{
foreach (var obj in playfield.HitObjects.Objects)
addMask(obj);
}