1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 03:35:35 +08:00

Split tournament player lists more equally

This commit is contained in:
Dean Herbert 2023-11-09 21:35:37 +09:00
parent 5180fa669b
commit 4fa158e0d8
No known key found for this signature in database

View File

@ -1,7 +1,9 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
@ -17,6 +19,11 @@ namespace osu.Game.Tournament.Components
{
AutoSizeAxes = Axes.Both;
var players = team?.Players ?? new BindableList<TournamentUser>();
// split the players into two even columns, favouring the first column if odd.
int split = (int)Math.Ceiling(players.Count / 2f);
InternalChildren = new Drawable[]
{
new FillFlowContainer
@ -39,13 +46,13 @@ namespace osu.Game.Tournament.Components
{
Direction = FillDirection.Vertical,
AutoSizeAxes = Axes.Both,
ChildrenEnumerable = team?.Players.Select(createPlayerText).Take(5) ?? Enumerable.Empty<Drawable>()
ChildrenEnumerable = players.Take(split).Select(createPlayerText),
},
new FillFlowContainer
{
Direction = FillDirection.Vertical,
AutoSizeAxes = Axes.Both,
ChildrenEnumerable = team?.Players.Select(createPlayerText).Skip(5) ?? Enumerable.Empty<Drawable>()
ChildrenEnumerable = players.Skip(split).Select(createPlayerText),
},
}
},