mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 14:17:26 +08:00
General refactorings
This commit is contained in:
parent
d57f55f053
commit
5f178b7755
@ -14,6 +14,11 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
{
|
{
|
||||||
public class OsuBlueprintContainer : ComposeBlueprintContainer
|
public class OsuBlueprintContainer : ComposeBlueprintContainer
|
||||||
{
|
{
|
||||||
|
public OsuBlueprintContainer(IEnumerable<DrawableHitObject> drawableHitObjects)
|
||||||
|
: base(drawableHitObjects)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected override SelectionHandler CreateSelectionHandler() => new OsuSelectionHandler();
|
protected override SelectionHandler CreateSelectionHandler() => new OsuSelectionHandler();
|
||||||
|
|
||||||
public override SelectionBlueprint CreateBlueprintFor(DrawableHitObject hitObject)
|
public override SelectionBlueprint CreateBlueprintFor(DrawableHitObject hitObject)
|
||||||
@ -32,10 +37,5 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
|
|
||||||
return base.CreateBlueprintFor(hitObject);
|
return base.CreateBlueprintFor(hitObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
public OsuBlueprintContainer(IEnumerable<DrawableHitObject> drawableHitObjects)
|
|
||||||
: base(drawableHitObjects)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,8 +147,6 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
blueprintContainer.SelectionChanged += selectionChanged;
|
blueprintContainer.SelectionChanged += selectionChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract ComposeBlueprintContainer CreateBlueprintContainer();
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
@ -235,6 +233,8 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
|
|
||||||
protected abstract IReadOnlyList<HitObjectCompositionTool> CompositionTools { get; }
|
protected abstract IReadOnlyList<HitObjectCompositionTool> CompositionTools { get; }
|
||||||
|
|
||||||
|
protected abstract ComposeBlueprintContainer CreateBlueprintContainer();
|
||||||
|
|
||||||
protected abstract DrawableRuleset<TObject> CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods = null);
|
protected abstract DrawableRuleset<TObject> CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods = null);
|
||||||
|
|
||||||
public void BeginPlacement(HitObject hitObject)
|
public void BeginPlacement(HitObject hitObject)
|
||||||
|
@ -29,7 +29,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
{
|
{
|
||||||
public event Action<IEnumerable<HitObject>> SelectionChanged;
|
public event Action<IEnumerable<HitObject>> SelectionChanged;
|
||||||
|
|
||||||
protected DragBox DragBox;
|
protected DragBox DragBox { get; private set; }
|
||||||
|
|
||||||
private SelectionBlueprintContainer selectionBlueprints;
|
private SelectionBlueprintContainer selectionBlueprints;
|
||||||
|
|
||||||
@ -49,19 +49,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
RelativeSizeAxes = Axes.Both;
|
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]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
@ -73,7 +60,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
DragBox = CreateDragBox(select),
|
DragBox = CreateDragBox(select),
|
||||||
selectionHandler,
|
selectionHandler,
|
||||||
selectionBlueprints = new SelectionBlueprintContainer { RelativeSizeAxes = Axes.Both },
|
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)
|
foreach (var obj in beatmap.HitObjects)
|
||||||
@ -88,6 +75,19 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
beatmap.HitObjectRemoved += removeBlueprintFor;
|
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)
|
protected override bool OnMouseDown(MouseDownEvent e)
|
||||||
{
|
{
|
||||||
beginClickSelection(e);
|
beginClickSelection(e);
|
||||||
|
Loading…
Reference in New Issue
Block a user