mirror of
https://github.com/ppy/osu.git
synced 2025-02-07 22:53:09 +08:00
use G to change grid type
This commit is contained in:
parent
9a8c41f6ca
commit
493e3a5f7a
@ -22,9 +22,9 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
{
|
{
|
||||||
public partial class OsuGridToolboxGroup : EditorToolboxGroup, IKeyBindingHandler<GlobalAction>
|
public partial class OsuGridToolboxGroup : EditorToolboxGroup, IKeyBindingHandler<GlobalAction>
|
||||||
{
|
{
|
||||||
private static readonly int[] grid_sizes = { 4, 8, 16, 32 };
|
private static readonly PositionSnapGridType[] grid_types = Enum.GetValues(typeof(PositionSnapGridType)).Cast<PositionSnapGridType>().ToArray();
|
||||||
|
|
||||||
private int currentGridSizeIndex = grid_sizes.Length - 1;
|
private int currentGridTypeIndex;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private EditorBeatmap editorBeatmap { get; set; } = null!;
|
private EditorBeatmap editorBeatmap { get; set; } = null!;
|
||||||
@ -134,9 +134,6 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
};
|
};
|
||||||
|
|
||||||
Spacing.Value = editorBeatmap.BeatmapInfo.GridSize;
|
Spacing.Value = editorBeatmap.BeatmapInfo.GridSize;
|
||||||
int gridSizeIndex = Array.IndexOf(grid_sizes, editorBeatmap.BeatmapInfo.GridSize);
|
|
||||||
if (gridSizeIndex >= 0)
|
|
||||||
currentGridSizeIndex = gridSizeIndex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -174,10 +171,11 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void nextGridSize()
|
private void nextGridType()
|
||||||
{
|
{
|
||||||
currentGridSizeIndex = (currentGridSizeIndex + 1) % grid_sizes.Length;
|
currentGridTypeIndex = (currentGridTypeIndex + 1) % grid_types.Length;
|
||||||
Spacing.Value = grid_sizes[currentGridSizeIndex];
|
GridType.Value = grid_types[currentGridTypeIndex];
|
||||||
|
gridTypeButtons.Items[currentGridTypeIndex].Select();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
||||||
@ -185,7 +183,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
switch (e.Action)
|
switch (e.Action)
|
||||||
{
|
{
|
||||||
case GlobalAction.EditorCycleGridDisplayMode:
|
case GlobalAction.EditorCycleGridDisplayMode:
|
||||||
nextGridSize();
|
nextGridType();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user