if (new File("./sharedDirectory/Polytris/username.txt").exists()) {
username = StaticMethods.liesTextArray(new File("./sharedDirectory/Polytris/username.txt"), params, true).get(0);
}
GeneralDialog dia0 = new GeneralDialog(
null,
null,
"Enter your name for score " + umg.getScore(),
new String[] {"Store"},
username,
30,
50,
true);
dia0.setLocationRelativeTo(null);
dia0.setVisible(true);
if (umg.getScorez().isHighscore(umg.getScore())) {
umg.addHighscore(umg.getScore(), dia0.getText(), params.getParValueInt("Polytris.Level"));
}
boolean isExtreme = false;
String extreme = ".";
if (params.getParValueBoolean("Polytris.Ultimate")) {
extreme = " Extreme!";
isExtreme = true;
}
List<Score> globalScorez = ScoreoidApi.addScore((int) umg.getScore(), dia0.getText(), level, isExtreme);
List<String> globalScorezString = ScoreoidApi.convertList(globalScorez, umg.getScore(), username, level, isExtreme);
StaticMethods.speichereTextDatei("./sharedDirectory/Polytris", "username.txt", dia0.getText(), params);
if (globalScorez != null) {
GeneralDialog diaGlobalScore = new GeneralDialog(
null,
null,
"Global highscorez -- Your score: " + umg.getScore(),
new String[] {"Close"},
globalScorezString.toString().replace("]", "").replace("[", "").replace(", ", "\n")
+ "\n\nThank you for playing Lhuk's Polytris" + extreme,
15,
50,
false);
diaGlobalScore.setLocationRelativeTo(null);
diaGlobalScore.setVisible(true);
} else {
GeneralDialog diaGlobalScore = new GeneralDialog(
null,
"The server is not available, global scores were not submitted.",
"Server not available.",
new String[] {"Close"},
null,
15,
50,
false);
diaGlobalScore.setLocationRelativeTo(null);
diaGlobalScore.setVisible(true);
GeneralDialog diaLocalScore = new GeneralDialog(
null,
null,
"Local highscorez -- Your score: " + umg.getScore(),
new String[] {"Close"},
umg.getScorez().toString() + "\n\nThank you for playing Lhuk's Polytris" + extreme,
15,
50,
false);
diaLocalScore.setLocationRelativeTo(null);
diaLocalScore.setVisible(true);
}
System.exit(0);
}