public void RemovePlayer(long playerId) { if (_dictPlayers.ContainsKey(playerId)) { IPlayerInfo player = _dictPlayers[playerId]; _dictPlayers.Remove(playerId); _dictLeavedPlayers.Add(playerId, player); if (_dictTeams.ContainsKey(player.TeamId)) { ITeamInfo team = _dictTeams[player.TeamId]; team.PlayerCount--; team.TotalRankScore -= player.RankScore; team.AvgRankScore = team.PlayerCount > 0 ? (float)team.TotalRankScore / team.PlayerCount : 0; } } }
public void RemovePlayer(long playerId) { if (_dictPlayers.ContainsKey(playerId)) { IPlayerInfo player = _dictPlayers[playerId]; _dictPlayers.Remove(playerId); _dictLeavedPlayers.Add(playerId, player); if (_dictTeams.ContainsKey(player.TeamId)) { ITeamInfo team = _dictTeams[player.TeamId]; team.PlayerCount--; team.TotalRankScore -= player.RankScore; team.AvgRankScore = team.PlayerCount > 0 ? (float)team.TotalRankScore / team.PlayerCount : 0; } _logger.InfoFormat("player {0} {1} left hall room", player.PlayerId, player.PlayerName); } }