mirror of
https://github.com/ppy/osu.git
synced 2025-03-22 01:27:19 +08:00
Add safety against playfield potentially not being available during mania note placement
This commit is contained in:
parent
f7e055dbfe
commit
5af7641e94
@ -55,24 +55,25 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
||||
{
|
||||
base.UpdateTimeAndPosition(result);
|
||||
|
||||
var playfield = (Column)result.Playfield;
|
||||
|
||||
// Apply an offset to better align with the visual grid.
|
||||
// This should only be applied during placement, as during selection / drag operations the movement is relative
|
||||
// to the initial point of interaction rather than the grid.
|
||||
switch (playfield.ScrollingInfo.Direction.Value)
|
||||
if (result.Playfield is Column col)
|
||||
{
|
||||
case ScrollingDirection.Down:
|
||||
result.ScreenSpacePosition -= new Vector2(0, getNoteHeight(playfield) / 2);
|
||||
break;
|
||||
// Apply an offset to better align with the visual grid.
|
||||
// This should only be applied during placement, as during selection / drag operations the movement is relative
|
||||
// to the initial point of interaction rather than the grid.
|
||||
switch (col.ScrollingInfo.Direction.Value)
|
||||
{
|
||||
case ScrollingDirection.Down:
|
||||
result.ScreenSpacePosition -= new Vector2(0, getNoteHeight(col) / 2);
|
||||
break;
|
||||
|
||||
case ScrollingDirection.Up:
|
||||
result.ScreenSpacePosition += new Vector2(0, getNoteHeight(playfield) / 2);
|
||||
break;
|
||||
case ScrollingDirection.Up:
|
||||
result.ScreenSpacePosition += new Vector2(0, getNoteHeight(col) / 2);
|
||||
break;
|
||||
}
|
||||
|
||||
if (PlacementActive == PlacementState.Waiting)
|
||||
Column = col;
|
||||
}
|
||||
|
||||
if (PlacementActive == PlacementState.Waiting)
|
||||
Column = playfield;
|
||||
}
|
||||
|
||||
private float getNoteHeight(Column resultPlayfield) =>
|
||||
|
Loading…
x
Reference in New Issue
Block a user