コード例 #1
0
        public TeamTournamentStats(TournamentSeason tournamentSeason, Team team)
        {
            TournamentSeason = tournamentSeason;
            Team = team;

            PlayerStats = new List<PlayerTournamentStats>();
        }
コード例 #2
0
ファイル: Tie.cs プロジェクト: MilenPavlov/EuroManager
        public Fixture[] CreateFixtures(TournamentSeason tournamentSeason)
        {
            var firstLeg = new Fixture(tournamentSeason, FirstLegDate, Team1, Team2, false, false);
            var secondLeg = new Fixture(SecondLegDate, firstLeg);

            return new Fixture[] { firstLeg, secondLeg };
        }
コード例 #3
0
ファイル: Scheduler.cs プロジェクト: MilenPavlov/EuroManager
        public IEnumerable<Fixture> ScheduleLeagueFixtures(TournamentSeason season, IEnumerable<Team> teams,
            DateTime startDate, DateTime endDate, DayOfWeek dayOfWeek, int frequency, bool hasReturnRound = true)
        {
            int roundCount = CalculateRoundCount(teams.Count());
            int stage1RoundCount = hasReturnRound ? roundCount : roundCount / 2 + 1;
            int stage2RoundCount = hasReturnRound ? roundCount : roundCount - stage1RoundCount;

            var dates = ScheduleRoundDates(startDate, endDate, dayOfWeek, frequency, stage1RoundCount, stage2RoundCount);

            return ScheduleLeagueFixtures(season, dates, hasReturnRound, teams);
        }
コード例 #4
0
ファイル: Scheduler.cs プロジェクト: MilenPavlov/EuroManager
        private IEnumerable<Fixture> ScheduleRoundFixtures(TournamentSeason season, DateTime date, int round, bool isReturnRound, IEnumerable<Team> teams)
        {
            int count;
            var fixtures = new List<Fixture>();
            Team restingTeam = teams.ElementAt(round);
            Team lastTeam = null;

            if (teams.Count() % 2 == 0)
            {
                count = teams.Count() - 1;
                lastTeam = teams.Last();
            }
            else
            {
                count = teams.Count();
            }

            for (int i = 1; i <= (count - 1) / 2; i++)
            {
                Team team1 = teams.ElementAt((round + i) % count);
                Team team2 = teams.ElementAt((round + count - i) % count);

                if (round % 2 == (isReturnRound ? 1 : 0))
                {
                    fixtures.Add(new Fixture(season, date, team1, team2, false, false));
                }
                else
                {
                    fixtures.Add(new Fixture(season, date, team2, team1, false, false));
                }
            }

            if (lastTeam != null)
            {
                if (round % 2 == (isReturnRound ? 1 : 0))
                {
                    fixtures.Add(new Fixture(season, date, lastTeam, restingTeam, false, false));
                }
                else
                {
                    fixtures.Add(new Fixture(season, date, restingTeam, lastTeam, false, false));
                }
            }

            return random.Sort(fixtures);
        }
コード例 #5
0
ファイル: Scheduler.cs プロジェクト: MilenPavlov/EuroManager
        public IEnumerable<Fixture> ScheduleLeagueFixtures(TournamentSeason season, IEnumerable<DateTime> dates, bool hasReturnRound, IEnumerable<Team> teams)
        {
            int round = 0;
            int roundCount = CalculateRoundCount(teams.Count());

            teams = random.Sort(teams);
            var fixtures = new List<Fixture>();

            foreach (var date in dates)
            {
                var roundFixtures = ScheduleRoundFixtures(season, date, round % roundCount, hasReturnRound && round >= roundCount, teams);
                fixtures.AddRange(roundFixtures);

                round++;
            }

            return fixtures;
        }
コード例 #6
0
ファイル: GroupStats.cs プロジェクト: MilenPavlov/EuroManager
 public IEnumerable<Fixture> CreateFixtures(TournamentSeason season, IEnumerable<DateTime> dates)
 {
     var scheduler = new Scheduler();
     return scheduler.ScheduleLeagueFixtures(season, dates, HasReturnRound, Teams);
 }
コード例 #7
0
 public PlayerTournamentStats(TournamentSeason tournamentSeason, Player player)
 {
     TournamentSeason = tournamentSeason;
     Player = player;
     PlayerName = player.Name;
 }
コード例 #8
0
 public void AddDivisionSeason(TournamentSeason divisionSeason)
 {
     Divisions.Add(divisionSeason);
 }
コード例 #9
0
 private IEnumerable<TeamPair> CreatePairsForDivisions(TournamentSeason division, TournamentSeason lowerDivision)
 {
     return Enumerable.Zip(division.RelegationPlayOffTeams, lowerDivision.PromotionPlayOffTeams.AsEnumerable().Reverse(),
         (t1, t2) => new TeamPair(t2, t1)).ToArray();
 }
コード例 #10
0
ファイル: Fixture.cs プロジェクト: MilenPavlov/EuroManager
 public Fixture(TournamentSeason tournamentSeason, DateTime date, Team team1, Team team2, bool isNeutralGround, bool requiresExtraTime)
     : this(tournamentSeason.World, tournamentSeason.Id, date, team1, team2, isNeutralGround, requiresExtraTime)
 {
 }