public ViewRankingGroups(GroupsRound round, double sizeMultiplier, bool focusOnTeam, Club team) { _round = round; _focusOnTeam = focusOnTeam; _sizeMultiplier = sizeMultiplier; _team = team; }
public static void Exporter(Tournament c) { ExporterClubs(); StringBuilder dir = new StringBuilder(); dir.Append("Output\\").Append(c.name).Append(" ").Append(Session.Instance.Game.date.Year); StringBuilder dir2 = new StringBuilder(); dir2.Append("Output\\").Append(c.shortName).Append(" ").Append(Session.Instance.Game.date.Year); if (!Directory.Exists(dir.ToString())) { Directory.CreateDirectory(dir.ToString()); } if (!Directory.Exists(dir2.ToString())) { Directory.CreateDirectory(dir2.ToString()); } foreach (Round t in c.rounds) { if (!Directory.Exists(dir + "\\" + t.name)) { Directory.CreateDirectory(dir + "\\" + t.name); } if (!Directory.Exists(dir2 + "\\" + t.name)) { Directory.CreateDirectory(dir2 + "\\" + t.name); } StringBuilder output = new StringBuilder(); output.Append("<p>").Append(t.name).Append("</p><p>"); foreach (Club cl in t.clubs) { CityClub cv = cl as CityClub; if (cv != null) { output.Append("").Append(cl.name).Append(" - ").Append(cl.formationFacilities).Append(" - ") .Append(cv.budget).Append(" €<br>"); } } output.Append("</p>"); if (t as ChampionshipRound != null) { ChampionshipRound tc = t as ChampionshipRound; output.Append("<table>"); foreach (Club club in tc.Ranking()) { output.Append("<tr><td>").Append(club.name).Append("</td><td>").Append(tc.Points(club)) .Append("</td><td>").Append(tc.Played(club)).Append("</td><td>").Append(tc.Wins(club)) .Append("</td><td>").Append(tc.Draws(club)).Append("</td><td>").Append(tc.Loses(club)) .Append("</td><td>").Append(tc.GoalsFor(club)).Append("</td><td>") .Append(tc.GoalsAgainst(club)).Append("</td><td>").Append(tc.Difference(club)) .Append("</td></tr>"); } output.Append("</table>"); int matchsJournee = (tc.clubs.Count % 2 == 1) ? tc.clubs.Count / 2 + 1 : tc.clubs.Count / 2; int nbJournees = (tc.matches.Count / tc.clubs.Count) * 2; int k = 0; Exporteurs2.ExporterClassementL(tc, "Output\\" + c.shortName + Session.Instance.Game.date.Year + "\\" + t.name + "\\Matchs\\"); for (int i = 0; i < nbJournees; i++) { List <Match> journee = new List <Match>(); for (int j = 0; j < matchsJournee; j++) { journee.Add(tc.matches[i * matchsJournee + j]); } journee.Sort(new MatchDateComparator()); Exporteurs2.ExporterL(journee, "Output\\" + c.shortName + Session.Instance.Game.date.Year + "\\" + t.name, i + 1); output.Append("<p>Journée ").Append((i + 1)).Append("</p><table>"); DateTime last = new DateTime(2000, 1, 1); foreach (Match m in journee) { if (m.day.Date != last.Date) { output.Append("<tr><td colspan=\"3\">").Append(m.day.Date.ToShortDateString()) .Append("</td></tr>"); } last = m.day; output.Append("<tr><td>").Append(m.day.ToShortTimeString()).Append("</td><td>") .Append(m.home.name).Append("</td><td><a href=\"").Append(tc.name).Append("\\") .Append(k).Append(".html\">").Append(m.score1).Append("-").Append(m.score2) .Append("</a></td><td>").Append(m.away.name).Append("</td></tr>"); EcrireMatch(m, dir + "\\" + tc.name + "\\" + k + ".html"); k++; } output.Append("</table>"); } } if (t as KnockoutRound != null) { KnockoutRound te = t as KnockoutRound; output.Append("<table>"); int k = 0; List <Match> matchs = new List <Match>(te.matches); matchs.Sort(new MatchDateComparator()); DateTime last = new DateTime(2000, 1, 1); Exporteurs2.ExporterD(matchs, dir + "\\" + te.name + "\\"); foreach (Match m in matchs) { if (m.day.Date != last.Date) { output.Append("<tr><td colspan=\"3\">").Append(m.day.Date.ToShortDateString()) .Append("</td></tr>"); } last = m.day; Tournament compDom = m.home.Championship; Tournament compExt = m.away.Championship; string sCompDom = ""; string sCompExt = ""; if (compDom != null) { sCompDom = " (" + compDom.shortName + ")"; } if (compExt != null) { sCompExt = " (" + compExt.shortName + ")"; } string score = m.score1 + " - " + m.score2; if (m.prolongations) { score += " ap"; } if (m.PenaltyShootout) { score += " (" + m.penaltyShootout1 + "-" + m.penaltyShootout2 + " tab)"; } output.Append("<tr><td>").Append(m.day.ToShortTimeString()).Append("</td><td>") .Append(m.home.name).Append(sCompDom).Append("</td><td><a href=\"").Append(te.name) .Append("\\").Append(k).Append(".html\">").Append(score).Append("</a></td><td>") .Append(m.away.name).Append(sCompExt).Append("</td></tr>"); EcrireMatch(m, dir + "\\" + te.name + "\\" + k + ".html"); k++; } } if (t as InactiveRound != null) { InactiveRound ti = t as InactiveRound; output.Append("<p><b>Clubs participants</b></p>"); List <Club> clubs = new List <Club>(ti.clubs); foreach (Club club in clubs) { output.Append("<p>").Append(club.name).Append("</p>"); } } if (t as GroupsRound != null) { GroupsRound tp = t as GroupsRound; int nbEquipesParPoules = 0; foreach (List <Club> poules in tp.groups) { if (nbEquipesParPoules < poules.Count) { nbEquipesParPoules = poules.Count; } List <Club> classement = new List <Club>(poules); classement.Sort(new ClubRankingComparator(t.matches)); output.Append("<p>Groupe</p><table>"); foreach (Club club in classement) { output.Append("<tr><td>").Append(club.name).Append("</td><td>").Append(t.Points(club)) .Append("</td><td>").Append(t.Played(club)).Append("</td><td>").Append(t.Wins(club)) .Append("</td><td>").Append(t.Draws(club)).Append("</td><td>").Append(t.Loses(club)) .Append("</td><td>").Append(t.GoalsFor(club)).Append("</td><td>") .Append(t.GoalsAgainst(club)).Append("</td><td>").Append(t.Difference(club)) .Append("</td></tr>"); } output.Append("</table>"); } int nbJournees = nbEquipesParPoules - 1; if (t.twoLegs) { nbJournees *= 2; } int matchsJournee = t.matches.Count / nbJournees; int k = 0; for (int i = 0; i < nbJournees; i++) { List <Match> journee = new List <Match>(); for (int j = 0; j < matchsJournee; j++) { journee.Add(t.matches[i * matchsJournee + j]); } journee.Sort(new MatchDateComparator()); output.Append("<p>Journée ").Append((int)(i + 1)).Append("</p><table>"); foreach (Match m in journee) { output.Append("<tr><td>").Append(m.day.ToString()).Append("</td><td>").Append(m.home.name) .Append("</td><td><a href=\"").Append(t.name).Append("\\").Append(k).Append(".html\">") .Append(m.score1).Append("-").Append(m.score2).Append("</a></td><td>") .Append(m.away.name).Append("</td></tr>"); EcrireMatch(m, dir + "\\" + t.name + "\\" + k + ".html"); k++; } output.Append("</table>"); } } output.Append("<p>Moyenne de buts : ").Append(t.GoalsAverage()).Append("</p><p>Buteurs</p><table>"); foreach (KeyValuePair <Player, int> j in t.GoalScorers()) { output.Append("<tr><td>").Append(j.Key.firstName).Append(" ").Append(j.Key.lastName) .Append("</td><td>").Append(j.Value).Append("</td></tr>"); } output.Append("</table>"); File.WriteAllText(dir + "\\" + t.name + ".html", output.ToString()); } }
public Windows_Club(CityClub c) { InitializeComponent(); imgBudget.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "\\" + Utils.imagesFolderName + "\\budget.png")); imgCurrentBudget.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "\\" + Utils.imagesFolderName + "\\budget.png")); imgBtnQuitter.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "\\" + Utils.imagesFolderName + "\\return.png")); imgManager.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "\\" + Utils.imagesFolderName + "\\manager.png")); _club = c; lbClub.Content = c.name; if (c.manager != null) { lbEntraineur.Content = c.manager.ToString(); } else { lbEntraineur.Content = FindResource("str_noManager").ToString(); } lbBudget.Content = Utils.FormatMoney(c.budget); lbCurrentBudget.Content = Utils.FormatMoney(c.budget); try { imgLogo.Source = new BitmapImage(new Uri(Utils.Logo(c))); } catch (Exception e) { Utils.Debug(e.ToString()); } Palmares(c); FillGames(); FillBudget(); List <Player> newContracts = new List <Player>(); foreach (Contract ct in c.allContracts) { if ((ct.beginning.Year == Session.Instance.Game.date.Year - 1 && ct.beginning.Month < 7) || (ct.beginning.Year == Session.Instance.Game.date.Year && ct.beginning.Month >= 7)) { newContracts.Add(ct.player); } } /*TODO * ViewPlayers viewNewPlayers = new ViewPlayers(newContracts, 11, false, false, false, true, false, false, false, false, false, true, false, false, false, false, false, false, false); * viewNewPlayers.Full(spArrivees); */ ViewPlayers viewPlayers = new ViewPlayers(c.Players(), 12, true, true, true, true, true, false, false, true, false, true, false, false, false, false, false, true, true, true); viewPlayers.Full(spPlayers); List <HistoriqueClubElement> lhce = new List <HistoriqueClubElement>(); foreach (Tournament competition in Session.Instance.Game.kernel.Competitions) { foreach (KeyValuePair <int, Tournament> ancienne in competition.previousEditions) { if (ancienne.Value.isChampionship && ancienne.Value.rounds[0].clubs.Contains(c)) { int classement = 0; //Si la compétition était active (tour 0 un tour de type championnat, pas inactif) if ((ancienne.Value.rounds[0] as ChampionshipRound) != null) { classement = (ancienne.Value.rounds[0] as ChampionshipRound).Ranking().IndexOf(c) + 1; } else if ((ancienne.Value.rounds[0] as GroupsRound) != null) { GroupsRound rnd = (ancienne.Value.rounds[0] as GroupsRound); for (int j = 0; j < rnd.groupsCount; j++) { if (rnd.groups[j].Contains(c)) { classement = rnd.Ranking(j).IndexOf(c); } } } lhce.Add(new HistoriqueClubElement { Competition = ancienne.Value, Classement = classement, Annee = ancienne.Key }); } } } lhce.Sort(new HistoriqueClubComparator()); foreach (HistoriqueClubElement hce in lhce) { StackPanel spHistoryEntry = new StackPanel(); spHistoryEntry.Orientation = Orientation.Horizontal; spHistoryEntry.Children.Add(ViewUtils.CreateLabelOpenWindow <Tournament>(hce.Competition, OpenTournament, hce.Annee.ToString(), "StyleLabel2", 11, 75)); spHistoryEntry.Children.Add(ViewUtils.CreateLabelOpenWindow <Tournament>(hce.Competition, OpenTournament, hce.Competition.name, "StyleLabel2", 11, 125)); spHistoryEntry.Children.Add(ViewUtils.CreateLabel(hce.Classement.ToString(), "StyleLabel2", 11, 50)); spHistory.Children.Add(spHistoryEntry); } ChartValues <int> budgets = new ChartValues <int>(); ChartValues <int> centreFormation = new ChartValues <int>(); ChartValues <int> attendance = new ChartValues <int>(); foreach (HistoricEntry eh in c.history.elements) { budgets.Add(eh.budget); centreFormation.Add(eh.formationFacilities); attendance.Add(eh.averageAttendance); } BudgetsCollection = new SeriesCollection { new LineSeries { Title = FindResource("str_budget").ToString(), Values = budgets, } }; //Formation facilities CFCollection = new SeriesCollection { new LineSeries { Title = FindResource("str_level").ToString(), Values = centreFormation, } }; //Average attendance AttendanceCollection = new SeriesCollection { new LineSeries { Title = FindResource("str_averageAttendance").ToString(), Values = attendance, } }; LabelsAnnees = new string[c.history.elements.Count]; int i = 0; foreach (HistoricEntry eh in c.history.elements) { LabelsAnnees[i] = c.history.elements[i].date.Year.ToString(); i++; } YFormatter = value => value.ToString("C"); DataContext = this; if (c.records.BiggestWin != null) { lbBiggestWin.Content = c.records.BiggestWin.home.name + " " + c.records.BiggestWin.score1 + " - " + c.records.BiggestWin.score2 + " " + c.records.BiggestWin.away.name; } if (c.records.BiggestLose != null) { lbBiggestLose.Content = c.records.BiggestLose.home.name + " " + c.records.BiggestLose.score1 + " - " + c.records.BiggestLose.score2 + " " + c.records.BiggestLose.away.name; } }