1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-07 18:23:16 +08:00

Saving exact grid spacing

This commit is contained in:
OliBomby 2023-12-30 14:32:20 +01:00
parent 1c75357d77
commit 9a8c41f6ca

View File

@ -133,10 +133,10 @@ namespace osu.Game.Rulesets.Osu.Edit
}, },
}; };
Spacing.Value = editorBeatmap.BeatmapInfo.GridSize;
int gridSizeIndex = Array.IndexOf(grid_sizes, editorBeatmap.BeatmapInfo.GridSize); int gridSizeIndex = Array.IndexOf(grid_sizes, editorBeatmap.BeatmapInfo.GridSize);
if (gridSizeIndex >= 0) if (gridSizeIndex >= 0)
currentGridSizeIndex = gridSizeIndex; currentGridSizeIndex = gridSizeIndex;
updateSpacing();
} }
protected override void LoadComplete() protected override void LoadComplete()
@ -164,6 +164,7 @@ namespace osu.Game.Rulesets.Osu.Edit
spacingSlider.ContractedLabelText = $"S: {spacing.NewValue:N0}"; spacingSlider.ContractedLabelText = $"S: {spacing.NewValue:N0}";
spacingSlider.ExpandedLabelText = $"Spacing: {spacing.NewValue:N0}"; spacingSlider.ExpandedLabelText = $"Spacing: {spacing.NewValue:N0}";
SpacingVector.Value = new Vector2(spacing.NewValue); SpacingVector.Value = new Vector2(spacing.NewValue);
editorBeatmap.BeatmapInfo.GridSize = (int)spacing.NewValue;
}, true); }, true);
GridLinesRotation.BindValueChanged(rotation => GridLinesRotation.BindValueChanged(rotation =>
@ -176,15 +177,7 @@ namespace osu.Game.Rulesets.Osu.Edit
private void nextGridSize() private void nextGridSize()
{ {
currentGridSizeIndex = (currentGridSizeIndex + 1) % grid_sizes.Length; currentGridSizeIndex = (currentGridSizeIndex + 1) % grid_sizes.Length;
updateSpacing(); Spacing.Value = grid_sizes[currentGridSizeIndex];
}
private void updateSpacing()
{
int gridSize = grid_sizes[currentGridSizeIndex];
editorBeatmap.BeatmapInfo.GridSize = gridSize;
Spacing.Value = gridSize;
} }
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e) public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)