mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 18:23:04 +08:00
Add grid to show ladder editor snapping
This commit is contained in:
parent
b1484e6973
commit
fd1bd0c88a
@ -14,6 +14,7 @@ using osu.Framework.Graphics.UserInterface;
|
|||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Input.States;
|
using osu.Framework.Input.States;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Screens.Edit.Compose.Components;
|
||||||
using osu.Game.Tournament.Components;
|
using osu.Game.Tournament.Components;
|
||||||
using osu.Game.Tournament.Models;
|
using osu.Game.Tournament.Models;
|
||||||
using osu.Game.Tournament.Screens.Ladder;
|
using osu.Game.Tournament.Screens.Ladder;
|
||||||
@ -26,6 +27,8 @@ namespace osu.Game.Tournament.Screens.Editors
|
|||||||
[Cached]
|
[Cached]
|
||||||
public partial class LadderEditorScreen : LadderScreen, IHasContextMenu
|
public partial class LadderEditorScreen : LadderScreen, IHasContextMenu
|
||||||
{
|
{
|
||||||
|
public const float GRID_SPACING = 10;
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
private LadderEditorInfo editorInfo = new LadderEditorInfo();
|
private LadderEditorInfo editorInfo = new LadderEditorInfo();
|
||||||
|
|
||||||
@ -43,6 +46,13 @@ namespace osu.Game.Tournament.Screens.Editors
|
|||||||
|
|
||||||
AddInternal(rightClickMessage = new WarningBox("Right click to place and link matches"));
|
AddInternal(rightClickMessage = new WarningBox("Right click to place and link matches"));
|
||||||
|
|
||||||
|
ScrollContent.Add(new RectangularPositionSnapGrid(Vector2.Zero)
|
||||||
|
{
|
||||||
|
Spacing = new Vector2(GRID_SPACING),
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Depth = float.MaxValue
|
||||||
|
});
|
||||||
|
|
||||||
LadderInfo.Matches.CollectionChanged += (_, _) => updateMessage();
|
LadderInfo.Matches.CollectionChanged += (_, _) => updateMessage();
|
||||||
updateMessage();
|
updateMessage();
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Tournament.Models;
|
using osu.Game.Tournament.Models;
|
||||||
|
using osu.Game.Tournament.Screens.Editors;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
@ -44,8 +45,6 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
|||||||
const float border_thickness = 4;
|
const float border_thickness = 4;
|
||||||
const float spacing = 2;
|
const float spacing = 2;
|
||||||
|
|
||||||
Margin = new MarginPadding(border_thickness);
|
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
Flow = new FillFlowContainer<DrawableMatchTeam>
|
Flow = new FillFlowContainer<DrawableMatchTeam>
|
||||||
@ -333,8 +332,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
|||||||
|
|
||||||
private Vector2 snapToGrid(Vector2 pos) =>
|
private Vector2 snapToGrid(Vector2 pos) =>
|
||||||
new Vector2(
|
new Vector2(
|
||||||
(int)(pos.X / 10) * 10,
|
(int)(pos.X / LadderEditorScreen.GRID_SPACING) * LadderEditorScreen.GRID_SPACING,
|
||||||
(int)(pos.Y / 10) * 10
|
(int)(pos.Y / LadderEditorScreen.GRID_SPACING) * LadderEditorScreen.GRID_SPACING
|
||||||
);
|
);
|
||||||
|
|
||||||
public void Remove()
|
public void Remove()
|
||||||
|
Loading…
Reference in New Issue
Block a user