mirror of
https://github.com/ppy/osu.git
synced 2024-11-14 20:38:33 +08:00
Merge branch 'master' into better-rider-ignore
This commit is contained in:
commit
5051263106
@ -5,7 +5,6 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Edit;
|
|
||||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
|
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
|
||||||
using osu.Game.Rulesets.Mania.UI;
|
using osu.Game.Rulesets.Mania.UI;
|
||||||
@ -13,9 +12,9 @@ using osu.Game.Rulesets.UI.Scrolling;
|
|||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
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;
|
public new DrawableHoldNote HitObject => (DrawableHoldNote)base.HitObject;
|
||||||
|
|
||||||
@ -23,13 +22,13 @@ namespace osu.Game.Rulesets.Mania.Edit.Masks
|
|||||||
|
|
||||||
private readonly BodyPiece body;
|
private readonly BodyPiece body;
|
||||||
|
|
||||||
public HoldNoteSelectionMask(DrawableHoldNote hold)
|
public HoldNoteSelectionBlueprint(DrawableHoldNote hold)
|
||||||
: base(hold)
|
: base(hold)
|
||||||
{
|
{
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new HoldNoteNoteSelectionMask(hold.Head),
|
new HoldNoteNoteSelectionBlueprint(hold.Head),
|
||||||
new HoldNoteNoteSelectionMask(hold.Tail),
|
new HoldNoteNoteSelectionBlueprint(hold.Tail),
|
||||||
body = new BodyPiece
|
body = new BodyPiece
|
||||||
{
|
{
|
||||||
AccentColour = Color4.Transparent
|
AccentColour = Color4.Transparent
|
||||||
@ -59,9 +58,9 @@ namespace osu.Game.Rulesets.Mania.Edit.Masks
|
|||||||
Y -= HitObject.Tail.DrawHeight;
|
Y -= HitObject.Tail.DrawHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class HoldNoteNoteSelectionMask : NoteSelectionMask
|
private class HoldNoteNoteSelectionBlueprint : NoteSelectionBlueprint
|
||||||
{
|
{
|
||||||
public HoldNoteNoteSelectionMask(DrawableNote note)
|
public HoldNoteNoteSelectionBlueprint(DrawableNote note)
|
||||||
: base(note)
|
: base(note)
|
||||||
{
|
{
|
||||||
Select();
|
Select();
|
@ -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)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,15 +3,14 @@
|
|||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Edit;
|
|
||||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
|
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)
|
: base(note)
|
||||||
{
|
{
|
||||||
Scale = note.Scale;
|
Scale = note.Scale;
|
@ -11,7 +11,7 @@ using osu.Game.Rulesets.Objects.Drawables;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Rulesets.Mania.Configuration;
|
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.Mania.UI;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
|
|
||||||
@ -38,17 +38,17 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
|
|
||||||
protected override IReadOnlyList<HitObjectCompositionTool> CompositionTools => Array.Empty<HitObjectCompositionTool>();
|
protected override IReadOnlyList<HitObjectCompositionTool> CompositionTools => Array.Empty<HitObjectCompositionTool>();
|
||||||
|
|
||||||
public override SelectionMask CreateMaskFor(DrawableHitObject hitObject)
|
public override SelectionBlueprint CreateBlueprintFor(DrawableHitObject hitObject)
|
||||||
{
|
{
|
||||||
switch (hitObject)
|
switch (hitObject)
|
||||||
{
|
{
|
||||||
case DrawableNote note:
|
case DrawableNote note:
|
||||||
return new NoteSelectionMask(note);
|
return new NoteSelectionBlueprint(note);
|
||||||
case DrawableHoldNote holdNote:
|
case DrawableHoldNote holdNote:
|
||||||
return new HoldNoteSelectionMask(holdNote);
|
return new HoldNoteSelectionBlueprint(holdNote);
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.CreateMaskFor(hitObject);
|
return base.CreateBlueprintFor(hitObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,16 +4,16 @@
|
|||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
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;
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Tests
|
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 DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableHitCircle((HitCircle)hitObject);
|
||||||
protected override PlacementMask CreateMask() => new HitCirclePlacementMask();
|
protected override PlacementBlueprint CreateBlueprint() => new HitCirclePlacementBlueprint();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,7 +4,7 @@
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Rulesets.Edit;
|
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;
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
@ -12,11 +12,11 @@ using OpenTK;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Tests
|
namespace osu.Game.Rulesets.Osu.Tests
|
||||||
{
|
{
|
||||||
public class TestCaseHitCircleSelectionMask : HitObjectSelectionMaskTestCase
|
public class TestCaseHitCircleSelectionBlueprint : SelectionBlueprintTestCase
|
||||||
{
|
{
|
||||||
private readonly DrawableHitCircle drawableObject;
|
private readonly DrawableHitCircle drawableObject;
|
||||||
|
|
||||||
public TestCaseHitCircleSelectionMask()
|
public TestCaseHitCircleSelectionBlueprint()
|
||||||
{
|
{
|
||||||
var hitCircle = new HitCircle { Position = new Vector2(256, 192) };
|
var hitCircle = new HitCircle { Position = new Vector2(256, 192) };
|
||||||
hitCircle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 2 });
|
hitCircle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 2 });
|
||||||
@ -24,6 +24,6 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
Add(drawableObject = new DrawableHitCircle(hitCircle));
|
Add(drawableObject = new DrawableHitCircle(hitCircle));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override SelectionMask CreateMask() => new HitCircleSelectionMask(drawableObject);
|
protected override SelectionBlueprint CreateBlueprint() => new HitCircleSelectionBlueprint(drawableObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,16 +4,16 @@
|
|||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
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;
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Tests
|
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 DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableSlider((Slider)hitObject);
|
||||||
protected override PlacementMask CreateMask() => new SliderPlacementMask();
|
protected override PlacementBlueprint CreateBlueprint() => new SliderPlacementBlueprint();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -7,8 +7,8 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks;
|
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders;
|
||||||
using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components;
|
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
@ -16,12 +16,12 @@ using OpenTK;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Tests
|
namespace osu.Game.Rulesets.Osu.Tests
|
||||||
{
|
{
|
||||||
public class TestCaseSliderSelectionMask : HitObjectSelectionMaskTestCase
|
public class TestCaseSliderSelectionBlueprint : SelectionBlueprintTestCase
|
||||||
{
|
{
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
{
|
{
|
||||||
typeof(SliderSelectionMask),
|
typeof(SliderSelectionBlueprint),
|
||||||
typeof(SliderCircleSelectionMask),
|
typeof(SliderCircleSelectionBlueprint),
|
||||||
typeof(SliderBodyPiece),
|
typeof(SliderBodyPiece),
|
||||||
typeof(SliderCircle),
|
typeof(SliderCircle),
|
||||||
typeof(PathControlPointVisualiser),
|
typeof(PathControlPointVisualiser),
|
||||||
@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
|
|
||||||
private readonly DrawableSlider drawableObject;
|
private readonly DrawableSlider drawableObject;
|
||||||
|
|
||||||
public TestCaseSliderSelectionMask()
|
public TestCaseSliderSelectionBlueprint()
|
||||||
{
|
{
|
||||||
var slider = new Slider
|
var slider = new Slider
|
||||||
{
|
{
|
||||||
@ -50,6 +50,6 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
Add(drawableObject = new DrawableSlider(slider));
|
Add(drawableObject = new DrawableSlider(slider));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override SelectionMask CreateMask() => new SliderSelectionMask(drawableObject);
|
protected override SelectionBlueprint CreateBlueprint() => new SliderSelectionBlueprint(drawableObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,17 +4,17 @@
|
|||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
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;
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Tests
|
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 DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableSpinner((Spinner)hitObject);
|
||||||
|
|
||||||
protected override PlacementMask CreateMask() => new SpinnerPlacementMask();
|
protected override PlacementBlueprint CreateBlueprint() => new SpinnerPlacementBlueprint();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,8 +8,8 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks;
|
using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners;
|
||||||
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.Objects;
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
@ -17,17 +17,17 @@ using OpenTK;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Tests
|
namespace osu.Game.Rulesets.Osu.Tests
|
||||||
{
|
{
|
||||||
public class TestCaseSpinnerSelectionMask : HitObjectSelectionMaskTestCase
|
public class TestCaseSpinnerSelectionBlueprint : SelectionBlueprintTestCase
|
||||||
{
|
{
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
{
|
{
|
||||||
typeof(SpinnerSelectionMask),
|
typeof(SpinnerSelectionBlueprint),
|
||||||
typeof(SpinnerPiece)
|
typeof(SpinnerPiece)
|
||||||
};
|
};
|
||||||
|
|
||||||
private readonly DrawableSpinner drawableSpinner;
|
private readonly DrawableSpinner drawableSpinner;
|
||||||
|
|
||||||
public TestCaseSpinnerSelectionMask()
|
public TestCaseSpinnerSelectionBlueprint()
|
||||||
{
|
{
|
||||||
var spinner = new Spinner
|
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) };
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,7 +9,7 @@ using osu.Game.Rulesets.Osu.Objects;
|
|||||||
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components
|
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components
|
||||||
{
|
{
|
||||||
public class HitCirclePiece : CompositeDrawable
|
public class HitCirclePiece : CompositeDrawable
|
||||||
{
|
{
|
@ -3,16 +3,16 @@
|
|||||||
|
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Rulesets.Edit;
|
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;
|
||||||
|
|
||||||
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 new HitCircle HitObject => (HitCircle)base.HitObject;
|
||||||
|
|
||||||
public HitCirclePlacementMask()
|
public HitCirclePlacementBlueprint()
|
||||||
: base(new HitCircle())
|
: base(new HitCircle())
|
||||||
{
|
{
|
||||||
InternalChild = new HitCirclePiece(HitObject);
|
InternalChild = new HitCirclePiece(HitObject);
|
@ -1,16 +1,15 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
|
||||||
using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components;
|
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
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)
|
: base(hitCircle)
|
||||||
{
|
{
|
||||||
InternalChild = new HitCirclePiece((HitCircle)hitCircle.HitObject);
|
InternalChild = new HitCirclePiece((HitCircle)hitCircle.HitObject);
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -12,7 +12,7 @@ using osu.Game.Graphics;
|
|||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components
|
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||||
{
|
{
|
||||||
public class PathControlPointPiece : CompositeDrawable
|
public class PathControlPointPiece : CompositeDrawable
|
||||||
{
|
{
|
@ -5,7 +5,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
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
|
public class PathControlPointVisualiser : CompositeDrawable
|
||||||
{
|
{
|
@ -10,7 +10,7 @@ using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
|||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
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
|
public class SliderBodyPiece : CompositeDrawable
|
||||||
{
|
{
|
@ -1,10 +1,10 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// 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;
|
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
|
public class SliderCirclePiece : HitCirclePiece
|
||||||
{
|
{
|
@ -1,18 +1,22 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components;
|
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
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)
|
: base(hitObject)
|
||||||
{
|
{
|
||||||
|
this.slider = slider;
|
||||||
|
|
||||||
InternalChild = new SliderCirclePiece(slider, position);
|
InternalChild = new SliderCirclePiece(slider, position);
|
||||||
|
|
||||||
Select();
|
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.
|
// 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 bool HandlePositionalInput => false;
|
||||||
|
|
||||||
|
public override void AdjustPosition(DragEvent dragEvent) => slider.Position += dragEvent.Delta;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,13 +12,13 @@ using osu.Framework.MathUtils;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
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;
|
||||||
using OpenTK.Input;
|
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;
|
public new Objects.Slider HitObject => (Objects.Slider)base.HitObject;
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks
|
|||||||
|
|
||||||
private PlacementState state;
|
private PlacementState state;
|
||||||
|
|
||||||
public SliderPlacementMask()
|
public SliderPlacementBlueprint()
|
||||||
: base(new Objects.Slider())
|
: base(new Objects.Slider())
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// 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
|
public enum SliderPosition
|
||||||
{
|
{
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -10,7 +10,7 @@ using osu.Game.Rulesets.Osu.Objects;
|
|||||||
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks.Components
|
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components
|
||||||
{
|
{
|
||||||
public class SpinnerPiece : CompositeDrawable
|
public class SpinnerPiece : CompositeDrawable
|
||||||
{
|
{
|
@ -4,13 +4,13 @@
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Rulesets.Edit;
|
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.Objects;
|
||||||
using osu.Game.Rulesets.Osu.UI;
|
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;
|
public new Spinner HitObject => (Spinner)base.HitObject;
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SpinnerMasks
|
|||||||
|
|
||||||
private bool isPlacingEnd;
|
private bool isPlacingEnd;
|
||||||
|
|
||||||
public SpinnerPlacementMask()
|
public SpinnerPlacementBlueprint()
|
||||||
: base(new Spinner { Position = OsuPlayfield.BASE_SIZE / 2 })
|
: base(new Spinner { Position = OsuPlayfield.BASE_SIZE / 2 })
|
||||||
{
|
{
|
||||||
InternalChild = piece = new SpinnerPiece(HitObject) { Alpha = 0.5f };
|
InternalChild = piece = new SpinnerPiece(HitObject) { Alpha = 0.5f };
|
@ -1,24 +1,29 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Framework.Input.Events;
|
||||||
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.Objects;
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
using OpenTK;
|
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;
|
private readonly SpinnerPiece piece;
|
||||||
|
|
||||||
public SpinnerSelectionMask(DrawableSpinner spinner)
|
public SpinnerSelectionBlueprint(DrawableSpinner spinner)
|
||||||
: base(spinner)
|
: base(spinner)
|
||||||
{
|
{
|
||||||
InternalChild = piece = new SpinnerPiece((Spinner)spinner.HitObject);
|
InternalChild = piece = new SpinnerPiece((Spinner)spinner.HitObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => piece.ReceivePositionalInputAt(screenSpacePos);
|
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => piece.ReceivePositionalInputAt(screenSpacePos);
|
||||||
|
|
||||||
|
public override void AdjustPosition(DragEvent dragEvent)
|
||||||
|
{
|
||||||
|
// Spinners don't support position adjustments
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Edit.Tools;
|
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;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Edit
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -8,9 +8,9 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Edit.Tools;
|
using osu.Game.Rulesets.Edit.Tools;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
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.Edit.Masks.SliderMasks;
|
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders;
|
||||||
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;
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Osu.UI;
|
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 };
|
protected override Container CreateLayerContainer() => new PlayfieldAdjustmentContainer { RelativeSizeAxes = Axes.Both };
|
||||||
|
|
||||||
public override SelectionMask CreateMaskFor(DrawableHitObject hitObject)
|
public override SelectionBlueprint CreateBlueprintFor(DrawableHitObject hitObject)
|
||||||
{
|
{
|
||||||
switch (hitObject)
|
switch (hitObject)
|
||||||
{
|
{
|
||||||
case DrawableHitCircle circle:
|
case DrawableHitCircle circle:
|
||||||
return new HitCircleSelectionMask(circle);
|
return new HitCircleSelectionBlueprint(circle);
|
||||||
case DrawableSlider slider:
|
case DrawableSlider slider:
|
||||||
return new SliderSelectionMask(slider);
|
return new SliderSelectionBlueprint(slider);
|
||||||
case DrawableSpinner spinner:
|
case DrawableSpinner spinner:
|
||||||
return new SpinnerSelectionMask(spinner);
|
return new SpinnerSelectionBlueprint(spinner);
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.CreateMaskFor(hitObject);
|
return base.CreateBlueprintFor(hitObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Edit.Tools;
|
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;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Edit
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Edit.Tools;
|
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;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Edit
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,10 @@ using osu.Game.Rulesets.Objects;
|
|||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Rulesets.Edit.Types;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Objects
|
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;
|
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;
|
Scale = (1.0f - 0.7f * (difficulty.CircleSize - 5) / 5) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void OffsetPosition(Vector2 offset) => Position += offset;
|
|
||||||
|
|
||||||
protected override HitWindows CreateHitWindows() => new OsuHitWindows();
|
protected override HitWindows CreateHitWindows() => new OsuHitWindows();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,7 +166,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
|
|
||||||
private void createSliderEnds()
|
private void createSliderEnds()
|
||||||
{
|
{
|
||||||
HeadCircle = new SliderCircle(this)
|
HeadCircle = new SliderCircle
|
||||||
{
|
{
|
||||||
StartTime = StartTime,
|
StartTime = StartTime,
|
||||||
Position = Position,
|
Position = Position,
|
||||||
@ -176,7 +176,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
ComboIndex = ComboIndex,
|
ComboIndex = ComboIndex,
|
||||||
};
|
};
|
||||||
|
|
||||||
TailCircle = new SliderTailCircle(this)
|
TailCircle = new SliderTailCircle
|
||||||
{
|
{
|
||||||
StartTime = EndTime,
|
StartTime = EndTime,
|
||||||
Position = EndPosition,
|
Position = EndPosition,
|
||||||
|
@ -1,19 +1,9 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using OpenTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Objects
|
namespace osu.Game.Rulesets.Osu.Objects
|
||||||
{
|
{
|
||||||
public class SliderCircle : HitCircle
|
public class SliderCircle : HitCircle
|
||||||
{
|
{
|
||||||
private readonly Slider slider;
|
|
||||||
|
|
||||||
public SliderCircle(Slider slider)
|
|
||||||
{
|
|
||||||
this.slider = slider;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OffsetPosition(Vector2 offset) => slider.OffsetPosition(offset);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,11 +8,6 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
{
|
{
|
||||||
public class SliderTailCircle : SliderCircle
|
public class SliderTailCircle : SliderCircle
|
||||||
{
|
{
|
||||||
public SliderTailCircle(Slider slider)
|
|
||||||
: base(slider)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Judgement CreateJudgement() => new OsuSliderTailJudgement();
|
public override Judgement CreateJudgement() => new OsuSliderTailJudgement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ using osu.Game.Rulesets.Objects.Types;
|
|||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Osu.Judgements;
|
using osu.Game.Rulesets.Osu.Judgements;
|
||||||
using OpenTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Objects
|
namespace osu.Game.Rulesets.Osu.Objects
|
||||||
{
|
{
|
||||||
@ -32,10 +31,5 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override Judgement CreateJudgement() => new OsuJudgement();
|
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.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,8 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
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;
|
using OpenTK;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual
|
namespace osu.Game.Tests.Visual
|
||||||
|
@ -6,7 +6,7 @@ using System.Collections.Generic;
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Screens.Edit.Screens.Compose;
|
using osu.Game.Screens.Edit.Compose;
|
||||||
using osu.Game.Tests.Beatmaps;
|
using osu.Game.Tests.Beatmaps;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual
|
namespace osu.Game.Tests.Visual
|
||||||
@ -14,13 +14,13 @@ namespace osu.Game.Tests.Visual
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestCaseEditorCompose : EditorClockTestCase
|
public class TestCaseEditorCompose : EditorClockTestCase
|
||||||
{
|
{
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(Compose) };
|
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(ComposeScreen) };
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
Beatmap.Value = new TestWorkingBeatmap(new OsuRuleset().RulesetInfo);
|
Beatmap.Value = new TestWorkingBeatmap(new OsuRuleset().RulesetInfo);
|
||||||
Child = new Compose();
|
Child = new ComposeScreen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Screens.Edit.Screens.Compose.RadioButtons;
|
using osu.Game.Screens.Edit.Components.RadioButtons;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual
|
namespace osu.Game.Tests.Visual
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,7 @@ using osu.Framework.Graphics.Shapes;
|
|||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Screens.Edit.Screens.Compose.Timeline;
|
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual
|
namespace osu.Game.Tests.Visual
|
||||||
|
@ -8,7 +8,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Game.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
|
namespace osu.Game.Tests.Visual
|
||||||
{
|
{
|
||||||
|
@ -13,11 +13,11 @@ using osu.Game.Rulesets.Edit;
|
|||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Rulesets.Osu.Edit;
|
using osu.Game.Rulesets.Osu.Edit;
|
||||||
using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks;
|
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles;
|
||||||
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;
|
||||||
using osu.Game.Screens.Edit.Screens.Compose;
|
using osu.Game.Screens.Edit.Compose;
|
||||||
using osu.Game.Screens.Edit.Screens.Compose.Layers;
|
using osu.Game.Screens.Edit.Compose.Components;
|
||||||
using osu.Game.Tests.Beatmaps;
|
using osu.Game.Tests.Beatmaps;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual
|
namespace osu.Game.Tests.Visual
|
||||||
@ -28,15 +28,15 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
{
|
{
|
||||||
typeof(MaskSelection),
|
typeof(SelectionBox),
|
||||||
typeof(DragLayer),
|
typeof(DragBox),
|
||||||
typeof(HitObjectComposer),
|
typeof(HitObjectComposer),
|
||||||
typeof(OsuHitObjectComposer),
|
typeof(OsuHitObjectComposer),
|
||||||
typeof(HitObjectMaskLayer),
|
typeof(BlueprintContainer),
|
||||||
typeof(NotNullAttribute),
|
typeof(NotNullAttribute),
|
||||||
typeof(HitCirclePiece),
|
typeof(HitCirclePiece),
|
||||||
typeof(HitCircleSelectionMask),
|
typeof(HitCircleSelectionBlueprint),
|
||||||
typeof(HitCirclePlacementMask),
|
typeof(HitCirclePlacementBlueprint),
|
||||||
};
|
};
|
||||||
|
|
||||||
private HitObjectComposer composer;
|
private HitObjectComposer composer;
|
||||||
|
@ -5,9 +5,9 @@ using NUnit.Framework;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using osu.Game.Screens.Edit.Setup.Components.LabelledComponents;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual
|
namespace osu.Game.Tests.Visual
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,7 @@ using osu.Framework.Graphics.Shapes;
|
|||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Cursor;
|
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;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
|
@ -16,8 +16,8 @@ using osu.Game.Rulesets.Edit.Tools;
|
|||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Screens.Edit.Screens.Compose.Layers;
|
using osu.Game.Screens.Edit.Components.RadioButtons;
|
||||||
using osu.Game.Screens.Edit.Screens.Compose.RadioButtons;
|
using osu.Game.Screens.Edit.Compose.Components;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Edit
|
namespace osu.Game.Rulesets.Edit
|
||||||
{
|
{
|
||||||
@ -35,8 +35,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
|
|
||||||
private EditRulesetContainer rulesetContainer;
|
private EditRulesetContainer rulesetContainer;
|
||||||
|
|
||||||
private HitObjectMaskLayer maskLayer;
|
private BlueprintContainer blueprintContainer;
|
||||||
private PlacementContainer placementContainer;
|
|
||||||
|
|
||||||
internal HitObjectComposer(Ruleset ruleset)
|
internal HitObjectComposer(Ruleset ruleset)
|
||||||
{
|
{
|
||||||
@ -62,14 +61,10 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
}
|
}
|
||||||
|
|
||||||
var layerBelowRuleset = CreateLayerContainer();
|
var layerBelowRuleset = CreateLayerContainer();
|
||||||
layerBelowRuleset.Child = new BorderLayer { RelativeSizeAxes = Axes.Both };
|
layerBelowRuleset.Child = new EditorPlayfieldBorder { RelativeSizeAxes = Axes.Both };
|
||||||
|
|
||||||
var layerAboveRuleset = CreateLayerContainer();
|
var layerAboveRuleset = CreateLayerContainer();
|
||||||
layerAboveRuleset.Children = new Drawable[]
|
layerAboveRuleset.Child = blueprintContainer = new BlueprintContainer();
|
||||||
{
|
|
||||||
maskLayer = new HitObjectMaskLayer(),
|
|
||||||
placementContainer = new PlacementContainer(),
|
|
||||||
};
|
|
||||||
|
|
||||||
layerContainers.Add(layerBelowRuleset);
|
layerContainers.Add(layerBelowRuleset);
|
||||||
layerContainers.Add(layerAboveRuleset);
|
layerContainers.Add(layerAboveRuleset);
|
||||||
@ -112,8 +107,8 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
};
|
};
|
||||||
|
|
||||||
toolboxCollection.Items =
|
toolboxCollection.Items =
|
||||||
CompositionTools.Select(t => new RadioButton(t.Name, () => placementContainer.CurrentTool = t))
|
CompositionTools.Select(t => new RadioButton(t.Name, () => blueprintContainer.CurrentTool = t))
|
||||||
.Prepend(new RadioButton("Select", () => placementContainer.CurrentTool = null))
|
.Prepend(new RadioButton("Select", () => blueprintContainer.CurrentTool = null))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
toolboxCollection.Items[0].Select();
|
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.
|
/// Adds a <see cref="HitObject"/> to the <see cref="Beatmaps.Beatmap"/> and visualises it.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="hitObject">The <see cref="HitObject"/> to add.</param>
|
/// <param name="hitObject">The <see cref="HitObject"/> to add.</param>
|
||||||
public void Add(HitObject hitObject)
|
public void Add(HitObject hitObject) => blueprintContainer.AddBlueprintFor(rulesetContainer.Add(hitObject));
|
||||||
{
|
|
||||||
maskLayer.AddMaskFor(rulesetContainer.Add(hitObject));
|
|
||||||
placementContainer.Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Remove(HitObject hitObject) => maskLayer.RemoveMaskFor(rulesetContainer.Remove(hitObject));
|
public void Remove(HitObject hitObject) => blueprintContainer.RemoveBlueprintFor(rulesetContainer.Remove(hitObject));
|
||||||
|
|
||||||
internal abstract EditRulesetContainer CreateRulesetContainer();
|
internal abstract EditRulesetContainer CreateRulesetContainer();
|
||||||
|
|
||||||
protected abstract IReadOnlyList<HitObjectCompositionTool> CompositionTools { get; }
|
protected abstract IReadOnlyList<HitObjectCompositionTool> CompositionTools { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a <see cref="SelectionMask"/> for a specific <see cref="DrawableHitObject"/>.
|
/// Creates a <see cref="SelectionBlueprint"/> for a specific <see cref="DrawableHitObject"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="hitObject">The <see cref="DrawableHitObject"/> to create the overlay for.</param>
|
/// <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>
|
/// <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.
|
/// and handles hitobject pattern adjustments.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual MaskSelection CreateMaskSelection() => new MaskSelection();
|
public virtual SelectionBox CreateSelectionBox() => new SelectionBox();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a <see cref="ScalableContainer"/> which provides a layer above or below the <see cref="Playfield"/>.
|
/// Creates a <see cref="ScalableContainer"/> which provides a layer above or below the <see cref="Playfield"/>.
|
||||||
|
@ -10,15 +10,15 @@ using osu.Framework.Input.Events;
|
|||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Screens.Edit.Screens.Compose;
|
using osu.Game.Screens.Edit.Compose;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Edit
|
namespace osu.Game.Rulesets.Edit
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
public abstract class PlacementMask : CompositeDrawable, IRequireHighFrequencyMousePosition
|
public abstract class PlacementBlueprint : CompositeDrawable, IRequireHighFrequencyMousePosition
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="HitObject"/> that is being placed.
|
/// The <see cref="HitObject"/> that is being placed.
|
||||||
@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private IPlacementHandler placementHandler { get; set; }
|
private IPlacementHandler placementHandler { get; set; }
|
||||||
|
|
||||||
protected PlacementMask(HitObject hitObject)
|
protected PlacementBlueprint(HitObject hitObject)
|
||||||
{
|
{
|
||||||
HitObject = hitObject;
|
HitObject = hitObject;
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Signals that the placement of <see cref="HitObject"/> has finished.
|
/// 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>
|
/// </summary>
|
||||||
protected void EndPlacement()
|
protected void EndPlacement()
|
||||||
{
|
{
|
@ -15,33 +15,33 @@ using OpenTK;
|
|||||||
namespace osu.Game.Rulesets.Edit
|
namespace osu.Game.Rulesets.Edit
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A mask placed above a <see cref="DrawableHitObject"/> adding editing functionality.
|
/// A blueprint placed above a <see cref="DrawableHitObject"/> adding editing functionality.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SelectionMask : CompositeDrawable, IStateful<SelectionState>
|
public abstract class SelectionBlueprint : CompositeDrawable, IStateful<SelectionState>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when this <see cref="SelectionMask"/> has been selected.
|
/// Invoked when this <see cref="SelectionBlueprint"/> has been selected.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<SelectionMask> Selected;
|
public event Action<SelectionBlueprint> Selected;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when this <see cref="SelectionMask"/> has been deselected.
|
/// Invoked when this <see cref="SelectionBlueprint"/> has been deselected.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<SelectionMask> Deselected;
|
public event Action<SelectionBlueprint> Deselected;
|
||||||
|
|
||||||
/// <summary>
|
/// <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.
|
/// Will fire even if already selected. Does not actually perform selection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<SelectionMask, InputState> SelectionRequested;
|
public event Action<SelectionBlueprint, InputState> SelectionRequested;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when this <see cref="SelectionMask"/> has requested drag.
|
/// Invoked when this <see cref="SelectionBlueprint"/> has requested drag.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<SelectionMask, Vector2, InputState> DragRequested;
|
public event Action<DragEvent> DragRequested;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="DrawableHitObject"/> which this <see cref="SelectionMask"/> applies to.
|
/// The <see cref="DrawableHitObject"/> which this <see cref="SelectionBlueprint"/> applies to.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly DrawableHitObject HitObject;
|
public readonly DrawableHitObject HitObject;
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
public override bool HandlePositionalInput => ShouldBeAlive;
|
public override bool HandlePositionalInput => ShouldBeAlive;
|
||||||
public override bool RemoveWhenNotAlive => false;
|
public override bool RemoveWhenNotAlive => false;
|
||||||
|
|
||||||
public SelectionMask(DrawableHitObject hitObject)
|
protected SelectionBlueprint(DrawableHitObject hitObject)
|
||||||
{
|
{
|
||||||
HitObject = hitObject;
|
HitObject = hitObject;
|
||||||
|
|
||||||
@ -86,12 +86,12 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Selects this <see cref="SelectionMask"/>, causing it to become visible.
|
/// Selects this <see cref="SelectionBlueprint"/>, causing it to become visible.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Select() => State = SelectionState.Selected;
|
public void Select() => State = SelectionState.Selected;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deselects this <see cref="SelectionMask"/>, causing it to become invisible.
|
/// Deselects this <see cref="SelectionBlueprint"/>, causing it to become invisible.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Deselect() => State = SelectionState.NotSelected;
|
public void Deselect() => State = SelectionState.NotSelected;
|
||||||
|
|
||||||
@ -130,17 +130,19 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
|
|
||||||
protected override bool OnDrag(DragEvent e)
|
protected override bool OnDrag(DragEvent e)
|
||||||
{
|
{
|
||||||
DragRequested?.Invoke(this, e.Delta, e.CurrentState);
|
DragRequested?.Invoke(e);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract void AdjustPosition(DragEvent dragEvent);
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
public virtual Vector2 SelectionPoint => HitObject.ScreenSpaceDrawQuad.Centre;
|
public virtual Vector2 SelectionPoint => HitObject.ScreenSpaceDrawQuad.Centre;
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
public virtual Quad SelectionQuad => HitObject.ScreenSpaceDrawQuad;
|
public virtual Quad SelectionQuad => HitObject.ScreenSpaceDrawQuad;
|
||||||
}
|
}
|
@ -12,6 +12,6 @@ namespace osu.Game.Rulesets.Edit.Tools
|
|||||||
Name = name;
|
Name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract PlacementMask CreatePlacementMask();
|
public abstract PlacementBlueprint CreatePlacementBlueprint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -7,7 +7,6 @@ using System.Linq;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Extensions.TypeExtensions;
|
using osu.Framework.Extensions.TypeExtensions;
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
@ -167,13 +166,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool UpdateSubTreeMasking(Drawable source, RectangleF maskingBounds)
|
protected override bool ComputeIsMaskedAway(RectangleF maskingBounds) => AllJudged && base.ComputeIsMaskedAway(maskingBounds);
|
||||||
{
|
|
||||||
if (!AllJudged)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return base.UpdateSubTreeMasking(source, maskingBounds);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void UpdateAfterChildren()
|
protected override void UpdateAfterChildren()
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,7 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Screens.Compose
|
namespace osu.Game.Screens.Edit
|
||||||
{
|
{
|
||||||
public class BindableBeatDivisor : BindableNumber<int>
|
public class BindableBeatDivisor : BindableNumber<int>
|
||||||
{
|
{
|
@ -2,19 +2,18 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
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
|
public class EditorMenuBar : OsuMenu
|
||||||
{
|
{
|
@ -4,7 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Menus
|
namespace osu.Game.Screens.Edit.Components.Menus
|
||||||
{
|
{
|
||||||
public class EditorMenuItem : OsuMenuItem
|
public class EditorMenuItem : OsuMenuItem
|
||||||
{
|
{
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// 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
|
public class EditorMenuItemSpacer : EditorMenuItem
|
||||||
{
|
{
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using OpenTK.Graphics;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -9,10 +8,10 @@ using osu.Framework.Graphics.Shapes;
|
|||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Screens.Edit.Screens;
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Menus
|
namespace osu.Game.Screens.Edit.Components.Menus
|
||||||
{
|
{
|
||||||
public class ScreenSelectionTabControl : OsuTabControl<EditorScreenMode>
|
public class ScreenSelectionTabControl : OsuTabControl<EditorScreenMode>
|
||||||
{
|
{
|
@ -2,8 +2,6 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using OpenTK;
|
|
||||||
using OpenTK.Graphics;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -14,8 +12,10 @@ using osu.Framework.Input.Events;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
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
|
public class DrawableRadioButton : TriangleButton
|
||||||
{
|
{
|
@ -4,7 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Screens.Compose.RadioButtons
|
namespace osu.Game.Screens.Edit.Components.RadioButtons
|
||||||
{
|
{
|
||||||
public class RadioButton
|
public class RadioButton
|
||||||
{
|
{
|
@ -2,12 +2,12 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenTK;
|
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
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
|
public class RadioButtonCollection : CompositeDrawable
|
||||||
{
|
{
|
@ -19,7 +19,7 @@ using OpenTK;
|
|||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Screens.Compose
|
namespace osu.Game.Screens.Edit.Compose.Components
|
||||||
{
|
{
|
||||||
public class BeatDivisorControl : CompositeDrawable
|
public class BeatDivisorControl : CompositeDrawable
|
||||||
{
|
{
|
191
osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs
Normal file
191
osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -8,15 +8,14 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Rulesets.Edit;
|
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
namespace osu.Game.Screens.Edit.Compose.Components
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
public class DragLayer : CompositeDrawable
|
public class DragBox : CompositeDrawable
|
||||||
{
|
{
|
||||||
private readonly Action<RectangleF> performSelection;
|
private readonly Action<RectangleF> performSelection;
|
||||||
|
|
||||||
@ -28,10 +27,10 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
private Drawable box;
|
private Drawable box;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new <see cref="DragLayer"/>.
|
/// Creates a new <see cref="DragBox"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="maskContainer">The selectable <see cref="SelectionMask"/>s.</param>
|
/// <param name="performSelection">A delegate that performs drag selection.</param>
|
||||||
public DragLayer(Action<RectangleF> performSelection)
|
public DragBox(Action<RectangleF> performSelection)
|
||||||
{
|
{
|
||||||
this.performSelection = performSelection;
|
this.performSelection = performSelection;
|
||||||
|
|
||||||
@ -47,7 +46,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
{
|
{
|
||||||
Masking = true,
|
Masking = true,
|
||||||
BorderColour = Color4.White,
|
BorderColour = Color4.White,
|
||||||
BorderThickness = MaskSelection.BORDER_RADIUS,
|
BorderThickness = SelectionBox.BORDER_RADIUS,
|
||||||
Child = new Box
|
Child = new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
@ -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
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -12,29 +12,28 @@ using osu.Framework.Input.Events;
|
|||||||
using osu.Framework.Input.States;
|
using osu.Framework.Input.States;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Edit.Types;
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
namespace osu.Game.Screens.Edit.Compose.Components
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
public class MaskSelection : CompositeDrawable
|
public class SelectionBox : CompositeDrawable
|
||||||
{
|
{
|
||||||
public const float BORDER_RADIUS = 2;
|
public const float BORDER_RADIUS = 2;
|
||||||
|
|
||||||
private readonly List<SelectionMask> selectedMasks;
|
private readonly List<SelectionBlueprint> selectedBlueprints;
|
||||||
|
|
||||||
private Drawable outline;
|
private Drawable outline;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IPlacementHandler placementHandler { get; set; }
|
private IPlacementHandler placementHandler { get; set; }
|
||||||
|
|
||||||
public MaskSelection()
|
public SelectionBox()
|
||||||
{
|
{
|
||||||
selectedMasks = new List<SelectionMask>();
|
selectedBlueprints = new List<SelectionBlueprint>();
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
AlwaysPresent = true;
|
AlwaysPresent = true;
|
||||||
@ -60,19 +59,12 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
|
|
||||||
#region User Input Handling
|
#region User Input Handling
|
||||||
|
|
||||||
public void HandleDrag(SelectionMask m, Vector2 delta, InputState state)
|
public void HandleDrag(DragEvent dragEvent)
|
||||||
{
|
{
|
||||||
// Todo: Various forms of snapping
|
// Todo: Various forms of snapping
|
||||||
|
|
||||||
foreach (var mask in selectedMasks)
|
foreach (var blueprint in selectedBlueprints)
|
||||||
{
|
blueprint.AdjustPosition(dragEvent);
|
||||||
switch (mask.HitObject.HitObject)
|
|
||||||
{
|
|
||||||
case IHasEditablePosition editablePosition:
|
|
||||||
editablePosition.OffsetPosition(delta);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnKeyDown(KeyDownEvent e)
|
protected override bool OnKeyDown(KeyDownEvent e)
|
||||||
@ -83,7 +75,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
switch (e.Key)
|
switch (e.Key)
|
||||||
{
|
{
|
||||||
case Key.Delete:
|
case Key.Delete:
|
||||||
foreach (var h in selectedMasks.ToList())
|
foreach (var h in selectedBlueprints.ToList())
|
||||||
placementHandler.Delete(h.HitObject.HitObject);
|
placementHandler.Delete(h.HitObject.HitObject);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -96,49 +88,49 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
#region Selection Handling
|
#region Selection Handling
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Bind an action to deselect all selected masks.
|
/// Bind an action to deselect all selected blueprints.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Action DeselectAll { private get; set; }
|
public Action DeselectAll { private get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handle a mask becoming selected.
|
/// Handle a blueprint becoming selected.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mask">The mask.</param>
|
/// <param name="blueprint">The blueprint.</param>
|
||||||
public void HandleSelected(SelectionMask mask) => selectedMasks.Add(mask);
|
public void HandleSelected(SelectionBlueprint blueprint) => selectedBlueprints.Add(blueprint);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handle a mask becoming deselected.
|
/// Handle a blueprint becoming deselected.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mask">The mask.</param>
|
/// <param name="blueprint">The blueprint.</param>
|
||||||
public void HandleDeselected(SelectionMask mask)
|
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
|
// We don't want to update visibility if > 0, since we may be deselecting blueprints during drag-selection
|
||||||
if (selectedMasks.Count == 0)
|
if (selectedBlueprints.Count == 0)
|
||||||
UpdateVisibility();
|
UpdateVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handle a mask requesting selection.
|
/// Handle a blueprint requesting selection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mask">The mask.</param>
|
/// <param name="blueprint">The blueprint.</param>
|
||||||
public void HandleSelectionRequested(SelectionMask mask, InputState state)
|
public void HandleSelectionRequested(SelectionBlueprint blueprint, InputState state)
|
||||||
{
|
{
|
||||||
if (state.Keyboard.ControlPressed)
|
if (state.Keyboard.ControlPressed)
|
||||||
{
|
{
|
||||||
if (mask.IsSelected)
|
if (blueprint.IsSelected)
|
||||||
mask.Deselect();
|
blueprint.Deselect();
|
||||||
else
|
else
|
||||||
mask.Select();
|
blueprint.Select();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mask.IsSelected)
|
if (blueprint.IsSelected)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DeselectAll?.Invoke();
|
DeselectAll?.Invoke();
|
||||||
mask.Select();
|
blueprint.Select();
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateVisibility();
|
UpdateVisibility();
|
||||||
@ -147,11 +139,11 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates whether this <see cref="MaskSelection"/> is visible.
|
/// Updates whether this <see cref="SelectionBox"/> is visible.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal void UpdateVisibility()
|
internal void UpdateVisibility()
|
||||||
{
|
{
|
||||||
if (selectedMasks.Count > 0)
|
if (selectedBlueprints.Count > 0)
|
||||||
Show();
|
Show();
|
||||||
else
|
else
|
||||||
Hide();
|
Hide();
|
||||||
@ -161,7 +153,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
if (selectedMasks.Count == 0)
|
if (selectedBlueprints.Count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Move the rectangle to cover the hitobjects
|
// Move the rectangle to cover the hitobjects
|
||||||
@ -170,10 +162,10 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
|||||||
|
|
||||||
bool hasSelection = false;
|
bool hasSelection = false;
|
||||||
|
|
||||||
foreach (var mask in selectedMasks)
|
foreach (var blueprint in selectedBlueprints)
|
||||||
{
|
{
|
||||||
topLeft = Vector2.ComponentMin(topLeft, ToLocalSpace(mask.SelectionQuad.TopLeft));
|
topLeft = Vector2.ComponentMin(topLeft, ToLocalSpace(blueprint.SelectionQuad.TopLeft));
|
||||||
bottomRight = Vector2.ComponentMax(bottomRight, ToLocalSpace(mask.SelectionQuad.BottomRight));
|
bottomRight = Vector2.ComponentMax(bottomRight, ToLocalSpace(blueprint.SelectionQuad.BottomRight));
|
||||||
}
|
}
|
||||||
|
|
||||||
topLeft -= new Vector2(5);
|
topLeft -= new Vector2(5);
|
@ -8,7 +8,7 @@ using osu.Framework.Graphics.Shapes;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
|
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||||
{
|
{
|
||||||
public class CentreMarker : CompositeDrawable
|
public class CentreMarker : CompositeDrawable
|
||||||
{
|
{
|
@ -12,7 +12,7 @@ using osu.Framework.Timing;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
|
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||||
{
|
{
|
||||||
public class Timeline : ZoomableScrollContainer
|
public class Timeline : ZoomableScrollContainer
|
||||||
{
|
{
|
@ -1,14 +1,14 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using OpenTK;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.UserInterface;
|
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
|
public class TimelineArea : CompositeDrawable
|
||||||
{
|
{
|
@ -2,15 +2,15 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using OpenTK;
|
|
||||||
using OpenTK.Graphics;
|
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.UserInterface;
|
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
|
public class TimelineButton : CompositeDrawable
|
||||||
{
|
{
|
@ -9,7 +9,7 @@ using osu.Framework.Input.Events;
|
|||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
|
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||||
{
|
{
|
||||||
public class ZoomableScrollContainer : ScrollContainer
|
public class ZoomableScrollContainer : ScrollContainer
|
||||||
{
|
{
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using OpenTK.Graphics;
|
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -11,12 +10,14 @@ using osu.Framework.Graphics.Shapes;
|
|||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Objects;
|
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))]
|
[Cached(Type = typeof(IPlacementHandler))]
|
||||||
public class Compose : EditorScreen, IPlacementHandler
|
public class ComposeScreen : EditorScreen, IPlacementHandler
|
||||||
{
|
{
|
||||||
private const float vertical_margins = 10;
|
private const float vertical_margins = 10;
|
||||||
private const float horizontal_margins = 20;
|
private const float horizontal_margins = 20;
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Screens.Compose
|
namespace osu.Game.Screens.Edit.Compose
|
||||||
{
|
{
|
||||||
public interface IPlacementHandler
|
public interface IPlacementHandler
|
||||||
{
|
{
|
@ -7,11 +7,11 @@ using osu.Framework.Graphics.Shapes;
|
|||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using OpenTK.Graphics;
|
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
|
Add(new Container
|
||||||
{
|
{
|
@ -8,7 +8,6 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Screens.Edit.Menus;
|
|
||||||
using osu.Game.Screens.Edit.Components.Timelines.Summary;
|
using osu.Game.Screens.Edit.Components.Timelines.Summary;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
@ -16,10 +15,10 @@ using osu.Framework.Input.Events;
|
|||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
using osu.Game.Graphics.UserInterface;
|
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;
|
||||||
|
using osu.Game.Screens.Edit.Components.Menus;
|
||||||
|
using osu.Game.Screens.Edit.Compose;
|
||||||
|
using osu.Game.Screens.Edit.Design;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit
|
namespace osu.Game.Screens.Edit
|
||||||
{
|
{
|
||||||
@ -169,10 +168,10 @@ namespace osu.Game.Screens.Edit
|
|||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case EditorScreenMode.Compose:
|
case EditorScreenMode.Compose:
|
||||||
currentScreen = new Compose();
|
currentScreen = new ComposeScreen();
|
||||||
break;
|
break;
|
||||||
case EditorScreenMode.Design:
|
case EditorScreenMode.Design:
|
||||||
currentScreen = new Design();
|
currentScreen = new DesignScreen();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
currentScreen = new EditorScreen();
|
currentScreen = new EditorScreen();
|
||||||
|
@ -7,7 +7,6 @@ using osu.Framework.MathUtils;
|
|||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Screens.Edit.Screens.Compose;
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit
|
namespace osu.Game.Screens.Edit
|
||||||
|
@ -7,7 +7,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Screens
|
namespace osu.Game.Screens.Edit
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// TODO: eventually make this inherit Screen and add a local scren stack inside the Editor.
|
/// TODO: eventually make this inherit Screen and add a local scren stack inside the Editor.
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Screens
|
namespace osu.Game.Screens.Edit
|
||||||
{
|
{
|
||||||
public enum EditorScreenMode
|
public enum EditorScreenMode
|
||||||
{
|
{
|
@ -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 }
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,7 +2,6 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using OpenTK.Graphics;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
@ -10,8 +9,9 @@ using osu.Framework.Graphics.UserInterface;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
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
|
public class LabelledTextBox : CompositeDrawable
|
||||||
{
|
{
|
@ -7,7 +7,6 @@ using osu.Framework.Timing;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Screens.Edit;
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Screens.Edit.Screens.Compose;
|
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual
|
namespace osu.Game.Tests.Visual
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,6 @@ using System.Collections.Generic;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Screens.Edit;
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Screens.Edit.Screens;
|
|
||||||
using osu.Game.Tests.Beatmaps;
|
using osu.Game.Tests.Beatmaps;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual
|
namespace osu.Game.Tests.Visual
|
||||||
|
@ -8,17 +8,17 @@ using osu.Framework.Timing;
|
|||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Screens.Edit.Screens.Compose;
|
using osu.Game.Screens.Edit.Compose;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual
|
namespace osu.Game.Tests.Visual
|
||||||
{
|
{
|
||||||
[Cached(Type = typeof(IPlacementHandler))]
|
[Cached(Type = typeof(IPlacementHandler))]
|
||||||
public abstract class HitObjectPlacementMaskTestCase : OsuTestCase, IPlacementHandler
|
public abstract class PlacementBlueprintTestCase : OsuTestCase, IPlacementHandler
|
||||||
{
|
{
|
||||||
private readonly Container hitObjectContainer;
|
private readonly Container hitObjectContainer;
|
||||||
private PlacementMask currentMask;
|
private PlacementBlueprint currentBlueprint;
|
||||||
|
|
||||||
protected HitObjectPlacementMaskTestCase()
|
protected PlacementBlueprintTestCase()
|
||||||
{
|
{
|
||||||
Beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize = 2;
|
Beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize = 2;
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
Add(currentMask = CreateMask());
|
Add(currentBlueprint = CreateBlueprint());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
@ -51,8 +51,8 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
hitObjectContainer.Add(CreateHitObject(hitObject));
|
hitObjectContainer.Add(CreateHitObject(hitObject));
|
||||||
|
|
||||||
Remove(currentMask);
|
Remove(currentBlueprint);
|
||||||
Add(currentMask = CreateMask());
|
Add(currentBlueprint = CreateBlueprint());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Delete(HitObject hitObject)
|
public void Delete(HitObject hitObject)
|
||||||
@ -60,6 +60,6 @@ namespace osu.Game.Tests.Visual
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected abstract DrawableHitObject CreateHitObject(HitObject hitObject);
|
protected abstract DrawableHitObject CreateHitObject(HitObject hitObject);
|
||||||
protected abstract PlacementMask CreateMask();
|
protected abstract PlacementBlueprint CreateBlueprint();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,14 +10,14 @@ using osu.Game.Rulesets.Edit;
|
|||||||
|
|
||||||
namespace osu.Game.Tests.Visual
|
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;
|
protected override Container<Drawable> Content => content ?? base.Content;
|
||||||
private readonly Container content;
|
private readonly Container content;
|
||||||
|
|
||||||
protected HitObjectSelectionMaskTestCase()
|
protected SelectionBlueprintTestCase()
|
||||||
{
|
{
|
||||||
base.Content.Add(content = new Container
|
base.Content.Add(content = new Container
|
||||||
{
|
{
|
||||||
@ -29,19 +29,19 @@ namespace osu.Game.Tests.Visual
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
base.Content.Add(mask = CreateMask());
|
base.Content.Add(blueprint = CreateBlueprint());
|
||||||
mask.SelectionRequested += (_, __) => mask.Select();
|
blueprint.SelectionRequested += (_, __) => blueprint.Select();
|
||||||
|
|
||||||
AddStep("Select", () => mask.Select());
|
AddStep("Select", () => blueprint.Select());
|
||||||
AddStep("Deselect", () => mask.Deselect());
|
AddStep("Deselect", () => blueprint.Deselect());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
{
|
{
|
||||||
mask.Deselect();
|
blueprint.Deselect();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract SelectionMask CreateMask();
|
protected abstract SelectionBlueprint CreateBlueprint();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user