1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 14:17:26 +08:00

General refactorings

This commit is contained in:
smoogipoo 2020-01-16 11:54:03 +09:00
parent d57f55f053
commit 5f178b7755
3 changed files with 22 additions and 22 deletions

View File

@ -14,6 +14,11 @@ namespace osu.Game.Rulesets.Osu.Edit
{
public class OsuBlueprintContainer : ComposeBlueprintContainer
{
public OsuBlueprintContainer(IEnumerable<DrawableHitObject> drawableHitObjects)
: base(drawableHitObjects)
{
}
protected override SelectionHandler CreateSelectionHandler() => new OsuSelectionHandler();
public override SelectionBlueprint CreateBlueprintFor(DrawableHitObject hitObject)
@ -32,10 +37,5 @@ namespace osu.Game.Rulesets.Osu.Edit
return base.CreateBlueprintFor(hitObject);
}
public OsuBlueprintContainer(IEnumerable<DrawableHitObject> drawableHitObjects)
: base(drawableHitObjects)
{
}
}
}

View File

@ -147,8 +147,6 @@ namespace osu.Game.Rulesets.Edit
blueprintContainer.SelectionChanged += selectionChanged;
}
protected abstract ComposeBlueprintContainer CreateBlueprintContainer();
protected override void LoadComplete()
{
base.LoadComplete();
@ -235,6 +233,8 @@ namespace osu.Game.Rulesets.Edit
protected abstract IReadOnlyList<HitObjectCompositionTool> CompositionTools { get; }
protected abstract ComposeBlueprintContainer CreateBlueprintContainer();
protected abstract DrawableRuleset<TObject> CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods = null);
public void BeginPlacement(HitObject hitObject)

View File

@ -29,7 +29,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
{
public event Action<IEnumerable<HitObject>> SelectionChanged;
protected DragBox DragBox;
protected DragBox DragBox { get; private set; }
private SelectionBlueprintContainer selectionBlueprints;
@ -49,19 +49,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
RelativeSizeAxes = Axes.Both;
}
/// <summary>
/// Creates a <see cref="SelectionHandler"/> which outlines <see cref="DrawableHitObject"/>s and handles movement of selections.
/// </summary>
protected virtual SelectionHandler CreateSelectionHandler() => new SelectionHandler();
/// <summary>
/// Creates a <see cref="SelectionBlueprint"/> for a specific <see cref="DrawableHitObject"/>.
/// </summary>
/// <param name="hitObject">The <see cref="DrawableHitObject"/> to create the overlay for.</param>
protected virtual SelectionBlueprint CreateBlueprintFor(HitObject hitObject) => null;
protected virtual DragBox CreateDragBox(Action<RectangleF> performSelect) => new DragBox(performSelect);
[BackgroundDependencyLoader]
private void load()
{
@ -73,7 +60,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
DragBox = CreateDragBox(select),
selectionHandler,
selectionBlueprints = new SelectionBlueprintContainer { RelativeSizeAxes = Axes.Both },
DragBox.CreateProxy().With(p => p.Depth = int.MinValue)
DragBox.CreateProxy().With(p => p.Depth = float.MinValue)
});
foreach (var obj in beatmap.HitObjects)
@ -88,6 +75,19 @@ namespace osu.Game.Screens.Edit.Compose.Components
beatmap.HitObjectRemoved += removeBlueprintFor;
}
/// <summary>
/// Creates a <see cref="SelectionHandler"/> which outlines <see cref="DrawableHitObject"/>s and handles movement of selections.
/// </summary>
protected virtual SelectionHandler CreateSelectionHandler() => new SelectionHandler();
/// <summary>
/// Creates a <see cref="SelectionBlueprint"/> for a specific <see cref="DrawableHitObject"/>.
/// </summary>
/// <param name="hitObject">The <see cref="DrawableHitObject"/> to create the overlay for.</param>
protected virtual SelectionBlueprint CreateBlueprintFor(HitObject hitObject) => null;
protected virtual DragBox CreateDragBox(Action<RectangleF> performSelect) => new DragBox(performSelect);
protected override bool OnMouseDown(MouseDownEvent e)
{
beginClickSelection(e);