/// <summary> /// Initialize the scoreboard. /// </summary> public void InitScoreBoard() { if (ServiceManager.Theater == null) { return; } Statistics[] stats = ServiceManager.Theater.GetScoreboard(); GameSession.ScoreboardTotals totals = new GameSession.ScoreboardTotals(); if (mode == GameMode.CAPTURETHEFLAG) { totals = ServiceManager.Theater.GetTeamStats(); } if (team1 != null) { team1.Clear(); } if (team2 != null) { team2.Clear(); } foreach (Statistics stat in stats) { PlayerTank tank = players.GetPlayerByName(stat.tankName); if (tank != null) { if (tank.Team == GameSession.Alliance.RED && !team1.ContainsKey(stat.tankName)) { team1.Add(stat.tankName, new Score(Color.Red, stat)); team1stats.kills += stat.kills; team1stats.assists += stat.assists; team1stats.deaths += stat.deaths; team1stats.objectives += stat.objectivesCaptured; team1stats.roundWins += stat.objectivesCompleted; } else if (tank.Team == GameSession.Alliance.BLUE && !team2.ContainsKey(stat.tankName)) { team2.Add(stat.tankName, new Score(customBlue, stat)); team2stats.kills += stat.kills; team2stats.assists += stat.assists; team2stats.deaths += stat.deaths; team2stats.objectives += stat.objectivesCaptured; team2stats.roundWins += stat.objectivesCompleted; } else if (tank.Team == GameSession.Alliance.NONE && !team1.ContainsKey(stat.tankName)) { team1.Add(stat.tankName, new Score(neutralTeamColor, stat)); } } } if (totals != null) { team1stats.kills = totals.killsBlue; team1stats.objectives = totals.capturesBlue; team2stats.kills = totals.killsRed; team2stats.objectives = totals.capturesRed; } }
/// <summary> /// Initialize the scoreboard. /// </summary> public void InitScoreBoard() { if (ServiceManager.Theater == null) return; Statistics[] stats = ServiceManager.Theater.GetScoreboard(); GameSession.ScoreboardTotals totals = new GameSession.ScoreboardTotals(); if (mode == GameMode.CAPTURETHEFLAG) totals = ServiceManager.Theater.GetTeamStats(); if (team1 != null) team1.Clear(); if (team2 != null) team2.Clear(); foreach (Statistics stat in stats) { PlayerTank tank = players.GetPlayerByName(stat.tankName); if (tank != null) { if (tank.Team == GameSession.Alliance.RED && !team1.ContainsKey(stat.tankName)) { team1.Add(stat.tankName, new Score(Color.Red, stat)); team1stats.kills += stat.kills; team1stats.assists += stat.assists; team1stats.deaths += stat.deaths; team1stats.objectives += stat.objectivesCaptured; team1stats.roundWins += stat.objectivesCompleted; } else if (tank.Team == GameSession.Alliance.BLUE && !team2.ContainsKey(stat.tankName)) { team2.Add(stat.tankName, new Score(customBlue, stat)); team2stats.kills += stat.kills; team2stats.assists += stat.assists; team2stats.deaths += stat.deaths; team2stats.objectives += stat.objectivesCaptured; team2stats.roundWins += stat.objectivesCompleted; } else if (tank.Team == GameSession.Alliance.NONE && !team1.ContainsKey(stat.tankName)) { team1.Add(stat.tankName, new Score(neutralTeamColor, stat)); } } } if (totals != null) { team1stats.kills = totals.killsBlue; team1stats.objectives = totals.capturesBlue; team2stats.kills = totals.killsRed; team2stats.objectives = totals.capturesRed; } }