mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Add safety against playfield potentially not being available during mania note placement
This commit is contained in:
@ -55,24 +55,25 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|||||||
{
|
{
|
||||||
base.UpdateTimeAndPosition(result);
|
base.UpdateTimeAndPosition(result);
|
||||||
|
|
||||||
var playfield = (Column)result.Playfield;
|
if (result.Playfield is Column col)
|
||||||
|
{
|
||||||
// Apply an offset to better align with the visual grid.
|
// 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
|
// 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.
|
// to the initial point of interaction rather than the grid.
|
||||||
switch (playfield.ScrollingInfo.Direction.Value)
|
switch (col.ScrollingInfo.Direction.Value)
|
||||||
{
|
{
|
||||||
case ScrollingDirection.Down:
|
case ScrollingDirection.Down:
|
||||||
result.ScreenSpacePosition -= new Vector2(0, getNoteHeight(playfield) / 2);
|
result.ScreenSpacePosition -= new Vector2(0, getNoteHeight(col) / 2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ScrollingDirection.Up:
|
case ScrollingDirection.Up:
|
||||||
result.ScreenSpacePosition += new Vector2(0, getNoteHeight(playfield) / 2);
|
result.ScreenSpacePosition += new Vector2(0, getNoteHeight(col) / 2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PlacementActive == PlacementState.Waiting)
|
if (PlacementActive == PlacementState.Waiting)
|
||||||
Column = playfield;
|
Column = col;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private float getNoteHeight(Column resultPlayfield) =>
|
private float getNoteHeight(Column resultPlayfield) =>
|
||||||
|
Reference in New Issue
Block a user