public SimulationFinished( Resources res, double totalVehicleTravelTime, double totalVehicleTravelDistance, double totalVehicleFuelUsedLiters, String formatedSimulationDuration, double simulationTime, MovSimDroidActivity movSimDroidActivity) { final StringBuffer message = new StringBuffer(res.getString(R.string.simulation_finished_in)) .append(String.format(Locale.US, "%.1f", simulationTime)) .append(res.getString(R.string.total_travel_time)) .append(FormatUtil.getFormatedTime(totalVehicleTravelTime)) .append(res.getString(R.string.total_travel_distance)) .append(String.format("%.3f", totalVehicleTravelDistance)) .append(res.getString(R.string.total_fuel_used)) .append(String.format("%.1f", totalVehicleFuelUsedLiters)); StringBuilder gamePerformanceMessage = new StringBuilder(""); if (isGame()) { String projectName = ProjectMetaData.getInstance().getProjectName(); if (projectName.equals("routing")) { if (simulationTime < 260) { gamePerformanceMessage.append(res.getStringArray(R.array.highscoreRouting)[0]); } else if (simulationTime < 285) { gamePerformanceMessage.append(res.getStringArray(R.array.highscoreRouting)[1]); } else if (simulationTime < 315) { gamePerformanceMessage.append(res.getStringArray(R.array.highscoreRouting)[2]); } else if (simulationTime < 360) { gamePerformanceMessage.append(res.getStringArray(R.array.highscoreRouting)[3]); } else { gamePerformanceMessage.append(res.getStringArray(R.array.highscoreRouting)[4]); } } else if (projectName.equals("ramp_metering")) { if (simulationTime < 280) { gamePerformanceMessage.append(res.getStringArray(R.array.highscoreRampMetring)[0]); } else if (simulationTime < 290) { gamePerformanceMessage.append(res.getStringArray(R.array.highscoreRampMetring)[1]); } else if (simulationTime < 300) { gamePerformanceMessage.append(res.getStringArray(R.array.highscoreRampMetring)[2]); } else if (simulationTime < 310) { gamePerformanceMessage.append(res.getStringArray(R.array.highscoreRampMetring)[3]); } else { gamePerformanceMessage.append(res.getStringArray(R.array.highscoreRampMetring)[4]); } } HighscoreEntry highscoreEntry = new HighscoreEntry(); highscoreEntry.setQuantity(HighscoreEntry.Quantity.totalSimulationTime, simulationTime); highscoreEntry.setQuantity(HighscoreEntry.Quantity.totalTravelTime, totalVehicleTravelTime); highscoreEntry.setQuantity( HighscoreEntry.Quantity.totalTravelDistance, totalVehicleTravelDistance); highscoreEntry.setQuantity( HighscoreEntry.Quantity.totalFuelUsedLiters, totalVehicleFuelUsedLiters); HighScoreForGame highScoreForGame = new HighScoreForGame(movSimDroidActivity, highscoreEntry); results = highScoreForGame.getSortedResults(); Intent intent = new Intent(); intent.putExtra("message", message.toString()); intent.putExtra("highscore", gamePerformanceMessage.toString()); intent.putExtra("rank", String.valueOf(highScoreForGame.getRank())); intent.setClass(movSimDroidActivity, HighScoreView.class); movSimDroidActivity.startActivity(intent); } else { movSimDroidActivity.showInfo(message.toString()); } }