mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 10:02:59 +08:00
Make groups fill up in round robin way, rather than sequentially.
This commit is contained in:
parent
b0d5d88fe9
commit
febdfd5de4
@ -17,6 +17,7 @@ namespace osu.Game.Screens.Tournament
|
|||||||
private List<Group> allGroups = new List<Group>();
|
private List<Group> allGroups = new List<Group>();
|
||||||
|
|
||||||
private int maxTeams;
|
private int maxTeams;
|
||||||
|
private int currentGroup;
|
||||||
|
|
||||||
public GroupsContainer(int numGroups, int teamsPerGroup)
|
public GroupsContainer(int numGroups, int teamsPerGroup)
|
||||||
{
|
{
|
||||||
@ -62,14 +63,12 @@ namespace osu.Game.Screens.Tournament
|
|||||||
|
|
||||||
public void AddTeam(Team team)
|
public void AddTeam(Team team)
|
||||||
{
|
{
|
||||||
foreach (Group g in allGroups)
|
if (allGroups[currentGroup].TeamsCount == maxTeams)
|
||||||
{
|
return;
|
||||||
if (g.TeamsCount == maxTeams)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
g.AddTeam(team);
|
allGroups[currentGroup].AddTeam(team);
|
||||||
break;
|
|
||||||
}
|
currentGroup = (currentGroup + 1) % allGroups.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ContainsTeam(string fullName)
|
public bool ContainsTeam(string fullName)
|
||||||
@ -77,23 +76,12 @@ namespace osu.Game.Screens.Tournament
|
|||||||
return allGroups.Any(g => g.ContainsTeam(fullName));
|
return allGroups.Any(g => g.ContainsTeam(fullName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool RemoveTeam(Team team)
|
|
||||||
{
|
|
||||||
foreach (Group g in allGroups)
|
|
||||||
{
|
|
||||||
if (g.RemoveTeam(team))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ClearTeams()
|
public void ClearTeams()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < allGroups.Count; i++)
|
foreach (Group g in allGroups)
|
||||||
{
|
g.ClearTeams();
|
||||||
allGroups[i].ClearTeams();
|
|
||||||
}
|
currentGroup = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ToStringRepresentation()
|
public string ToStringRepresentation()
|
||||||
|
Loading…
Reference in New Issue
Block a user