mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 01:47:30 +09:00
Store grid size back to beatmap on change
This commit is contained in:
parent
0d7dac03f4
commit
d15bd5a15e
@ -72,6 +72,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void gridSizeIs(int size)
|
private void gridSizeIs(int size)
|
||||||
=> AddAssert($"grid size is {size}", () => this.ChildrenOfType<OsuRectangularPositionSnapGrid>().Single().Spacing == new Vector2(size));
|
=> AddAssert($"grid size is {size}", () => this.ChildrenOfType<OsuRectangularPositionSnapGrid>().Single().Spacing == new Vector2(size)
|
||||||
|
&& EditorBeatmap.BeatmapInfo.GridSize == size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both
|
RelativeSizeAxes = Axes.Both
|
||||||
},
|
},
|
||||||
rectangularPositionSnapGrid = new OsuRectangularPositionSnapGrid(EditorBeatmap.BeatmapInfo.GridSize)
|
rectangularPositionSnapGrid = new OsuRectangularPositionSnapGrid
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both
|
RelativeSizeAxes = Axes.Both
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,12 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
using osu.Game.Rulesets.Osu.UI;
|
using osu.Game.Rulesets.Osu.UI;
|
||||||
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Screens.Edit.Compose.Components;
|
using osu.Game.Screens.Edit.Compose.Components;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
@ -17,10 +19,18 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
|
|
||||||
private int currentGridSizeIndex = grid_sizes.Length - 1;
|
private int currentGridSizeIndex = grid_sizes.Length - 1;
|
||||||
|
|
||||||
public OsuRectangularPositionSnapGrid(int gridSize)
|
[Resolved]
|
||||||
|
private EditorBeatmap editorBeatmap { get; set; }
|
||||||
|
|
||||||
|
public OsuRectangularPositionSnapGrid()
|
||||||
: base(OsuPlayfield.BASE_SIZE / 2)
|
: base(OsuPlayfield.BASE_SIZE / 2)
|
||||||
{
|
{
|
||||||
var gridSizeIndex = Array.IndexOf(grid_sizes, gridSize);
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
var gridSizeIndex = Array.IndexOf(grid_sizes, editorBeatmap.BeatmapInfo.GridSize);
|
||||||
if (gridSizeIndex > 0)
|
if (gridSizeIndex > 0)
|
||||||
currentGridSizeIndex = gridSizeIndex;
|
currentGridSizeIndex = gridSizeIndex;
|
||||||
updateSpacing();
|
updateSpacing();
|
||||||
@ -34,7 +44,10 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
|
|
||||||
private void updateSpacing()
|
private void updateSpacing()
|
||||||
{
|
{
|
||||||
Spacing = new Vector2(grid_sizes[currentGridSizeIndex]);
|
int gridSize = grid_sizes[currentGridSizeIndex];
|
||||||
|
|
||||||
|
editorBeatmap.BeatmapInfo.GridSize = gridSize;
|
||||||
|
Spacing = new Vector2(gridSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user