private void RoundEnd() { // Determine the winner of the round DemoInfo.Team winningTeam = Team.Spectate; if (lastTScore != parser.TScore) { winningTeam = Team.Terrorist; } else if (lastCTScore != parser.CTScore) { winningTeam = Team.CounterTerrorist; } this.currentRound.Winner = winningTeam; // Reset in-progres stats tracking lastTScore = parser.TScore; lastCTScore = parser.CTScore; // Record the current round this.results.Rounds.Add(this.currentRoundNumber, this.currentRound); Debug.WriteLine("End round " + this.currentRound.RoundNumber + ". Winner: " + this.currentRound.Winner); Debug.WriteLine(String.Format("Round {0}: T {1} | CT {2} - Winner: {3}.", this.currentRound.RoundNumber, parser.TScore, parser.CTScore, this.currentRound.Winner)); if (this.currentRound.bombPlanter != null) { Debug.WriteLine(String.Format("Bomb planted by {0}", this.currentRound.bombPlanter.Name)); } if (this.currentRound.bombDefuser != null) { Debug.WriteLine(String.Format("Bomb defused by {0}", this.currentRound.bombDefuser.Name)); } }
private PlayerStats AddPlayer(Player player, DemoInfo.Team teamEnum) { var team = GetTeam(teamEnum); var stats = new PlayerStats(player); team.Players.Add(stats); return(stats); }
private Team GetTeam(DemoInfo.Team team) { var teams = _Match.Teams; var output = teams.FirstOrDefault(t => t.TeamEnum == team); if (output == null) { output = new Team { TeamEnum = team }; teams.Add(output); } return(output); }