mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 08:32:57 +08:00
Avoid casting by accepting all Playfield
s but throwing on a bad choice
This commit is contained in:
parent
6ab29a62d0
commit
f41b79688f
@ -5,7 +5,6 @@
|
||||
|
||||
using osu.Game.Rulesets.Catch.Edit.Blueprints;
|
||||
using osu.Game.Rulesets.Catch.Objects;
|
||||
using osu.Game.Rulesets.Catch.UI;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Screens.Edit.Compose.Components;
|
||||
@ -38,6 +37,6 @@ namespace osu.Game.Rulesets.Catch.Edit
|
||||
return base.CreateHitObjectBlueprintFor(hitObject);
|
||||
}
|
||||
|
||||
protected sealed override DragBox CreateDragBox() => new ScrollingDragBox((CatchPlayfield)Composer.Playfield);
|
||||
protected sealed override DragBox CreateDragBox() => new ScrollingDragBox(Composer.Playfield);
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Mania.Edit.Blueprints;
|
||||
using osu.Game.Rulesets.Mania.Objects;
|
||||
using osu.Game.Rulesets.Mania.UI;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Screens.Edit.Compose.Components;
|
||||
|
||||
@ -35,6 +34,6 @@ namespace osu.Game.Rulesets.Mania.Edit
|
||||
|
||||
protected override SelectionHandler<HitObject> CreateSelectionHandler() => new ManiaSelectionHandler();
|
||||
|
||||
protected sealed override DragBox CreateDragBox() => new ScrollingDragBox((ManiaPlayfield)Composer.Playfield);
|
||||
protected sealed override DragBox CreateDragBox() => new ScrollingDragBox(Composer.Playfield);
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Rulesets.UI.Scrolling;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Compose.Components
|
||||
@ -20,9 +21,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
|
||||
private readonly ScrollingPlayfield playfield;
|
||||
|
||||
public ScrollingDragBox(ScrollingPlayfield playfield)
|
||||
public ScrollingDragBox(Playfield playfield)
|
||||
{
|
||||
this.playfield = playfield;
|
||||
this.playfield = playfield as ScrollingPlayfield ?? throw new ArgumentException("Playfield must be of type {nameof(ScrollingPlayfield)} to use this class.", nameof(playfield));
|
||||
}
|
||||
|
||||
public override void HandleDrag(MouseButtonEvent e)
|
||||
|
Loading…
Reference in New Issue
Block a user