mirror of https://github.com/ppy/osu
Add grid to show ladder editor snapping
This commit is contained in:
parent
b1484e6973
commit
fd1bd0c88a
|
@ -14,6 +14,7 @@
|
|||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Input.States;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Screens.Edit.Compose.Components;
|
||||
using osu.Game.Tournament.Components;
|
||||
using osu.Game.Tournament.Models;
|
||||
using osu.Game.Tournament.Screens.Ladder;
|
||||
|
@ -26,6 +27,8 @@ namespace osu.Game.Tournament.Screens.Editors
|
|||
[Cached]
|
||||
public partial class LadderEditorScreen : LadderScreen, IHasContextMenu
|
||||
{
|
||||
public const float GRID_SPACING = 10;
|
||||
|
||||
[Cached]
|
||||
private LadderEditorInfo editorInfo = new LadderEditorInfo();
|
||||
|
||||
|
@ -43,6 +46,13 @@ private void load()
|
|||
|
||||
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();
|
||||
updateMessage();
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Tournament.Models;
|
||||
using osu.Game.Tournament.Screens.Editors;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using osuTK.Input;
|
||||
|
@ -44,8 +45,6 @@ public DrawableTournamentMatch(TournamentMatch match, bool editor = false)
|
|||
const float border_thickness = 4;
|
||||
const float spacing = 2;
|
||||
|
||||
Margin = new MarginPadding(border_thickness);
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
Flow = new FillFlowContainer<DrawableMatchTeam>
|
||||
|
@ -333,8 +332,8 @@ protected override void OnDrag(DragEvent e)
|
|||
|
||||
private Vector2 snapToGrid(Vector2 pos) =>
|
||||
new Vector2(
|
||||
(int)(pos.X / 10) * 10,
|
||||
(int)(pos.Y / 10) * 10
|
||||
(int)(pos.X / LadderEditorScreen.GRID_SPACING) * LadderEditorScreen.GRID_SPACING,
|
||||
(int)(pos.Y / LadderEditorScreen.GRID_SPACING) * LadderEditorScreen.GRID_SPACING
|
||||
);
|
||||
|
||||
public void Remove()
|
||||
|
|
Loading…
Reference in New Issue