Exemplo n.º 1
0
        public int GetExpectedParticipantCount()
        {
            int participants;

            if (IsFirstRound())
            {
                participants = Tournament.PlayerReferences.Count;
            }
            else
            {
                RoundBase round = GetPreviousRound();
                participants = round.Groups.Count * round.AdvancingPerGroupCount;
            }

            return(Math.Max(2, participants));
        }
Exemplo n.º 2
0
        public bool Construct()
        {
            ConstructGroups();
            AssignDefaultStartTimeToMatchesInRound();

            RoundBase nextRound      = GetNextRound();
            bool      nextRoundExist = nextRound != null;

            if (nextRoundExist)
            {
                return(nextRound.Construct());
            }

            MarkAsModified();

            return(true);
        }
Exemplo n.º 3
0
        private List <PlayerReference> GetNextGroupOfPlayers(int startIndex, int count)
        {
            if (IsFirstRound())
            {
                count = Math.Min(startIndex + count, Tournament.PlayerReferences.Count) - startIndex;
                return(Tournament.PlayerReferences.GetRange(startIndex, count));
            }
            else
            {
                RoundBase previousRound = GetPreviousRound();

                if (previousRound.GetPlayState() == PlayStateEnum.Finished)
                {
                    List <PlayerReference> playerReferences = previousRound.GetAdvancingPlayerReferences();

                    count = Math.Min(startIndex + count, playerReferences.Count) - startIndex;
                    return(playerReferences.GetRange(startIndex, count));
                }
            }

            return(new List <PlayerReference>());
        }