1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 10:52:53 +08:00

Reorder blueprint addition/removal + add regions

This commit is contained in:
smoogipoo 2019-10-24 16:17:48 +09:00
parent 45bd91f63f
commit fb88001c0e

View File

@ -89,43 +89,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
}
}
private void addBlueprintFor(HitObject hitObject)
{
var drawable = composer.HitObjects.FirstOrDefault(d => d.HitObject == hitObject);
if (drawable == null)
return;
addBlueprintFor(drawable);
}
private void removeBlueprintFor(HitObject hitObject)
{
var blueprint = selectionBlueprints.Single(m => m.DrawableObject.HitObject == hitObject);
if (blueprint == null)
return;
blueprint.Deselect();
blueprint.Selected -= onBlueprintSelected;
blueprint.Deselected -= onBlueprintDeselected;
selectionBlueprints.Remove(blueprint);
}
private void addBlueprintFor(DrawableHitObject hitObject)
{
refreshTool();
var blueprint = composer.CreateBlueprintFor(hitObject);
if (blueprint == null)
return;
blueprint.Selected += onBlueprintSelected;
blueprint.Deselected += onBlueprintDeselected;
selectionBlueprints.Add(blueprint);
}
protected override bool OnMouseDown(MouseDownEvent e)
{
beginClickSelection(e);
@ -201,6 +164,49 @@ namespace osu.Game.Screens.Edit.Compose.Components
}
}
#region Blueprint Addition/Removal
private void addBlueprintFor(HitObject hitObject)
{
var drawable = composer.HitObjects.FirstOrDefault(d => d.HitObject == hitObject);
if (drawable == null)
return;
addBlueprintFor(drawable);
}
private void removeBlueprintFor(HitObject hitObject)
{
var blueprint = selectionBlueprints.Single(m => m.DrawableObject.HitObject == hitObject);
if (blueprint == null)
return;
blueprint.Deselect();
blueprint.Selected -= onBlueprintSelected;
blueprint.Deselected -= onBlueprintDeselected;
selectionBlueprints.Remove(blueprint);
}
private void addBlueprintFor(DrawableHitObject hitObject)
{
refreshTool();
var blueprint = composer.CreateBlueprintFor(hitObject);
if (blueprint == null)
return;
blueprint.Selected += onBlueprintSelected;
blueprint.Deselected += onBlueprintDeselected;
selectionBlueprints.Add(blueprint);
}
#endregion
#region Placement
/// <summary>
/// Refreshes the current placement tool.
/// </summary>
@ -228,6 +234,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
currentPlacement.UpdatePosition(snappedScreenSpacePosition);
}
#endregion
#region Selection
/// <summary>