private void cbTeamRoster_SelectedIndexChanged(object sender, EventArgs e) { League selectedLeague = World.Leagues[cbLeagues.SelectedIndex]; Team selectedTeam = selectedLeague.TeamList[cbTeamList.SelectedIndex]; Player selectedPlayer = selectedTeam.Roster[cbTeamRoster.SelectedIndex]; lblDepthChart.Text = "Spot on Depth Chart: " + selectedPlayer.DepthChart.ToString(); if (selectedPlayer.IsStarter) { lblStarter.Text = "Starter: yes"; } else { lblStarter.Text = "Starter: no"; } if (selectedLeague.Sport == Sports.Basketball) { List <BasketballPlayer> hoopsRoster = new List <BasketballPlayer>(); foreach (BasketballPlayer bp in selectedTeam.Roster) { hoopsRoster.Add(bp); } DisplayBasketballStats(hoopsRoster[cbTeamRoster.SelectedIndex]); } else if (selectedLeague.Sport == Sports.Football) { List <FootballPlayer> footballRoster = new List <FootballPlayer>(); foreach (FootballPlayer fp in selectedTeam.Roster) { footballRoster.Add(fp); } DisplayFootballStats(footballRoster[cbTeamRoster.SelectedIndex]); } else if (selectedLeague.Sport == Sports.Baseball) { List <BaseballPlayer> baseballRoster = new List <BaseballPlayer>(); foreach (BaseballPlayer p in selectedTeam.Roster) { baseballRoster.Add(p); } DisplayBaseballStats(baseballRoster[cbTeamRoster.SelectedIndex]); } else if (selectedLeague.Sport == Sports.Hockey) { List <HockeyPlayer> hockeyRoster = new List <HockeyPlayer>(); foreach (HockeyPlayer p in selectedTeam.Roster) { hockeyRoster.Add(p); } DisplayHockeyStats(hockeyRoster[cbTeamRoster.SelectedIndex]); } else if (selectedLeague.Sport == Sports.Soccer) { List <SoccerPlayer> soccerRoster = new List <SoccerPlayer>(); foreach (SoccerPlayer p in selectedTeam.Roster) { soccerRoster.Add(p); } DisplaySoccerStats(soccerRoster[cbTeamRoster.SelectedIndex]); } if (selectedPlayer.Sport == Sports.Baseball) { BaseballPlayer baseballPlayer = (BaseballPlayer)selectedPlayer; lblPosition.Text = "Position: " + baseballPlayer.Position.ToString(); } else if (selectedPlayer.Sport == Sports.Basketball) { BasketballPlayer basketballPlayer = (BasketballPlayer)selectedPlayer; lblPosition.Text = "Position: " + basketballPlayer.Position.ToString(); } else if (selectedPlayer.Sport == Sports.Football) { FootballPlayer footballPlayer = (FootballPlayer)selectedPlayer; lblPosition.Text = "Position: " + footballPlayer.Position.ToString(); } else if (selectedPlayer.Sport == Sports.Hockey) { HockeyPlayer hockeyPlayer = (HockeyPlayer)selectedPlayer; lblPosition.Text = "Position: " + hockeyPlayer.Position.ToString(); } else if (selectedPlayer.Sport == Sports.Soccer) { SoccerPlayer soccerPlayer = (SoccerPlayer)selectedPlayer; lblPosition.Text = "Position: " + soccerPlayer.Position.ToString(); } lblFullName.Text = selectedPlayer.FullName; lblAge.Text = "Age: " + selectedPlayer.Age.ToString(); lblSkillLevel.Text = "Skill Level: " + selectedPlayer.CurrentSkill.ToString() + "/" + selectedPlayer.PotentialSkill.ToString(); lblYearlySalary.Text = "Yearly Salary: " + selectedPlayer.Contract.YearlySalary.ToString("C0"); lblYearsLeft.Text = "Years Left: " + selectedPlayer.Contract.Years.ToString(); lblAgentPaid.Text = "Agent Paid: " + selectedPlayer.Contract.AgentPaySchedule.ToString(); lblAgentPercent.Text = "Agent Percentage: " + selectedPlayer.Contract.AgentPercentage.ToString() + "%"; lblPopularity.Text = "Popularity: " + selectedPlayer.PopularityString; lblGreed.Text = "Greed: " + selectedPlayer.Greed.ToString(); lblLifestyle.Text = "Lifestyle: " + selectedPlayer.Lifestyle.ToString(); lblLoyalty.Text = "Loyalty: " + selectedPlayer.Loyalty.ToString(); lblPlayForTitle.Text = "Play for Title: " + selectedPlayer.PlayForTitleContender.ToString(); lblTeamHappiness.Text = "Team Happiness: " + selectedPlayer.TeamHappinessString; lblAgencyHappiness.Text = "Agency Happiness: " + selectedPlayer.AgencyHappinessString; }
private void FillFootballLists(League l) { AFC.Clear(); NFC.Clear(); AFCEast.Clear(); NFCEast.Clear(); AFCNorth.Clear(); NFCNorth.Clear(); AFCSouth.Clear(); NFCSouth.Clear(); AFCWest.Clear(); NFCWest.Clear(); foreach (Team t in l.TeamList) { if (t.Conference == "AFC") { AFC.Add(t); if (t.Division == "East") { AFCEast.Add(t); } else if (t.Division == "North") { AFCNorth.Add(t); } else if (t.Division == "South") { AFCSouth.Add(t); } else if (t.Division == "West") { AFCWest.Add(t); } } else if (t.Conference == "NFC") { NFC.Add(t); if (t.Division == "East") { NFCEast.Add(t); } else if (t.Division == "North") { NFCNorth.Add(t); } else if (t.Division == "South") { NFCSouth.Add(t); } else if (t.Division == "West") { NFCWest.Add(t); } } } FootballConferencesAndDivisions.Add(AFC); FootballConferencesAndDivisions.Add(NFC); FootballConferencesAndDivisions.Add(AFCEast); FootballConferencesAndDivisions.Add(AFCNorth); FootballConferencesAndDivisions.Add(AFCSouth); FootballConferencesAndDivisions.Add(AFCWest); FootballConferencesAndDivisions.Add(NFCEast); FootballConferencesAndDivisions.Add(NFCNorth); FootballConferencesAndDivisions.Add(NFCSouth); FootballConferencesAndDivisions.Add(NFCWest); }
private void DisplayHockeyStandings(League l) { EasternConference.Clear(); WesternConference.Clear(); AtlanticDivision.Clear(); CentralDivision.Clear(); MetropolitanDivision.Clear(); PacificDivision.Clear(); foreach (Team t in l.TeamList) { if (t.Conference == "Eastern") { EasternConference.Add(t); if (t.Division == "Atlantic") { AtlanticDivision.Add(t); } else { MetropolitanDivision.Add(t); } } else { WesternConference.Add(t); if (t.Division == "Pacific") { PacificDivision.Add(t); } else { CentralDivision.Add(t); } } } EasternConference = EasternConference.OrderByDescending(o => o.Points).ThenByDescending(o => o.Wins).ToList(); WesternConference = WesternConference.OrderByDescending(o => o.Points).ThenByDescending(o => o.Wins).ToList(); AtlanticDivision = AtlanticDivision.OrderByDescending(o => o.Points).ThenByDescending(o => o.Wins).ToList(); MetropolitanDivision = MetropolitanDivision.OrderByDescending(o => o.Points).ThenBy(o => o.Wins).ToList(); CentralDivision = CentralDivision.OrderByDescending(o => o.Points).ThenByDescending(o => o.Wins).ToList(); PacificDivision = PacificDivision.OrderByDescending(o => o.Points).ThenByDescending(o => o.Wins).ToList(); lblEastConference.Text = "Eastern Conference Standings:"; lblWestConference.Text = "Western Conference Standings:"; lblEastDivision1.Text = "Atlantic Divisions Standings:"; lblEastDivision2.Text = ""; lblEastDivision3.Text = "Metropolitan Division Standings:"; lblEastDivision4.Text = ""; lblWestDivision1.Text = "Central Division Standings:"; lblWestDivision2.Text = ""; lblWestDivision3.Text = "Pacific Division Standings:"; lblWestDivision4.Text = ""; for (int i = 0; i < WesternConference.Count; i++) { lblEastConference.Text += Environment.NewLine + EasternConference[i].Abbreviation + ": " + EasternConference[i].Points + " points (" + EasternConference[i].Wins + "-" + EasternConference[i].Losses + "-" + EasternConference[i].OTLosses + ")"; lblWestConference.Text += Environment.NewLine + WesternConference[i].Abbreviation + ": " + WesternConference[i].Points + " points (" + WesternConference[i].Wins + "-" + WesternConference[i].Losses + "-" + WesternConference[i].OTLosses + ")"; } lblEastConference.Text += Environment.NewLine + EasternConference[15].Abbreviation + ": " + EasternConference[15].Points + " point (" + EasternConference[15].Wins + "-" + EasternConference[15].Losses + "-" + EasternConference[15].OTLosses + ")"; for (int j = 0; j < AtlanticDivision.Count; j++) { lblEastDivision1.Text += Environment.NewLine + AtlanticDivision[j].Abbreviation + ": " + AtlanticDivision[j].Points + " points (" + AtlanticDivision[j].Wins + "-" + AtlanticDivision[j].Losses + "-" + AtlanticDivision[j].OTLosses + ")"; //lblEastDivision2.Text += Environment.NewLine + CentralDivision[j].Abbreviation + " " + CentralDivision[j].Wins + "W - " + CentralDivision[j].Losses + "L"; lblEastDivision3.Text += Environment.NewLine + MetropolitanDivision[j].Abbreviation + ": " + MetropolitanDivision[j].Points + " points (" + MetropolitanDivision[j].Wins + "-" + MetropolitanDivision[j].Losses + "-" + MetropolitanDivision[j].OTLosses + ")"; //lblWestDivision2.Text += Environment.NewLine + SouthwestDivision[j].Abbreviation + " " + SouthwestDivision[j].Wins + "W - " + SouthwestDivision[j].Losses + "L"; lblWestDivision3.Text += Environment.NewLine + PacificDivision[j].Abbreviation + ": " + PacificDivision[j].Points + " points (" + PacificDivision[j].Wins + "-" + PacificDivision[j].Losses + "-" + PacificDivision[j].OTLosses + ")"; } for (int x = 0; x < CentralDivision.Count; x++) { lblWestDivision1.Text += Environment.NewLine + CentralDivision[x].Abbreviation + ": " + CentralDivision[x].Points + " points (" + CentralDivision[x].Wins + "-" + CentralDivision[x].Losses + "-" + CentralDivision[x].OTLosses + ")"; } }
private void DisplayBaseballStandings(League l) { AmericanLeague.Clear(); NationalLeague.Clear(); ALEast.Clear(); ALCentral.Clear(); ALWest.Clear(); NLEast.Clear(); NLCentral.Clear(); NLWest.Clear(); foreach (Team t in l.TeamList) { if (t.Conference == "AL") { AmericanLeague.Add(t); if (t.Division == "East") { ALEast.Add(t); } else if (t.Division == "Central") { ALCentral.Add(t); } else { ALWest.Add(t); } } else { NationalLeague.Add(t); if (t.Division == "East") { NLEast.Add(t); } else if (t.Division == "Central") { NLCentral.Add(t); } else { NLWest.Add(t); } } } AmericanLeague = AmericanLeague.OrderByDescending(o => o.Wins).ThenByDescending(o => o.TitleConteder).ToList(); NationalLeague = NationalLeague.OrderByDescending(o => o.Wins).ThenByDescending(o => o.TitleConteder).ToList(); ALEast = ALEast.OrderByDescending(o => o.Wins).ThenByDescending(o => o.TitleConteder).ToList(); ALCentral = ALCentral.OrderByDescending(o => o.Wins).ThenByDescending(o => o.TitleConteder).ToList(); ALWest = ALWest.OrderByDescending(o => o.Wins).ThenByDescending(o => o.TitleConteder).ToList(); NLEast = NLEast.OrderByDescending(o => o.Wins).ThenByDescending(o => o.TitleConteder).ToList(); NLCentral = NLCentral.OrderByDescending(o => o.Wins).ThenByDescending(o => o.TitleConteder).ToList(); NLWest = NLWest.OrderByDescending(o => o.Wins).ThenByDescending(o => o.TitleConteder).ToList(); lblEastConference.Text = "American League Standings:"; lblWestConference.Text = "National League Standings:"; lblEastDivision1.Text = "AL East Standings:"; lblEastDivision2.Text = "AL Central Standings:"; lblEastDivision3.Text = "AL West Standings:"; lblEastDivision4.Text = ""; lblWestDivision1.Text = "NL East Standings:"; lblWestDivision2.Text = "NL Central Standings:"; lblWestDivision3.Text = "NL West Standings:"; lblWestDivision4.Text = ""; for (int i = 0; i < AmericanLeague.Count; i++) { lblEastConference.Text += Environment.NewLine + AmericanLeague[i].Abbreviation + " " + AmericanLeague[i].Wins + "W - " + AmericanLeague[i].Losses + "L"; lblWestConference.Text += Environment.NewLine + NationalLeague[i].Abbreviation + " " + NationalLeague[i].Wins + "W - " + NationalLeague[i].Losses + "L"; } for (int j = 0; j < ALEast.Count; j++) { lblEastDivision1.Text += Environment.NewLine + ALEast[j].Abbreviation + " " + ALEast[j].Wins + "W - " + ALEast[j].Losses + "L"; lblEastDivision2.Text += Environment.NewLine + ALCentral[j].Abbreviation + " " + ALCentral[j].Wins + "W - " + ALCentral[j].Losses + "L"; lblEastDivision3.Text += Environment.NewLine + ALWest[j].Abbreviation + " " + ALWest[j].Wins + "W - " + ALWest[j].Losses + "L"; lblWestDivision1.Text += Environment.NewLine + NLEast[j].Abbreviation + " " + NLEast[j].Wins + "W - " + NLEast[j].Losses + "L"; lblWestDivision2.Text += Environment.NewLine + NLCentral[j].Abbreviation + " " + NLCentral[j].Wins + "W - " + NLCentral[j].Losses + "L"; lblWestDivision3.Text += Environment.NewLine + NLWest[j].Abbreviation + " " + NLWest[j].Wins + "W - " + NLWest[j].Losses + "L"; } }
private void DisplayBasketballStandings(League l) { EasternConference.Clear(); WesternConference.Clear(); AtlanticDivision.Clear(); CentralDivision.Clear(); SoutheastDivision.Clear(); NorthwestDivision.Clear(); SouthwestDivision.Clear(); PacificDivision.Clear(); foreach (Team t in l.TeamList) { if (t.Conference == "Eastern") { EasternConference.Add(t); } else { WesternConference.Add(t); } if (t.Division == "Atlantic") { AtlanticDivision.Add(t); } else if (t.Division == "Central") { CentralDivision.Add(t); } else if (t.Division == "Southeast") { SoutheastDivision.Add(t); } else if (t.Division == "Northwest") { NorthwestDivision.Add(t); } else if (t.Division == "Southwest") { SouthwestDivision.Add(t); } else if (t.Division == "Pacific") { PacificDivision.Add(t); } } EasternConference = EasternConference.OrderByDescending(o => o.Wins).ThenByDescending(o => o.TitleConteder).ToList(); WesternConference = WesternConference.OrderByDescending(o => o.Wins).ThenByDescending(o => o.TitleConteder).ToList(); AtlanticDivision = AtlanticDivision.OrderByDescending(o => o.Wins).ThenByDescending(o => o.TitleConteder).ToList(); CentralDivision = CentralDivision.OrderByDescending(o => o.Wins).ThenByDescending(o => o.TitleConteder).ToList(); SoutheastDivision = SoutheastDivision.OrderByDescending(o => o.Wins).ThenByDescending(o => o.TitleConteder).ToList(); NorthwestDivision = NorthwestDivision.OrderByDescending(o => o.Wins).ThenByDescending(o => o.TitleConteder).ToList(); SouthwestDivision = SouthwestDivision.OrderByDescending(o => o.Wins).ThenByDescending(o => o.TitleConteder).ToList(); PacificDivision = PacificDivision.OrderByDescending(o => o.Wins).ThenByDescending(o => o.TitleConteder).ToList(); lblEastConference.Text = "Eastern Conference Standings:"; lblWestConference.Text = "Western Conference Standings:"; lblEastDivision1.Text = "Atlantic Divisions Standings:"; lblEastDivision2.Text = "Central Division Standings:"; lblEastDivision3.Text = "Southeast Division Standings:"; lblEastDivision4.Text = ""; lblWestDivision1.Text = "Northwest Division Standings:"; lblWestDivision2.Text = "Southwest Division Standings:"; lblWestDivision3.Text = "Pacific Division Standings:"; lblWestDivision4.Text = ""; for (int i = 0; i < EasternConference.Count; i++) { lblEastConference.Text += Environment.NewLine + EasternConference[i].Abbreviation + " " + EasternConference[i].Wins + "W - " + EasternConference[i].Losses + "L"; lblWestConference.Text += Environment.NewLine + WesternConference[i].Abbreviation + " " + WesternConference[i].Wins + "W - " + WesternConference[i].Losses + "L"; } for (int j = 0; j < AtlanticDivision.Count; j++) { lblEastDivision1.Text += Environment.NewLine + AtlanticDivision[j].Abbreviation + " " + AtlanticDivision[j].Wins + "W - " + AtlanticDivision[j].Losses + "L"; lblEastDivision2.Text += Environment.NewLine + CentralDivision[j].Abbreviation + " " + CentralDivision[j].Wins + "W - " + CentralDivision[j].Losses + "L"; lblEastDivision3.Text += Environment.NewLine + SoutheastDivision[j].Abbreviation + " " + SoutheastDivision[j].Wins + "W - " + SoutheastDivision[j].Losses + "L"; lblWestDivision1.Text += Environment.NewLine + NorthwestDivision[j].Abbreviation + " " + NorthwestDivision[j].Wins + "W - " + NorthwestDivision[j].Losses + "L"; lblWestDivision2.Text += Environment.NewLine + SouthwestDivision[j].Abbreviation + " " + SouthwestDivision[j].Wins + "W - " + SouthwestDivision[j].Losses + "L"; lblWestDivision3.Text += Environment.NewLine + PacificDivision[j].Abbreviation + " " + PacificDivision[j].Wins + "W - " + PacificDivision[j].Losses + "L"; } }