Simplify blueprints by removing visible state

This commit is contained in:
Dean Herbert
2020-02-13 10:00:09 +09:00
parent 0fe41fd50a
commit b65e839bd2
2 changed files with 14 additions and 46 deletions

View File

@ -64,8 +64,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
{
placementBlueprintContainer.Clear();
currentPlacement?.EndPlacement(false);
currentPlacement = null;
removePlacement();
var blueprint = CurrentTool?.CreatePlacementBlueprint();
@ -103,18 +102,14 @@ namespace osu.Game.Screens.Edit.Compose.Components
{
base.Update();
if (currentPlacement != null)
{
if (composer.CursorInPlacementArea)
currentPlacement.State = PlacementState.Shown;
else if (currentPlacement?.PlacementActive == false)
currentPlacement.State = PlacementState.Hidden;
}
if (currentPlacement?.PlacementActive == false && !composer.CursorInPlacementArea)
removePlacement();
}
protected sealed override SelectionBlueprint CreateBlueprintFor(HitObject hitObject)
{
var drawable = drawableHitObjects.FirstOrDefault(d => d.HitObject == hitObject);
if (drawable == null)
return null;
@ -129,6 +124,14 @@ namespace osu.Game.Screens.Edit.Compose.Components
base.AddBlueprintFor(hitObject);
}
private void removePlacement()
{
if (currentPlacement == null) return;
currentPlacement.EndPlacement(false);
currentPlacement = null;
}
private HitObjectCompositionTool currentTool;
/// <summary>
@ -137,6 +140,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
public HitObjectCompositionTool CurrentTool
{
get => currentTool;
set
{
if (currentTool == value)