1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-12 06:47:25 +08:00

Merge branch 'master' into better-rider-ignore

This commit is contained in:
Dan Balasescu 2018-11-12 17:19:39 +09:00 committed by GitHub
commit 5051263106
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
83 changed files with 558 additions and 653 deletions

View File

@ -5,7 +5,6 @@ using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
using osu.Game.Rulesets.Mania.UI;
@ -13,9 +12,9 @@ using osu.Game.Rulesets.UI.Scrolling;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Rulesets.Mania.Edit.Masks
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
{
public class HoldNoteSelectionMask : SelectionMask
public class HoldNoteSelectionBlueprint : ManiaSelectionBlueprint
{
public new DrawableHoldNote HitObject => (DrawableHoldNote)base.HitObject;
@ -23,13 +22,13 @@ namespace osu.Game.Rulesets.Mania.Edit.Masks
private readonly BodyPiece body;
public HoldNoteSelectionMask(DrawableHoldNote hold)
public HoldNoteSelectionBlueprint(DrawableHoldNote hold)
: base(hold)
{
InternalChildren = new Drawable[]
{
new HoldNoteNoteSelectionMask(hold.Head),
new HoldNoteNoteSelectionMask(hold.Tail),
new HoldNoteNoteSelectionBlueprint(hold.Head),
new HoldNoteNoteSelectionBlueprint(hold.Tail),
body = new BodyPiece
{
AccentColour = Color4.Transparent
@ -59,9 +58,9 @@ namespace osu.Game.Rulesets.Mania.Edit.Masks
Y -= HitObject.Tail.DrawHeight;
}
private class HoldNoteNoteSelectionMask : NoteSelectionMask
private class HoldNoteNoteSelectionBlueprint : NoteSelectionBlueprint
{
public HoldNoteNoteSelectionMask(DrawableNote note)
public HoldNoteNoteSelectionBlueprint(DrawableNote note)
: base(note)
{
Select();

View File

@ -0,0 +1,21 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
{
public class ManiaSelectionBlueprint : SelectionBlueprint
{
public ManiaSelectionBlueprint(DrawableHitObject hitObject)
: base(hitObject)
{
}
public override void AdjustPosition(DragEvent dragEvent)
{
}
}
}

View File

@ -3,15 +3,14 @@
using osu.Framework.Allocation;
using osu.Game.Graphics;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
namespace osu.Game.Rulesets.Mania.Edit.Masks
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
{
public class NoteSelectionMask : SelectionMask
public class NoteSelectionBlueprint : ManiaSelectionBlueprint
{
public NoteSelectionMask(DrawableNote note)
public NoteSelectionBlueprint(DrawableNote note)
: base(note)
{
Scale = note.Scale;

View File

@ -11,7 +11,7 @@ using osu.Game.Rulesets.Objects.Drawables;
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Game.Rulesets.Mania.Configuration;
using osu.Game.Rulesets.Mania.Edit.Masks;
using osu.Game.Rulesets.Mania.Edit.Blueprints;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.UI;
@ -38,17 +38,17 @@ namespace osu.Game.Rulesets.Mania.Edit
protected override IReadOnlyList<HitObjectCompositionTool> CompositionTools => Array.Empty<HitObjectCompositionTool>();
public override SelectionMask CreateMaskFor(DrawableHitObject hitObject)
public override SelectionBlueprint CreateBlueprintFor(DrawableHitObject hitObject)
{
switch (hitObject)
{
case DrawableNote note:
return new NoteSelectionMask(note);
return new NoteSelectionBlueprint(note);
case DrawableHoldNote holdNote:
return new HoldNoteSelectionMask(holdNote);
return new HoldNoteSelectionBlueprint(holdNote);
}
return base.CreateMaskFor(hitObject);
return base.CreateBlueprintFor(hitObject);
}
}
}

View File

@ -4,16 +4,16 @@
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks;
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Tests.Visual;
namespace osu.Game.Rulesets.Osu.Tests
{
public class TestCaseHitCirclePlacementMask : HitObjectPlacementMaskTestCase
public class TestCaseHitCirclePlacementBlueprint : PlacementBlueprintTestCase
{
protected override DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableHitCircle((HitCircle)hitObject);
protected override PlacementMask CreateMask() => new HitCirclePlacementMask();
protected override PlacementBlueprint CreateBlueprint() => new HitCirclePlacementBlueprint();
}
}

View File

@ -4,7 +4,7 @@
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks;
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Tests.Visual;
@ -12,11 +12,11 @@ using OpenTK;
namespace osu.Game.Rulesets.Osu.Tests
{
public class TestCaseHitCircleSelectionMask : HitObjectSelectionMaskTestCase
public class TestCaseHitCircleSelectionBlueprint : SelectionBlueprintTestCase
{
private readonly DrawableHitCircle drawableObject;
public TestCaseHitCircleSelectionMask()
public TestCaseHitCircleSelectionBlueprint()
{
var hitCircle = new HitCircle { Position = new Vector2(256, 192) };
hitCircle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 2 });
@ -24,6 +24,6 @@ namespace osu.Game.Rulesets.Osu.Tests
Add(drawableObject = new DrawableHitCircle(hitCircle));
}
protected override SelectionMask CreateMask() => new HitCircleSelectionMask(drawableObject);
protected override SelectionBlueprint CreateBlueprint() => new HitCircleSelectionBlueprint(drawableObject);
}
}

View File

@ -4,16 +4,16 @@
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Tests.Visual;
namespace osu.Game.Rulesets.Osu.Tests
{
public class TestCaseSliderPlacementMask : HitObjectPlacementMaskTestCase
public class TestCaseSliderPlacementBlueprint : PlacementBlueprintTestCase
{
protected override DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableSlider((Slider)hitObject);
protected override PlacementMask CreateMask() => new SliderPlacementMask();
protected override PlacementBlueprint CreateBlueprint() => new SliderPlacementBlueprint();
}
}

View File

@ -7,8 +7,8 @@ using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks;
using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Tests.Visual;
@ -16,12 +16,12 @@ using OpenTK;
namespace osu.Game.Rulesets.Osu.Tests
{
public class TestCaseSliderSelectionMask : HitObjectSelectionMaskTestCase
public class TestCaseSliderSelectionBlueprint : SelectionBlueprintTestCase
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(SliderSelectionMask),
typeof(SliderCircleSelectionMask),
typeof(SliderSelectionBlueprint),
typeof(SliderCircleSelectionBlueprint),
typeof(SliderBodyPiece),
typeof(SliderCircle),
typeof(PathControlPointVisualiser),
@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Osu.Tests
private readonly DrawableSlider drawableObject;
public TestCaseSliderSelectionMask()
public TestCaseSliderSelectionBlueprint()
{
var slider = new Slider
{
@ -50,6 +50,6 @@ namespace osu.Game.Rulesets.Osu.Tests
Add(drawableObject = new DrawableSlider(slider));
}
protected override SelectionMask CreateMask() => new SliderSelectionMask(drawableObject);
protected override SelectionBlueprint CreateBlueprint() => new SliderSelectionBlueprint(drawableObject);
}
}

View File

@ -4,17 +4,17 @@
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Tests.Visual;
namespace osu.Game.Rulesets.Osu.Tests
{
public class TestCaseSpinnerPlacementMask : HitObjectPlacementMaskTestCase
public class TestCaseSpinnerPlacementBlueprint : PlacementBlueprintTestCase
{
protected override DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableSpinner((Spinner)hitObject);
protected override PlacementMask CreateMask() => new SpinnerPlacementMask();
protected override PlacementBlueprint CreateBlueprint() => new SpinnerPlacementBlueprint();
}
}

View File

@ -8,8 +8,8 @@ using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks;
using osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks.Components;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Tests.Visual;
@ -17,17 +17,17 @@ using OpenTK;
namespace osu.Game.Rulesets.Osu.Tests
{
public class TestCaseSpinnerSelectionMask : HitObjectSelectionMaskTestCase
public class TestCaseSpinnerSelectionBlueprint : SelectionBlueprintTestCase
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(SpinnerSelectionMask),
typeof(SpinnerSelectionBlueprint),
typeof(SpinnerPiece)
};
private readonly DrawableSpinner drawableSpinner;
public TestCaseSpinnerSelectionMask()
public TestCaseSpinnerSelectionBlueprint()
{
var spinner = new Spinner
{
@ -45,6 +45,6 @@ namespace osu.Game.Rulesets.Osu.Tests
});
}
protected override SelectionMask CreateMask() => new SpinnerSelectionMask(drawableSpinner) { Size = new Vector2(0.5f) };
protected override SelectionBlueprint CreateBlueprint() => new SpinnerSelectionBlueprint(drawableSpinner) { Size = new Vector2(0.5f) };
}
}

View File

@ -9,7 +9,7 @@ using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
using OpenTK;
namespace osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components
{
public class HitCirclePiece : CompositeDrawable
{

View File

@ -3,16 +3,16 @@
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components;
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
using osu.Game.Rulesets.Osu.Objects;
namespace osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles
{
public class HitCirclePlacementMask : PlacementMask
public class HitCirclePlacementBlueprint : PlacementBlueprint
{
public new HitCircle HitObject => (HitCircle)base.HitObject;
public HitCirclePlacementMask()
public HitCirclePlacementBlueprint()
: base(new HitCircle())
{
InternalChild = new HitCirclePiece(HitObject);

View File

@ -1,16 +1,15 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components;
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
namespace osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles
{
public class HitCircleSelectionMask : SelectionMask
public class HitCircleSelectionBlueprint : OsuSelectionBlueprint
{
public HitCircleSelectionMask(DrawableHitCircle hitCircle)
public HitCircleSelectionBlueprint(DrawableHitCircle hitCircle)
: base(hitCircle)
{
InternalChild = new HitCirclePiece((HitCircle)hitCircle.HitObject);

View File

@ -0,0 +1,22 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints
{
public class OsuSelectionBlueprint : SelectionBlueprint
{
protected OsuHitObject OsuObject => (OsuHitObject)HitObject.HitObject;
public OsuSelectionBlueprint(DrawableHitObject hitObject)
: base(hitObject)
{
}
public override void AdjustPosition(DragEvent dragEvent) => OsuObject.Position += dragEvent.Delta;
}
}

View File

@ -12,7 +12,7 @@ using osu.Game.Graphics;
using osu.Game.Rulesets.Osu.Objects;
using OpenTK;
namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
{
public class PathControlPointPiece : CompositeDrawable
{

View File

@ -5,7 +5,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Osu.Objects;
namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
{
public class PathControlPointVisualiser : CompositeDrawable
{

View File

@ -10,7 +10,7 @@ using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
{
public class SliderBodyPiece : CompositeDrawable
{

View File

@ -1,10 +1,10 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components;
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
using osu.Game.Rulesets.Osu.Objects;
namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
{
public class SliderCirclePiece : HitCirclePiece
{

View File

@ -1,18 +1,22 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
{
public class SliderCircleSelectionMask : SelectionMask
public class SliderCircleSelectionBlueprint : OsuSelectionBlueprint
{
public SliderCircleSelectionMask(DrawableOsuHitObject hitObject, Slider slider, SliderPosition position)
private readonly Slider slider;
public SliderCircleSelectionBlueprint(DrawableOsuHitObject hitObject, Slider slider, SliderPosition position)
: base(hitObject)
{
this.slider = slider;
InternalChild = new SliderCirclePiece(slider, position);
Select();
@ -20,5 +24,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks
// Todo: This is temporary, since the slider circle masks don't do anything special yet. In the future they will handle input.
public override bool HandlePositionalInput => false;
public override void AdjustPosition(DragEvent dragEvent) => slider.Position += dragEvent.Delta;
}
}

View File

@ -12,13 +12,13 @@ using osu.Framework.MathUtils;
using osu.Game.Graphics;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components;
using OpenTK;
using OpenTK.Input;
namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
{
public class SliderPlacementMask : PlacementMask
public class SliderPlacementBlueprint : PlacementBlueprint
{
public new Objects.Slider HitObject => (Objects.Slider)base.HitObject;
@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks
private PlacementState state;
public SliderPlacementMask()
public SliderPlacementBlueprint()
: base(new Objects.Slider())
{
RelativeSizeAxes = Axes.Both;

View File

@ -1,7 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
{
public enum SliderPosition
{

View File

@ -0,0 +1,32 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using OpenTK;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
{
public class SliderSelectionBlueprint : OsuSelectionBlueprint
{
private readonly SliderCircleSelectionBlueprint headBlueprint;
public SliderSelectionBlueprint(DrawableSlider slider)
: base(slider)
{
var sliderObject = (Slider)slider.HitObject;
InternalChildren = new Drawable[]
{
new SliderBodyPiece(sliderObject),
headBlueprint = new SliderCircleSelectionBlueprint(slider.HeadCircle, sliderObject, SliderPosition.Start),
new SliderCircleSelectionBlueprint(slider.TailCircle, sliderObject, SliderPosition.End),
new PathControlPointVisualiser(sliderObject),
};
}
public override Vector2 SelectionPoint => headBlueprint.SelectionPoint;
}
}

View File

@ -10,7 +10,7 @@ using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
using OpenTK;
namespace osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks.Components
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components
{
public class SpinnerPiece : CompositeDrawable
{

View File

@ -4,13 +4,13 @@
using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks.Components;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.UI;
namespace osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners
{
public class SpinnerPlacementMask : PlacementMask
public class SpinnerPlacementBlueprint : PlacementBlueprint
{
public new Spinner HitObject => (Spinner)base.HitObject;
@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks
private bool isPlacingEnd;
public SpinnerPlacementMask()
public SpinnerPlacementBlueprint()
: base(new Spinner { Position = OsuPlayfield.BASE_SIZE / 2 })
{
InternalChild = piece = new SpinnerPiece(HitObject) { Alpha = 0.5f };

View File

@ -1,24 +1,29 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks.Components;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using OpenTK;
namespace osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners
{
public class SpinnerSelectionMask : SelectionMask
public class SpinnerSelectionBlueprint : OsuSelectionBlueprint
{
private readonly SpinnerPiece piece;
public SpinnerSelectionMask(DrawableSpinner spinner)
public SpinnerSelectionBlueprint(DrawableSpinner spinner)
: base(spinner)
{
InternalChild = piece = new SpinnerPiece((Spinner)spinner.HitObject);
}
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => piece.ReceivePositionalInputAt(screenSpacePos);
public override void AdjustPosition(DragEvent dragEvent)
{
// Spinners don't support position adjustments
}
}
}

View File

@ -3,7 +3,7 @@
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Edit.Tools;
using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks;
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles;
using osu.Game.Rulesets.Osu.Objects;
namespace osu.Game.Rulesets.Osu.Edit
@ -15,6 +15,6 @@ namespace osu.Game.Rulesets.Osu.Edit
{
}
public override PlacementMask CreatePlacementMask() => new HitCirclePlacementMask();
public override PlacementBlueprint CreatePlacementBlueprint() => new HitCirclePlacementBlueprint();
}
}

View File

@ -1,33 +0,0 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using OpenTK;
namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks
{
public class SliderSelectionMask : SelectionMask
{
private readonly SliderCircleSelectionMask headMask;
public SliderSelectionMask(DrawableSlider slider)
: base(slider)
{
var sliderObject = (Slider)slider.HitObject;
InternalChildren = new Drawable[]
{
new SliderBodyPiece(sliderObject),
headMask = new SliderCircleSelectionMask(slider.HeadCircle, sliderObject, SliderPosition.Start),
new SliderCircleSelectionMask(slider.TailCircle, sliderObject, SliderPosition.End),
new PathControlPointVisualiser(sliderObject),
};
}
public override Vector2 SelectionPoint => headMask.SelectionPoint;
}
}

View File

@ -8,9 +8,9 @@ using osu.Game.Beatmaps;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Edit.Tools;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks;
using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks;
using osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks;
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Osu.UI;
@ -37,19 +37,19 @@ namespace osu.Game.Rulesets.Osu.Edit
protected override Container CreateLayerContainer() => new PlayfieldAdjustmentContainer { RelativeSizeAxes = Axes.Both };
public override SelectionMask CreateMaskFor(DrawableHitObject hitObject)
public override SelectionBlueprint CreateBlueprintFor(DrawableHitObject hitObject)
{
switch (hitObject)
{
case DrawableHitCircle circle:
return new HitCircleSelectionMask(circle);
return new HitCircleSelectionBlueprint(circle);
case DrawableSlider slider:
return new SliderSelectionMask(slider);
return new SliderSelectionBlueprint(slider);
case DrawableSpinner spinner:
return new SpinnerSelectionMask(spinner);
return new SpinnerSelectionBlueprint(spinner);
}
return base.CreateMaskFor(hitObject);
return base.CreateBlueprintFor(hitObject);
}
}
}

View File

@ -3,7 +3,7 @@
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Edit.Tools;
using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders;
using osu.Game.Rulesets.Osu.Objects;
namespace osu.Game.Rulesets.Osu.Edit
@ -15,6 +15,6 @@ namespace osu.Game.Rulesets.Osu.Edit
{
}
public override PlacementMask CreatePlacementMask() => new SliderPlacementMask();
public override PlacementBlueprint CreatePlacementBlueprint() => new SliderPlacementBlueprint();
}
}

View File

@ -3,7 +3,7 @@
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Edit.Tools;
using osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners;
using osu.Game.Rulesets.Osu.Objects;
namespace osu.Game.Rulesets.Osu.Edit
@ -15,6 +15,6 @@ namespace osu.Game.Rulesets.Osu.Edit
{
}
public override PlacementMask CreatePlacementMask() => new SpinnerPlacementMask();
public override PlacementBlueprint CreatePlacementBlueprint() => new SpinnerPlacementBlueprint();
}
}

View File

@ -7,11 +7,10 @@ using osu.Game.Rulesets.Objects;
using OpenTK;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Edit.Types;
namespace osu.Game.Rulesets.Osu.Objects
{
public abstract class OsuHitObject : HitObject, IHasComboInformation, IHasEditablePosition
public abstract class OsuHitObject : HitObject, IHasComboInformation, IHasPosition
{
public const double OBJECT_RADIUS = 64;
@ -100,8 +99,6 @@ namespace osu.Game.Rulesets.Osu.Objects
Scale = (1.0f - 0.7f * (difficulty.CircleSize - 5) / 5) / 2;
}
public virtual void OffsetPosition(Vector2 offset) => Position += offset;
protected override HitWindows CreateHitWindows() => new OsuHitWindows();
}
}

View File

@ -166,7 +166,7 @@ namespace osu.Game.Rulesets.Osu.Objects
private void createSliderEnds()
{
HeadCircle = new SliderCircle(this)
HeadCircle = new SliderCircle
{
StartTime = StartTime,
Position = Position,
@ -176,7 +176,7 @@ namespace osu.Game.Rulesets.Osu.Objects
ComboIndex = ComboIndex,
};
TailCircle = new SliderTailCircle(this)
TailCircle = new SliderTailCircle
{
StartTime = EndTime,
Position = EndPosition,

View File

@ -1,19 +1,9 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
namespace osu.Game.Rulesets.Osu.Objects
{
public class SliderCircle : HitCircle
{
private readonly Slider slider;
public SliderCircle(Slider slider)
{
this.slider = slider;
}
public override void OffsetPosition(Vector2 offset) => slider.OffsetPosition(offset);
}
}

View File

@ -8,11 +8,6 @@ namespace osu.Game.Rulesets.Osu.Objects
{
public class SliderTailCircle : SliderCircle
{
public SliderTailCircle(Slider slider)
: base(slider)
{
}
public override Judgement CreateJudgement() => new OsuSliderTailJudgement();
}
}

View File

@ -7,7 +7,6 @@ using osu.Game.Rulesets.Objects.Types;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Osu.Judgements;
using OpenTK;
namespace osu.Game.Rulesets.Osu.Objects
{
@ -32,10 +31,5 @@ namespace osu.Game.Rulesets.Osu.Objects
}
public override Judgement CreateJudgement() => new OsuJudgement();
public override void OffsetPosition(Vector2 offset)
{
// for now we don't want to allow spinners to be moved around.
}
}
}

View File

@ -5,7 +5,8 @@ using System;
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Screens.Edit.Screens.Compose;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Compose.Components;
using OpenTK;
namespace osu.Game.Tests.Visual

View File

@ -6,7 +6,7 @@ using System.Collections.Generic;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Game.Rulesets.Osu;
using osu.Game.Screens.Edit.Screens.Compose;
using osu.Game.Screens.Edit.Compose;
using osu.Game.Tests.Beatmaps;
namespace osu.Game.Tests.Visual
@ -14,13 +14,13 @@ namespace osu.Game.Tests.Visual
[TestFixture]
public class TestCaseEditorCompose : EditorClockTestCase
{
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(Compose) };
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(ComposeScreen) };
[BackgroundDependencyLoader]
private void load()
{
Beatmap.Value = new TestWorkingBeatmap(new OsuRuleset().RulesetInfo);
Child = new Compose();
Child = new ComposeScreen();
}
}
}

View File

@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Game.Screens.Edit.Screens.Compose.RadioButtons;
using osu.Game.Screens.Edit.Components.RadioButtons;
namespace osu.Game.Tests.Visual
{

View File

@ -13,7 +13,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Screens.Edit.Screens.Compose.Timeline;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
using OpenTK.Graphics;
namespace osu.Game.Tests.Visual

View File

@ -8,7 +8,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Edit.Menus;
using osu.Game.Screens.Edit.Components.Menus;
namespace osu.Game.Tests.Visual
{

View File

@ -13,11 +13,11 @@ using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Edit;
using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks;
using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components;
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles;
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Screens.Edit.Screens.Compose;
using osu.Game.Screens.Edit.Screens.Compose.Layers;
using osu.Game.Screens.Edit.Compose;
using osu.Game.Screens.Edit.Compose.Components;
using osu.Game.Tests.Beatmaps;
namespace osu.Game.Tests.Visual
@ -28,15 +28,15 @@ namespace osu.Game.Tests.Visual
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(MaskSelection),
typeof(DragLayer),
typeof(SelectionBox),
typeof(DragBox),
typeof(HitObjectComposer),
typeof(OsuHitObjectComposer),
typeof(HitObjectMaskLayer),
typeof(BlueprintContainer),
typeof(NotNullAttribute),
typeof(HitCirclePiece),
typeof(HitCircleSelectionMask),
typeof(HitCirclePlacementMask),
typeof(HitCircleSelectionBlueprint),
typeof(HitCirclePlacementBlueprint),
};
private HitObjectComposer composer;

View File

@ -5,9 +5,9 @@ using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents;
using System;
using System.Collections.Generic;
using osu.Game.Screens.Edit.Setup.Components.LabelledComponents;
namespace osu.Game.Tests.Visual
{

View File

@ -10,7 +10,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.MathUtils;
using osu.Game.Graphics;
using osu.Game.Graphics.Cursor;
using osu.Game.Screens.Edit.Screens.Compose.Timeline;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
using OpenTK;
using OpenTK.Graphics;

View File

@ -16,8 +16,8 @@ using osu.Game.Rulesets.Edit.Tools;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI;
using osu.Game.Screens.Edit.Screens.Compose.Layers;
using osu.Game.Screens.Edit.Screens.Compose.RadioButtons;
using osu.Game.Screens.Edit.Components.RadioButtons;
using osu.Game.Screens.Edit.Compose.Components;
namespace osu.Game.Rulesets.Edit
{
@ -35,8 +35,7 @@ namespace osu.Game.Rulesets.Edit
private EditRulesetContainer rulesetContainer;
private HitObjectMaskLayer maskLayer;
private PlacementContainer placementContainer;
private BlueprintContainer blueprintContainer;
internal HitObjectComposer(Ruleset ruleset)
{
@ -62,14 +61,10 @@ namespace osu.Game.Rulesets.Edit
}
var layerBelowRuleset = CreateLayerContainer();
layerBelowRuleset.Child = new BorderLayer { RelativeSizeAxes = Axes.Both };
layerBelowRuleset.Child = new EditorPlayfieldBorder { RelativeSizeAxes = Axes.Both };
var layerAboveRuleset = CreateLayerContainer();
layerAboveRuleset.Children = new Drawable[]
{
maskLayer = new HitObjectMaskLayer(),
placementContainer = new PlacementContainer(),
};
layerAboveRuleset.Child = blueprintContainer = new BlueprintContainer();
layerContainers.Add(layerBelowRuleset);
layerContainers.Add(layerAboveRuleset);
@ -112,8 +107,8 @@ namespace osu.Game.Rulesets.Edit
};
toolboxCollection.Items =
CompositionTools.Select(t => new RadioButton(t.Name, () => placementContainer.CurrentTool = t))
.Prepend(new RadioButton("Select", () => placementContainer.CurrentTool = null))
CompositionTools.Select(t => new RadioButton(t.Name, () => blueprintContainer.CurrentTool = t))
.Prepend(new RadioButton("Select", () => blueprintContainer.CurrentTool = null))
.ToList();
toolboxCollection.Items[0].Select();
@ -146,29 +141,25 @@ namespace osu.Game.Rulesets.Edit
/// Adds a <see cref="HitObject"/> to the <see cref="Beatmaps.Beatmap"/> and visualises it.
/// </summary>
/// <param name="hitObject">The <see cref="HitObject"/> to add.</param>
public void Add(HitObject hitObject)
{
maskLayer.AddMaskFor(rulesetContainer.Add(hitObject));
placementContainer.Refresh();
}
public void Add(HitObject hitObject) => blueprintContainer.AddBlueprintFor(rulesetContainer.Add(hitObject));
public void Remove(HitObject hitObject) => maskLayer.RemoveMaskFor(rulesetContainer.Remove(hitObject));
public void Remove(HitObject hitObject) => blueprintContainer.RemoveBlueprintFor(rulesetContainer.Remove(hitObject));
internal abstract EditRulesetContainer CreateRulesetContainer();
protected abstract IReadOnlyList<HitObjectCompositionTool> CompositionTools { get; }
/// <summary>
/// Creates a <see cref="SelectionMask"/> for a specific <see cref="DrawableHitObject"/>.
/// Creates a <see cref="SelectionBlueprint"/> for a specific <see cref="DrawableHitObject"/>.
/// </summary>
/// <param name="hitObject">The <see cref="DrawableHitObject"/> to create the overlay for.</param>
public virtual SelectionMask CreateMaskFor(DrawableHitObject hitObject) => null;
public virtual SelectionBlueprint CreateBlueprintFor(DrawableHitObject hitObject) => null;
/// <summary>
/// Creates a <see cref="MaskSelection"/> which outlines <see cref="DrawableHitObject"/>s
/// Creates a <see cref="SelectionBox"/> which outlines <see cref="DrawableHitObject"/>s
/// and handles hitobject pattern adjustments.
/// </summary>
public virtual MaskSelection CreateMaskSelection() => new MaskSelection();
public virtual SelectionBox CreateSelectionBox() => new SelectionBox();
/// <summary>
/// Creates a <see cref="ScalableContainer"/> which provides a layer above or below the <see cref="Playfield"/>.

View File

@ -10,15 +10,15 @@ using osu.Framework.Input.Events;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Objects;
using osu.Game.Screens.Edit.Screens.Compose;
using osu.Game.Screens.Edit.Compose;
using OpenTK;
namespace osu.Game.Rulesets.Edit
{
/// <summary>
/// A mask which governs the creation of a new <see cref="HitObject"/> to actualisation.
/// A blueprint which governs the creation of a new <see cref="HitObject"/> to actualisation.
/// </summary>
public abstract class PlacementMask : CompositeDrawable, IRequireHighFrequencyMousePosition
public abstract class PlacementBlueprint : CompositeDrawable, IRequireHighFrequencyMousePosition
{
/// <summary>
/// The <see cref="HitObject"/> that is being placed.
@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Edit
[Resolved]
private IPlacementHandler placementHandler { get; set; }
protected PlacementMask(HitObject hitObject)
protected PlacementBlueprint(HitObject hitObject)
{
HitObject = hitObject;
@ -62,7 +62,7 @@ namespace osu.Game.Rulesets.Edit
/// <summary>
/// Signals that the placement of <see cref="HitObject"/> has finished.
/// This will destroy this <see cref="PlacementMask"/>, and add the <see cref="HitObject"/> to the <see cref="Beatmap"/>.
/// This will destroy this <see cref="PlacementBlueprint"/>, and add the <see cref="HitObject"/> to the <see cref="Beatmap"/>.
/// </summary>
protected void EndPlacement()
{

View File

@ -15,33 +15,33 @@ using OpenTK;
namespace osu.Game.Rulesets.Edit
{
/// <summary>
/// A mask placed above a <see cref="DrawableHitObject"/> adding editing functionality.
/// A blueprint placed above a <see cref="DrawableHitObject"/> adding editing functionality.
/// </summary>
public class SelectionMask : CompositeDrawable, IStateful<SelectionState>
public abstract class SelectionBlueprint : CompositeDrawable, IStateful<SelectionState>
{
/// <summary>
/// Invoked when this <see cref="SelectionMask"/> has been selected.
/// Invoked when this <see cref="SelectionBlueprint"/> has been selected.
/// </summary>
public event Action<SelectionMask> Selected;
public event Action<SelectionBlueprint> Selected;
/// <summary>
/// Invoked when this <see cref="SelectionMask"/> has been deselected.
/// Invoked when this <see cref="SelectionBlueprint"/> has been deselected.
/// </summary>
public event Action<SelectionMask> Deselected;
public event Action<SelectionBlueprint> Deselected;
/// <summary>
/// Invoked when this <see cref="SelectionMask"/> has requested selection.
/// Invoked when this <see cref="SelectionBlueprint"/> has requested selection.
/// Will fire even if already selected. Does not actually perform selection.
/// </summary>
public event Action<SelectionMask, InputState> SelectionRequested;
public event Action<SelectionBlueprint, InputState> SelectionRequested;
/// <summary>
/// Invoked when this <see cref="SelectionMask"/> has requested drag.
/// Invoked when this <see cref="SelectionBlueprint"/> has requested drag.
/// </summary>
public event Action<SelectionMask, Vector2, InputState> DragRequested;
public event Action<DragEvent> DragRequested;
/// <summary>
/// The <see cref="DrawableHitObject"/> which this <see cref="SelectionMask"/> applies to.
/// The <see cref="DrawableHitObject"/> which this <see cref="SelectionBlueprint"/> applies to.
/// </summary>
public readonly DrawableHitObject HitObject;
@ -49,7 +49,7 @@ namespace osu.Game.Rulesets.Edit
public override bool HandlePositionalInput => ShouldBeAlive;
public override bool RemoveWhenNotAlive => false;
public SelectionMask(DrawableHitObject hitObject)
protected SelectionBlueprint(DrawableHitObject hitObject)
{
HitObject = hitObject;
@ -86,12 +86,12 @@ namespace osu.Game.Rulesets.Edit
}
/// <summary>
/// Selects this <see cref="SelectionMask"/>, causing it to become visible.
/// Selects this <see cref="SelectionBlueprint"/>, causing it to become visible.
/// </summary>
public void Select() => State = SelectionState.Selected;
/// <summary>
/// Deselects this <see cref="SelectionMask"/>, causing it to become invisible.
/// Deselects this <see cref="SelectionBlueprint"/>, causing it to become invisible.
/// </summary>
public void Deselect() => State = SelectionState.NotSelected;
@ -130,17 +130,19 @@ namespace osu.Game.Rulesets.Edit
protected override bool OnDrag(DragEvent e)
{
DragRequested?.Invoke(this, e.Delta, e.CurrentState);
DragRequested?.Invoke(e);
return true;
}
public abstract void AdjustPosition(DragEvent dragEvent);
/// <summary>
/// The screen-space point that causes this <see cref="SelectionMask"/> to be selected.
/// The screen-space point that causes this <see cref="SelectionBlueprint"/> to be selected.
/// </summary>
public virtual Vector2 SelectionPoint => HitObject.ScreenSpaceDrawQuad.Centre;
/// <summary>
/// The screen-space quad that outlines this <see cref="SelectionMask"/> for selections.
/// The screen-space quad that outlines this <see cref="SelectionBlueprint"/> for selections.
/// </summary>
public virtual Quad SelectionQuad => HitObject.ScreenSpaceDrawQuad;
}

View File

@ -12,6 +12,6 @@ namespace osu.Game.Rulesets.Edit.Tools
Name = name;
}
public abstract PlacementMask CreatePlacementMask();
public abstract PlacementBlueprint CreatePlacementBlueprint();
}
}

View File

@ -1,13 +0,0 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Objects.Types;
using OpenTK;
namespace osu.Game.Rulesets.Edit.Types
{
public interface IHasEditablePosition : IHasPosition
{
void OffsetPosition(Vector2 offset);
}
}

View File

@ -7,7 +7,6 @@ using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Extensions.TypeExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Primitives;
using osu.Game.Audio;
using osu.Game.Graphics;
@ -167,13 +166,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
}
}
public override bool UpdateSubTreeMasking(Drawable source, RectangleF maskingBounds)
{
if (!AllJudged)
return false;
return base.UpdateSubTreeMasking(source, maskingBounds);
}
protected override bool ComputeIsMaskedAway(RectangleF maskingBounds) => AllJudged && base.ComputeIsMaskedAway(maskingBounds);
protected override void UpdateAfterChildren()
{

View File

@ -5,7 +5,7 @@ using System;
using System.Linq;
using osu.Framework.Configuration;
namespace osu.Game.Screens.Edit.Screens.Compose
namespace osu.Game.Screens.Edit
{
public class BindableBeatDivisor : BindableNumber<int>
{

View File

@ -2,19 +2,18 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Configuration;
using osu.Framework.Input.Events;
using osu.Game.Screens.Edit.Screens;
namespace osu.Game.Screens.Edit.Menus
namespace osu.Game.Screens.Edit.Components.Menus
{
public class EditorMenuBar : OsuMenu
{

View File

@ -4,7 +4,7 @@
using System;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Screens.Edit.Menus
namespace osu.Game.Screens.Edit.Components.Menus
{
public class EditorMenuItem : OsuMenuItem
{

View File

@ -1,7 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Screens.Edit.Menus
namespace osu.Game.Screens.Edit.Components.Menus
{
public class EditorMenuItemSpacer : EditorMenuItem
{

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
@ -9,10 +8,10 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Edit.Screens;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Screens.Edit.Menus
namespace osu.Game.Screens.Edit.Components.Menus
{
public class ScreenSelectionTabControl : OsuTabControl<EditorScreenMode>
{

View File

@ -2,8 +2,6 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
@ -14,8 +12,10 @@ using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Screens.Edit.Screens.Compose.RadioButtons
namespace osu.Game.Screens.Edit.Components.RadioButtons
{
public class DrawableRadioButton : TriangleButton
{

View File

@ -4,7 +4,7 @@
using System;
using osu.Framework.Configuration;
namespace osu.Game.Screens.Edit.Screens.Compose.RadioButtons
namespace osu.Game.Screens.Edit.Components.RadioButtons
{
public class RadioButton
{

View File

@ -2,12 +2,12 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using OpenTK;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using OpenTK;
namespace osu.Game.Screens.Edit.Screens.Compose.RadioButtons
namespace osu.Game.Screens.Edit.Components.RadioButtons
{
public class RadioButtonCollection : CompositeDrawable
{

View File

@ -19,7 +19,7 @@ using OpenTK;
using OpenTK.Graphics;
using OpenTK.Input;
namespace osu.Game.Screens.Edit.Screens.Compose
namespace osu.Game.Screens.Edit.Compose.Components
{
public class BeatDivisorControl : CompositeDrawable
{

View File

@ -0,0 +1,191 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Edit.Tools;
using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Screens.Edit.Compose.Components
{
public class BlueprintContainer : CompositeDrawable
{
private SelectionBlueprintContainer selectionBlueprints;
private Container<PlacementBlueprint> placementBlueprintContainer;
private SelectionBox selectionBox;
private IEnumerable<SelectionBlueprint> selections => selectionBlueprints.Children.Where(c => c.IsAlive);
[Resolved]
private HitObjectComposer composer { get; set; }
public BlueprintContainer()
{
RelativeSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
private void load()
{
selectionBox = composer.CreateSelectionBox();
selectionBox.DeselectAll = deselectAll;
var dragBox = new DragBox(select);
dragBox.DragEnd += () => selectionBox.UpdateVisibility();
InternalChildren = new[]
{
dragBox,
selectionBox,
selectionBlueprints = new SelectionBlueprintContainer { RelativeSizeAxes = Axes.Both },
placementBlueprintContainer = new Container<PlacementBlueprint> { RelativeSizeAxes = Axes.Both },
dragBox.CreateProxy()
};
foreach (var obj in composer.HitObjects)
AddBlueprintFor(obj);
}
private HitObjectCompositionTool currentTool;
/// <summary>
/// The current placement tool.
/// </summary>
public HitObjectCompositionTool CurrentTool
{
get => currentTool;
set
{
if (currentTool == value)
return;
currentTool = value;
refreshTool();
}
}
/// <summary>
/// Adds a blueprint for a <see cref="DrawableHitObject"/> which adds movement support.
/// </summary>
/// <param name="hitObject">The <see cref="DrawableHitObject"/> to create a blueprint for.</param>
public void AddBlueprintFor(DrawableHitObject hitObject)
{
refreshTool();
var blueprint = composer.CreateBlueprintFor(hitObject);
if (blueprint == null)
return;
blueprint.Selected += onBlueprintSelected;
blueprint.Deselected += onBlueprintDeselected;
blueprint.SelectionRequested += onSelectionRequested;
blueprint.DragRequested += onDragRequested;
selectionBlueprints.Add(blueprint);
}
/// <summary>
/// Removes a blueprint for a <see cref="DrawableHitObject"/>.
/// </summary>
/// <param name="hitObject">The <see cref="DrawableHitObject"/> for which to remove the blueprint.</param>
public void RemoveBlueprintFor(DrawableHitObject hitObject)
{
var blueprint = selectionBlueprints.Single(m => m.HitObject == hitObject);
if (blueprint == null)
return;
blueprint.Deselect();
blueprint.Selected -= onBlueprintSelected;
blueprint.Deselected -= onBlueprintDeselected;
blueprint.SelectionRequested -= onSelectionRequested;
blueprint.DragRequested -= onDragRequested;
selectionBlueprints.Remove(blueprint);
}
protected override bool OnClick(ClickEvent e)
{
deselectAll();
return true;
}
/// <summary>
/// Refreshes the current placement tool.
/// </summary>
private void refreshTool()
{
placementBlueprintContainer.Clear();
var blueprint = CurrentTool?.CreatePlacementBlueprint();
if (blueprint != null)
placementBlueprintContainer.Child = blueprint;
}
/// <summary>
/// Select all masks in a given rectangle selection area.
/// </summary>
/// <param name="rect">The rectangle to perform a selection on in screen-space coordinates.</param>
private void select(RectangleF rect)
{
foreach (var blueprint in selections.ToList())
{
if (blueprint.IsPresent && rect.Contains(blueprint.SelectionPoint))
blueprint.Select();
else
blueprint.Deselect();
}
}
/// <summary>
/// Deselects all selected <see cref="SelectionBlueprint"/>s.
/// </summary>
private void deselectAll() => selections.ToList().ForEach(m => m.Deselect());
private void onBlueprintSelected(SelectionBlueprint blueprint)
{
selectionBox.HandleSelected(blueprint);
selectionBlueprints.ChangeChildDepth(blueprint, 1);
}
private void onBlueprintDeselected(SelectionBlueprint blueprint)
{
selectionBox.HandleDeselected(blueprint);
selectionBlueprints.ChangeChildDepth(blueprint, 0);
}
private void onSelectionRequested(SelectionBlueprint blueprint, InputState state) => selectionBox.HandleSelectionRequested(blueprint, state);
private void onDragRequested(DragEvent dragEvent) => selectionBox.HandleDrag(dragEvent);
private class SelectionBlueprintContainer : Container<SelectionBlueprint>
{
protected override int Compare(Drawable x, Drawable y)
{
if (!(x is SelectionBlueprint xBlueprint) || !(y is SelectionBlueprint yBlueprint))
return base.Compare(x, y);
return Compare(xBlueprint, yBlueprint);
}
public int Compare(SelectionBlueprint x, SelectionBlueprint y)
{
// dpeth is used to denote selected status (we always want selected blueprints to handle input first).
int d = x.Depth.CompareTo(y.Depth);
if (d != 0)
return d;
// Put earlier hitobjects towards the end of the list, so they handle input first
int i = y.HitObject.HitObject.StartTime.CompareTo(x.HitObject.HitObject.StartTime);
return i == 0 ? CompareReverseChildID(x, y) : i;
}
}
}
}

View File

@ -8,15 +8,14 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Edit;
using OpenTK.Graphics;
namespace osu.Game.Screens.Edit.Screens.Compose.Layers
namespace osu.Game.Screens.Edit.Compose.Components
{
/// <summary>
/// A layer that handles and displays drag selection for a collection of <see cref="SelectionMask"/>s.
/// A box that displays the drag selection and provides selection events for users to handle.
/// </summary>
public class DragLayer : CompositeDrawable
public class DragBox : CompositeDrawable
{
private readonly Action<RectangleF> performSelection;
@ -28,10 +27,10 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
private Drawable box;
/// <summary>
/// Creates a new <see cref="DragLayer"/>.
/// Creates a new <see cref="DragBox"/>.
/// </summary>
/// <param name="maskContainer">The selectable <see cref="SelectionMask"/>s.</param>
public DragLayer(Action<RectangleF> performSelection)
/// <param name="performSelection">A delegate that performs drag selection.</param>
public DragBox(Action<RectangleF> performSelection)
{
this.performSelection = performSelection;
@ -47,7 +46,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
{
Masking = true,
BorderColour = Color4.White,
BorderThickness = MaskSelection.BORDER_RADIUS,
BorderThickness = SelectionBox.BORDER_RADIUS,
Child = new Box
{
RelativeSizeAxes = Axes.Both,

View File

@ -0,0 +1,32 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using OpenTK.Graphics;
namespace osu.Game.Screens.Edit.Compose.Components
{
/// <summary>
/// Provides a border around the playfield.
/// </summary>
public class EditorPlayfieldBorder : CompositeDrawable
{
public EditorPlayfieldBorder()
{
RelativeSizeAxes = Axes.Both;
Masking = true;
BorderColour = Color4.White;
BorderThickness = 2;
InternalChild = new Box
{
RelativeSizeAxes = Axes.Both,
Alpha = 0,
AlwaysPresent = true
};
}
}
}

View File

@ -12,29 +12,28 @@ using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using osu.Game.Graphics;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Edit.Types;
using OpenTK;
using OpenTK.Input;
namespace osu.Game.Screens.Edit.Screens.Compose.Layers
namespace osu.Game.Screens.Edit.Compose.Components
{
/// <summary>
/// A box which surrounds <see cref="SelectionMask"/>s and provides interactive handles, context menus etc.
/// A box which surrounds <see cref="SelectionBlueprint"/>s and provides interactive handles, context menus etc.
/// </summary>
public class MaskSelection : CompositeDrawable
public class SelectionBox : CompositeDrawable
{
public const float BORDER_RADIUS = 2;
private readonly List<SelectionMask> selectedMasks;
private readonly List<SelectionBlueprint> selectedBlueprints;
private Drawable outline;
[Resolved]
private IPlacementHandler placementHandler { get; set; }
public MaskSelection()
public SelectionBox()
{
selectedMasks = new List<SelectionMask>();
selectedBlueprints = new List<SelectionBlueprint>();
RelativeSizeAxes = Axes.Both;
AlwaysPresent = true;
@ -60,19 +59,12 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
#region User Input Handling
public void HandleDrag(SelectionMask m, Vector2 delta, InputState state)
public void HandleDrag(DragEvent dragEvent)
{
// Todo: Various forms of snapping
foreach (var mask in selectedMasks)
{
switch (mask.HitObject.HitObject)
{
case IHasEditablePosition editablePosition:
editablePosition.OffsetPosition(delta);
break;
}
}
foreach (var blueprint in selectedBlueprints)
blueprint.AdjustPosition(dragEvent);
}
protected override bool OnKeyDown(KeyDownEvent e)
@ -83,7 +75,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
switch (e.Key)
{
case Key.Delete:
foreach (var h in selectedMasks.ToList())
foreach (var h in selectedBlueprints.ToList())
placementHandler.Delete(h.HitObject.HitObject);
return true;
}
@ -96,49 +88,49 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
#region Selection Handling
/// <summary>
/// Bind an action to deselect all selected masks.
/// Bind an action to deselect all selected blueprints.
/// </summary>
public Action DeselectAll { private get; set; }
/// <summary>
/// Handle a mask becoming selected.
/// Handle a blueprint becoming selected.
/// </summary>
/// <param name="mask">The mask.</param>
public void HandleSelected(SelectionMask mask) => selectedMasks.Add(mask);
/// <param name="blueprint">The blueprint.</param>
public void HandleSelected(SelectionBlueprint blueprint) => selectedBlueprints.Add(blueprint);
/// <summary>
/// Handle a mask becoming deselected.
/// Handle a blueprint becoming deselected.
/// </summary>
/// <param name="mask">The mask.</param>
public void HandleDeselected(SelectionMask mask)
/// <param name="blueprint">The blueprint.</param>
public void HandleDeselected(SelectionBlueprint blueprint)
{
selectedMasks.Remove(mask);
selectedBlueprints.Remove(blueprint);
// We don't want to update visibility if > 0, since we may be deselecting masks during drag-selection
if (selectedMasks.Count == 0)
// We don't want to update visibility if > 0, since we may be deselecting blueprints during drag-selection
if (selectedBlueprints.Count == 0)
UpdateVisibility();
}
/// <summary>
/// Handle a mask requesting selection.
/// Handle a blueprint requesting selection.
/// </summary>
/// <param name="mask">The mask.</param>
public void HandleSelectionRequested(SelectionMask mask, InputState state)
/// <param name="blueprint">The blueprint.</param>
public void HandleSelectionRequested(SelectionBlueprint blueprint, InputState state)
{
if (state.Keyboard.ControlPressed)
{
if (mask.IsSelected)
mask.Deselect();
if (blueprint.IsSelected)
blueprint.Deselect();
else
mask.Select();
blueprint.Select();
}
else
{
if (mask.IsSelected)
if (blueprint.IsSelected)
return;
DeselectAll?.Invoke();
mask.Select();
blueprint.Select();
}
UpdateVisibility();
@ -147,11 +139,11 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
#endregion
/// <summary>
/// Updates whether this <see cref="MaskSelection"/> is visible.
/// Updates whether this <see cref="SelectionBox"/> is visible.
/// </summary>
internal void UpdateVisibility()
{
if (selectedMasks.Count > 0)
if (selectedBlueprints.Count > 0)
Show();
else
Hide();
@ -161,7 +153,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
{
base.Update();
if (selectedMasks.Count == 0)
if (selectedBlueprints.Count == 0)
return;
// Move the rectangle to cover the hitobjects
@ -170,10 +162,10 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
bool hasSelection = false;
foreach (var mask in selectedMasks)
foreach (var blueprint in selectedBlueprints)
{
topLeft = Vector2.ComponentMin(topLeft, ToLocalSpace(mask.SelectionQuad.TopLeft));
bottomRight = Vector2.ComponentMax(bottomRight, ToLocalSpace(mask.SelectionQuad.BottomRight));
topLeft = Vector2.ComponentMin(topLeft, ToLocalSpace(blueprint.SelectionQuad.TopLeft));
bottomRight = Vector2.ComponentMax(bottomRight, ToLocalSpace(blueprint.SelectionQuad.BottomRight));
}
topLeft -= new Vector2(5);

View File

@ -8,7 +8,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using OpenTK;
namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{
public class CentreMarker : CompositeDrawable
{

View File

@ -12,7 +12,7 @@ using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{
public class Timeline : ZoomableScrollContainer
{

View File

@ -1,14 +1,14 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using OpenTK;
namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{
public class TimelineArea : CompositeDrawable
{

View File

@ -2,15 +2,15 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{
public class TimelineButton : CompositeDrawable
{

View File

@ -9,7 +9,7 @@ using osu.Framework.Input.Events;
using osu.Framework.MathUtils;
using OpenTK;
namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{
public class ZoomableScrollContainer : ScrollContainer
{

View File

@ -3,7 +3,6 @@
using JetBrains.Annotations;
using osu.Framework.Allocation;
using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -11,12 +10,14 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Logging;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Screens.Edit.Screens.Compose.Timeline;
using osu.Game.Screens.Edit.Compose.Components;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
using OpenTK.Graphics;
namespace osu.Game.Screens.Edit.Screens.Compose
namespace osu.Game.Screens.Edit.Compose
{
[Cached(Type = typeof(IPlacementHandler))]
public class Compose : EditorScreen, IPlacementHandler
public class ComposeScreen : EditorScreen, IPlacementHandler
{
private const float vertical_margins = 10;
private const float horizontal_margins = 20;

View File

@ -3,7 +3,7 @@
using osu.Game.Rulesets.Objects;
namespace osu.Game.Screens.Edit.Screens.Compose
namespace osu.Game.Screens.Edit.Compose
{
public interface IPlacementHandler
{

View File

@ -7,11 +7,11 @@ using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Sprites;
using OpenTK.Graphics;
namespace osu.Game.Screens.Edit.Screens.Design
namespace osu.Game.Screens.Edit.Design
{
public class Design : EditorScreen
public class DesignScreen : EditorScreen
{
public Design()
public DesignScreen()
{
Add(new Container
{

View File

@ -8,7 +8,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Screens.Edit.Menus;
using osu.Game.Screens.Edit.Components.Timelines.Summary;
using osu.Framework.Allocation;
using osu.Framework.Graphics.UserInterface;
@ -16,10 +15,10 @@ using osu.Framework.Input.Events;
using osu.Framework.Platform;
using osu.Framework.Timing;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Edit.Screens;
using osu.Game.Screens.Edit.Screens.Compose;
using osu.Game.Screens.Edit.Screens.Design;
using osu.Game.Screens.Edit.Components;
using osu.Game.Screens.Edit.Components.Menus;
using osu.Game.Screens.Edit.Compose;
using osu.Game.Screens.Edit.Design;
namespace osu.Game.Screens.Edit
{
@ -169,10 +168,10 @@ namespace osu.Game.Screens.Edit
switch (mode)
{
case EditorScreenMode.Compose:
currentScreen = new Compose();
currentScreen = new ComposeScreen();
break;
case EditorScreenMode.Design:
currentScreen = new Design();
currentScreen = new DesignScreen();
break;
default:
currentScreen = new EditorScreen();

View File

@ -7,7 +7,6 @@ using osu.Framework.MathUtils;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Screens.Edit.Screens.Compose;
using OpenTK;
namespace osu.Game.Screens.Edit

View File

@ -7,7 +7,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
namespace osu.Game.Screens.Edit.Screens
namespace osu.Game.Screens.Edit
{
/// <summary>
/// TODO: eventually make this inherit Screen and add a local scren stack inside the Editor.

View File

@ -3,7 +3,7 @@
using System.ComponentModel;
namespace osu.Game.Screens.Edit.Screens
namespace osu.Game.Screens.Edit
{
public enum EditorScreenMode
{

View File

@ -1,38 +0,0 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using OpenTK.Graphics;
namespace osu.Game.Screens.Edit.Screens.Compose.Layers
{
public class BorderLayer : Container
{
protected override Container<Drawable> Content => content;
private readonly Container content;
public BorderLayer()
{
InternalChildren = new Drawable[]
{
new Container
{
Name = "Border",
RelativeSizeAxes = Axes.Both,
Masking = true,
BorderColour = Color4.White,
BorderThickness = 2,
Child = new Box
{
RelativeSizeAxes = Axes.Both,
Alpha = 0,
AlwaysPresent = true
}
},
content = new Container { RelativeSizeAxes = Axes.Both }
};
}
}
}

View File

@ -1,88 +0,0 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Screens.Edit.Screens.Compose.Layers
{
public class HitObjectMaskLayer : CompositeDrawable
{
private MaskContainer maskContainer;
[Resolved]
private HitObjectComposer composer { get; set; }
public HitObjectMaskLayer()
{
RelativeSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
private void load()
{
maskContainer = new MaskContainer();
var maskSelection = composer.CreateMaskSelection();
maskContainer.MaskSelected += maskSelection.HandleSelected;
maskContainer.MaskDeselected += maskSelection.HandleDeselected;
maskContainer.MaskSelectionRequested += maskSelection.HandleSelectionRequested;
maskContainer.MaskDragRequested += maskSelection.HandleDrag;
maskSelection.DeselectAll = maskContainer.DeselectAll;
var dragLayer = new DragLayer(maskContainer.Select);
dragLayer.DragEnd += () => maskSelection.UpdateVisibility();
InternalChildren = new[]
{
dragLayer,
maskSelection,
maskContainer,
dragLayer.CreateProxy()
};
foreach (var obj in composer.HitObjects)
AddMaskFor(obj);
}
protected override bool OnClick(ClickEvent e)
{
maskContainer.DeselectAll();
return true;
}
/// <summary>
/// Adds a mask for a <see cref="DrawableHitObject"/> which adds movement support.
/// </summary>
/// <param name="hitObject">The <see cref="DrawableHitObject"/> to create a mask for.</param>
public void AddMaskFor(DrawableHitObject hitObject)
{
var mask = composer.CreateMaskFor(hitObject);
if (mask == null)
return;
maskContainer.Add(mask);
}
/// <summary>
/// Removes a mask for a <see cref="DrawableHitObject"/>.
/// </summary>
/// <param name="hitObject">The <see cref="DrawableHitObject"/> for which to remove the mask.</param>
public void RemoveMaskFor(DrawableHitObject hitObject)
{
var maskToRemove = maskContainer.Single(m => m.HitObject == hitObject);
if (maskToRemove == null)
return;
maskToRemove.Deselect();
maskContainer.Remove(maskToRemove);
}
}
}

View File

@ -1,128 +0,0 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.States;
using osu.Game.Rulesets.Edit;
using OpenTK;
using RectangleF = osu.Framework.Graphics.Primitives.RectangleF;
namespace osu.Game.Screens.Edit.Screens.Compose.Layers
{
public class MaskContainer : Container<SelectionMask>
{
/// <summary>
/// Invoked when any <see cref="SelectionMask"/> is selected.
/// </summary>
public event Action<SelectionMask> MaskSelected;
/// <summary>
/// Invoked when any <see cref="SelectionMask"/> is deselected.
/// </summary>
public event Action<SelectionMask> MaskDeselected;
/// <summary>
/// Invoked when any <see cref="SelectionMask"/> requests selection.
/// </summary>
public event Action<SelectionMask, InputState> MaskSelectionRequested;
/// <summary>
/// Invoked when any <see cref="SelectionMask"/> requests drag.
/// </summary>
public event Action<SelectionMask, Vector2, InputState> MaskDragRequested;
private IEnumerable<SelectionMask> aliveMasks => AliveInternalChildren.Cast<SelectionMask>();
public MaskContainer()
{
RelativeSizeAxes = Axes.Both;
}
public override void Add(SelectionMask drawable)
{
if (drawable == null) throw new ArgumentNullException(nameof(drawable));
base.Add(drawable);
drawable.Selected += onMaskSelected;
drawable.Deselected += onMaskDeselected;
drawable.SelectionRequested += onSelectionRequested;
drawable.DragRequested += onDragRequested;
}
public override bool Remove(SelectionMask drawable)
{
if (drawable == null) throw new ArgumentNullException(nameof(drawable));
var result = base.Remove(drawable);
if (result)
{
drawable.Selected -= onMaskSelected;
drawable.Deselected -= onMaskDeselected;
drawable.SelectionRequested -= onSelectionRequested;
drawable.DragRequested -= onDragRequested;
}
return result;
}
/// <summary>
/// Select all masks in a given rectangle selection area.
/// </summary>
/// <param name="rect">The rectangle to perform a selection on in screen-space coordinates.</param>
public void Select(RectangleF rect)
{
foreach (var mask in aliveMasks.ToList())
{
if (mask.IsPresent && rect.Contains(mask.SelectionPoint))
mask.Select();
else
mask.Deselect();
}
}
/// <summary>
/// Deselects all selected <see cref="SelectionMask"/>s.
/// </summary>
public void DeselectAll() => aliveMasks.ToList().ForEach(m => m.Deselect());
private void onMaskSelected(SelectionMask mask)
{
MaskSelected?.Invoke(mask);
ChangeChildDepth(mask, 1);
}
private void onMaskDeselected(SelectionMask mask)
{
MaskDeselected?.Invoke(mask);
ChangeChildDepth(mask, 0);
}
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 SelectionMask xMask) || !(y is SelectionMask yMask))
return base.Compare(x, y);
return Compare(xMask, yMask);
}
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);
if (d != 0)
return d;
// Put earlier hitobjects towards the end of the list, so they handle input first
int i = y.HitObject.HitObject.StartTime.CompareTo(x.HitObject.HitObject.StartTime);
return i == 0 ? CompareReverseChildID(x, y) : i;
}
}
}

View File

@ -1,50 +0,0 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Edit.Tools;
using Container = System.ComponentModel.Container;
namespace osu.Game.Screens.Edit.Screens.Compose.Layers
{
public class PlacementContainer : CompositeDrawable
{
private readonly Container maskContainer;
public PlacementContainer()
{
RelativeSizeAxes = Axes.Both;
}
private HitObjectCompositionTool currentTool;
/// <summary>
/// The current placement tool.
/// </summary>
public HitObjectCompositionTool CurrentTool
{
get => currentTool;
set
{
if (currentTool == value)
return;
currentTool = value;
Refresh();
}
}
/// <summary>
/// Refreshes the current placement tool.
/// </summary>
public void Refresh()
{
ClearInternal();
var mask = CurrentTool?.CreatePlacementMask();
if (mask != null)
InternalChild = mask;
}
}
}

View File

@ -2,7 +2,6 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using OpenTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
@ -10,8 +9,9 @@ using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using OpenTK.Graphics;
namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents
namespace osu.Game.Screens.Edit.Setup.Components.LabelledComponents
{
public class LabelledTextBox : CompositeDrawable
{

View File

@ -7,7 +7,6 @@ using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Screens.Compose;
namespace osu.Game.Tests.Visual
{

View File

@ -6,7 +6,6 @@ using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Game.Rulesets;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Screens;
using osu.Game.Tests.Beatmaps;
namespace osu.Game.Tests.Visual

View File

@ -8,17 +8,17 @@ using osu.Framework.Timing;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Screens.Edit.Screens.Compose;
using osu.Game.Screens.Edit.Compose;
namespace osu.Game.Tests.Visual
{
[Cached(Type = typeof(IPlacementHandler))]
public abstract class HitObjectPlacementMaskTestCase : OsuTestCase, IPlacementHandler
public abstract class PlacementBlueprintTestCase : OsuTestCase, IPlacementHandler
{
private readonly Container hitObjectContainer;
private PlacementMask currentMask;
private PlacementBlueprint currentBlueprint;
protected HitObjectPlacementMaskTestCase()
protected PlacementBlueprintTestCase()
{
Beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize = 2;
@ -32,7 +32,7 @@ namespace osu.Game.Tests.Visual
[BackgroundDependencyLoader]
private void load()
{
Add(currentMask = CreateMask());
Add(currentBlueprint = CreateBlueprint());
}
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
@ -51,8 +51,8 @@ namespace osu.Game.Tests.Visual
{
hitObjectContainer.Add(CreateHitObject(hitObject));
Remove(currentMask);
Add(currentMask = CreateMask());
Remove(currentBlueprint);
Add(currentBlueprint = CreateBlueprint());
}
public void Delete(HitObject hitObject)
@ -60,6 +60,6 @@ namespace osu.Game.Tests.Visual
}
protected abstract DrawableHitObject CreateHitObject(HitObject hitObject);
protected abstract PlacementMask CreateMask();
protected abstract PlacementBlueprint CreateBlueprint();
}
}

View File

@ -10,14 +10,14 @@ using osu.Game.Rulesets.Edit;
namespace osu.Game.Tests.Visual
{
public abstract class HitObjectSelectionMaskTestCase : OsuTestCase
public abstract class SelectionBlueprintTestCase : OsuTestCase
{
private SelectionMask mask;
private SelectionBlueprint blueprint;
protected override Container<Drawable> Content => content ?? base.Content;
private readonly Container content;
protected HitObjectSelectionMaskTestCase()
protected SelectionBlueprintTestCase()
{
base.Content.Add(content = new Container
{
@ -29,19 +29,19 @@ namespace osu.Game.Tests.Visual
[BackgroundDependencyLoader]
private void load()
{
base.Content.Add(mask = CreateMask());
mask.SelectionRequested += (_, __) => mask.Select();
base.Content.Add(blueprint = CreateBlueprint());
blueprint.SelectionRequested += (_, __) => blueprint.Select();
AddStep("Select", () => mask.Select());
AddStep("Deselect", () => mask.Deselect());
AddStep("Select", () => blueprint.Select());
AddStep("Deselect", () => blueprint.Deselect());
}
protected override bool OnClick(ClickEvent e)
{
mask.Deselect();
blueprint.Deselect();
return true;
}
protected abstract SelectionMask CreateMask();
protected abstract SelectionBlueprint CreateBlueprint();
}
}