Ejemplo n.º 1
0
        public Cup(string name, Club[] clubs)
        {
            this.name  = name;
            this.clubs = clubs;

            nrRound   = 0;
            nextRound = rounds[nrRound];

            players = new List <Player>(21 * clubs.Length);
            for (int i = 0; i < clubs.Length; i++)
            {
                for (int j = 0; j < clubs[i].squad.players.Count; j++)
                {
                    players.Add(clubs[i].squad.players[j]);
                }
            }

            topScorers = new TableTopScorers(players);

            _1_8Final = new Match[8];
            _1_4Final = new Match[4];
            _1_2Final = new Match[2];
        }
        public League(string name, Club[] clubs)
        {
            this.name  = name;
            this.clubs = clubs;

            players = new List <Player>(21 * clubs.Length);
            for (int i = 0; i < clubs.Length; i++)
            {
                for (int j = 0; j < clubs[i].squad.players.Count; j++)
                {
                    players.Add(clubs[i].squad.players[j]);
                }
            }

            table      = new TableLeague(clubs);
            topScorers = new TableTopScorers(players);

            rounds = new Round[(clubs.Length - 1) * 2];
            for (int i = 0; i < rounds.Length; i++)
            {
                rounds[i] = new Round(this, i);
            }

            for (int k = 0; k < clubs.Length; k++)
            {
                for (int j = 0; j < rounds.Length; j++)
                {
                    for (int i = 0; i < rounds[0].matches.Length; i++)
                    {
                        if (clubs[k].fullName == rounds[j].matches[i].host.fullName || clubs[k].fullName == rounds[j].matches[i].guest.fullName)
                        {
                            clubs[k].statistics.matches[j] = rounds[j].matches[i];
                        }
                    }
                }
            }
        }