1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-08 23:32:59 +08:00

Add better flow logic to map pool layout when few beatmaps are present

This commit is contained in:
Dean Herbert 2020-03-07 14:28:10 +09:00
parent c7c7e626b8
commit 77c94afcf1

View File

@ -47,9 +47,10 @@ namespace osu.Game.Tournament.Screens.MapPool
{ {
Y = 100, Y = 100,
Spacing = new Vector2(10, 10), Spacing = new Vector2(10, 10),
Padding = new MarginPadding(25), Padding = new MarginPadding(5) { Horizontal = 100 },
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
}, },
new ControlPanel new ControlPanel
{ {
@ -90,6 +91,7 @@ namespace osu.Game.Tournament.Screens.MapPool
Text = "Reset", Text = "Reset",
Action = reset Action = reset
}, },
new ControlPanel.Spacer(),
} }
} }
}; };
@ -206,11 +208,15 @@ namespace osu.Game.Tournament.Screens.MapPool
{ {
mapFlows.Clear(); mapFlows.Clear();
int totalRows = 0;
if (match.NewValue.Round.Value != null) if (match.NewValue.Round.Value != null)
{ {
FillFlowContainer<TournamentBeatmapPanel> currentFlow = null; FillFlowContainer<TournamentBeatmapPanel> currentFlow = null;
string currentMod = null; string currentMod = null;
int flowCount = 0;
foreach (var b in match.NewValue.Round.Value.Beatmaps) foreach (var b in match.NewValue.Round.Value.Beatmaps)
{ {
if (currentFlow == null || currentMod != b.Mods) if (currentFlow == null || currentMod != b.Mods)
@ -224,6 +230,15 @@ namespace osu.Game.Tournament.Screens.MapPool
}); });
currentMod = b.Mods; currentMod = b.Mods;
totalRows++;
flowCount = 0;
}
if (++flowCount > 2)
{
totalRows++;
flowCount = 0;
} }
currentFlow.Add(new TournamentBeatmapPanel(b.BeatmapInfo, b.Mods) currentFlow.Add(new TournamentBeatmapPanel(b.BeatmapInfo, b.Mods)
@ -233,6 +248,10 @@ namespace osu.Game.Tournament.Screens.MapPool
}); });
} }
} }
if (totalRows > 8)
// remove horizontal padding to increase flow width to 3 panels
mapFlows.Padding = new MarginPadding(5);
} }
} }
} }