Commit 1d8a4c54 authored by Anton Danilov's avatar Anton Danilov

#43 -StatisticsScreenDialog text now depends on gameDefinition, language and...

#43 -StatisticsScreenDialog text now depends on gameDefinition, language and daily/average graphType selected
- fixed getting a font in dialog
- changed format of date in dialog
parent 222efa94
......@@ -20,6 +20,7 @@ mainmenu_panorama=Panorama
usermenu_newuser=+ Nový detektiv
gamedifficulty_name=Obtížnost:
gamedifficulty_tutorial=Cvičení
gamedifficulty_easy=Lehká
gamedifficulty_medium=Střední
......@@ -30,6 +31,13 @@ victoryscreen_button_changegame=Jinou hru
victoryscreen_text_tutorial=Gratuluji! A teď to zkus sám…
victoryscreen_new_trophy=Získáváš trofej!
game_score=Počet bodů:
game_score_error=Počet chyb:
game_score_duration=Trvání hry:
game_averagescore=Průměrný počet bodů:
game_averagescore_error=Průměrný počet chyb:
game_averagescore_duration=Průměrné trvání hry:
game_robbery_title=Lupiči
game_robbery_description=Procvičování pracovní paměti
game_kidnapping_title=Únos
......
......@@ -20,6 +20,7 @@ mainmenu_panorama=Panorama
usermenu_newuser=+ Neuer Detektiv
gamedifficulty_name=Schwierigkeitsgrad:
gamedifficulty_tutorial=Lernprogramm
gamedifficulty_easy=Leicht
gamedifficulty_medium=Mittel
......@@ -30,6 +31,13 @@ victoryscreen_button_changegame=Anderes Spiel
victoryscreen_text_tutorial=Gratulation! Und nun versuch es selbst…
victoryscreen_new_trophy=**victoryscreen_new_trophy**
game_score=Punktezahl:
game_score_error=Fehlerzahl:
game_score_duration=Spieldauer:
game_averagescore=Durchschnittliche Punktzahl:
game_averagescore_error=Durchschnittliche Fehlerzahl:
game_averagescore_duration=Durchschnittliche Spieldauer:
game_robbery_title=Einbrecher
game_robbery_description=Training des Arbeitsgedächtnisses
game_kidnapping_title=Entführung
......
......@@ -20,6 +20,7 @@ mainmenu_panorama=Panorama
usermenu_newuser=+ Nový detektív
gamedifficulty_name=Obtiažnosť:
gamedifficulty_tutorial=Cvičenie
gamedifficulty_easy=Ľahká
gamedifficulty_medium=Stredná
......@@ -30,6 +31,13 @@ victoryscreen_button_changegame=Inú hru
victoryscreen_text_tutorial=Gratulujem! A teraz to skús sám…
victoryscreen_new_trophy=Získavaš trofej!
game_score=Počet bodov:
game_score_error=Počet chýb:
game_score_duration=Trvanie hry:
game_averagescore=Priemerný počet bodov:
game_averagescore_error=Priemerný počet chýb:
game_averagescore_duration=Priemerné trvanie hry:
game_robbery_title=Lupiči
game_robbery_description=Precvičovanie pracovnej pamäti
game_kidnapping_title=Únos
......
......@@ -21,15 +21,14 @@ import cz.nic.tablexia.model.game.Game;
import cz.nic.tablexia.screen.gamemenu.GameMenuScreen;
import cz.nic.tablexia.screen.gamemenu.event.ShowGameMenuPageEvent;
public enum GameDefinition implements ApplicationEvent, IMenuItem {
ROBBERY(1, "game_robbery_title", "game_robbery_description", RobberyGame.class, false, new RobberyGame.GameResultResolver()),
PURSUIT(2, "game_pursuit_title", "game_pursuit_description", PursuitGame.class, false, new PursuitGame.GameResultResolver()),
KIDNAPPING(3, "game_kidnapping_title", "game_kidnapping_description", KidnappingGame.class, false, new KidnappingResultResolver()),
NIGHT_WATCH(4, "game_night_watch_title", "game_night_watch_description", NightWatchGame.class, false, new NightWatchGame.GameResultResolver()),
SHOOTING_RANGE(5, "game_shooting_range_title", "game_shooting_range_description", ShootingRangeGame.class, false, new ShootingRangeResultResolver()),
IN_THE_DARKNESS(6, "game_in_the_darkness_title", "game_in_the_darkness_description", InTheDarknessGame.class, true, new InTheDarknessGame.GameResultResolver());
ROBBERY(1, "game_robbery_title", "game_robbery_description", RobberyGame.class, false, new RobberyGame.GameResultResolver(), ApplicationTextManager.ApplicationTextsAssets.GAME_SCORE_ERROR, ApplicationTextManager.ApplicationTextsAssets.GAME_AVERAGE_SCORE_ERROR),
PURSUIT(2, "game_pursuit_title", "game_pursuit_description", PursuitGame.class, false, new PursuitGame.GameResultResolver(), ApplicationTextManager.ApplicationTextsAssets.GAME_SCORE_DURATION, ApplicationTextManager.ApplicationTextsAssets.GAME_AVERAGE_SCORE_DURATION),
KIDNAPPING(3, "game_kidnapping_title", "game_kidnapping_description", KidnappingGame.class, false, new KidnappingResultResolver(), ApplicationTextManager.ApplicationTextsAssets.GAME_SCORE_ERROR, ApplicationTextManager.ApplicationTextsAssets.GAME_AVERAGE_SCORE_ERROR),
NIGHT_WATCH(4, "game_night_watch_title", "game_night_watch_description", NightWatchGame.class, false, new NightWatchGame.GameResultResolver(), ApplicationTextManager.ApplicationTextsAssets.GAME_SCORE, ApplicationTextManager.ApplicationTextsAssets.GAME_AVERAGE_SCORE),
SHOOTING_RANGE(5, "game_shooting_range_title", "game_shooting_range_description", ShootingRangeGame.class, false, new ShootingRangeResultResolver(), ApplicationTextManager.ApplicationTextsAssets.GAME_SCORE, ApplicationTextManager.ApplicationTextsAssets.GAME_AVERAGE_SCORE),
IN_THE_DARKNESS(6, "game_in_the_darkness_title", "game_in_the_darkness_description", InTheDarknessGame.class, true, new InTheDarknessGame.GameResultResolver(),ApplicationTextManager.ApplicationTextsAssets.GAME_SCORE_ERROR, ApplicationTextManager.ApplicationTextsAssets.GAME_AVERAGE_SCORE_ERROR);
public interface GameResultResolver {
AbstractTablexiaGame.GameResult getGameCupsResult(Game game);
......@@ -42,18 +41,22 @@ public enum GameDefinition implements ApplicationEvent, IMenuItem {
private Class<? extends AbstractTablexiaGame<?>> screenClass;
private boolean hasTutorial;
private GameResultResolver gameResultResolver;
private String statisticsScoreDialogText;
private String statisticsAverageScoreDialogText;
public static GameDefinition[] getActiveGames() {
return new GameDefinition[]{ROBBERY, PURSUIT, KIDNAPPING, NIGHT_WATCH, SHOOTING_RANGE, IN_THE_DARKNESS};
}
GameDefinition(int gameNumber, String nameResource, String descriptionResource, Class<? extends AbstractTablexiaGame<?>> screenClass, boolean hasTutorial, GameResultResolver gameResultResolver) {
GameDefinition(int gameNumber, String nameResource, String descriptionResource, Class<? extends AbstractTablexiaGame<?>> screenClass, boolean hasTutorial, GameResultResolver gameResultResolver, String statisticsDialogText, String statisticsAverageScoreDialogText) {
this.gameNumber = gameNumber;
this.menuTextKey = nameResource;
this.descriptionResource = descriptionResource;
this.screenClass = screenClass;
this.hasTutorial = hasTutorial;
this.gameResultResolver = gameResultResolver;
this.statisticsScoreDialogText = statisticsDialogText;
this.statisticsAverageScoreDialogText = statisticsAverageScoreDialogText;
}
public int getGameNumber() {
......@@ -70,6 +73,17 @@ public enum GameDefinition implements ApplicationEvent, IMenuItem {
return ApplicationTextManager.getInstance().getResult().get(descriptionResource);
}
public String getStatisticsScoreDialogText() {
return statisticsScoreDialogText;
}
public String getStatisticsAverageScoreDialogText() {
return statisticsAverageScoreDialogText;
}
public Class<? extends AbstractTablexiaGame<?>> getScreenClass() {
return screenClass;
}
......
......@@ -56,6 +56,15 @@ public class ApplicationTextManager extends TablexiaDataManager<I18NBundle> impl
public static final String GAME_SHOOTING_RANGE_DESCRIPTION = "game_shooting_range_description";
public static final String GAME_IN_THE_DARKNESS_TITLE = "game_in_the_darkness_title";
public static final String GAME_IN_THE_DARKNESS_DESCRIPTION = "game_in_the_darkness_description";
public static final String GAME_DIFFICULTY_NAME = "gamedifficulty_name";
public static final String GAME_SCORE = "game_score";
public static final String GAME_SCORE_ERROR = "game_score_error";
public static final String GAME_SCORE_DURATION = "game_score_duration";
public static final String GAME_AVERAGE_SCORE = "game_averagescore";
public static final String GAME_AVERAGE_SCORE_ERROR = "game_averagescore_error";
public static final String GAME_AVERAGE_SCORE_DURATION = "game_averagescore_duration";
}
private static final String APPLICATION_TEXT_RESOURCE_FILE = "text/application/application";
......
......@@ -99,7 +99,7 @@ public class Game {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(startTime);
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
SimpleDateFormat sdf = new SimpleDateFormat("d.M.yyyy HH:mm:ss");
return sdf.format(cal.getTime());
}
......
......@@ -310,25 +310,13 @@ public class StatisticsScreen extends AbstractTablexiaScreen<Void> {
StringBuilder sb = new StringBuilder();
sb.append(game.getGameDefinition().getTitle() + "\n");
sb.append("Difficulty: " + game.getDifficulty().name() + "\n");
sb.append(ApplicationTextManager.getInstance().getText(ApplicationTextManager.ApplicationTextsAssets.GAME_DIFFICULTY_NAME)+ " ");
sb.append(game.getDifficulty().getTextDescription() + "\n");
sb.append(game.getGameStartDate() + "\n");
sb.append(getGameScoreTypeText(game) + getCorrectedScore(selectedGameDefinition, game));
return new DialogTextContent(sb.toString());
}
private String getGameScoreTypeText(Game game) {
sb.append(ApplicationTextManager.getInstance().getText((graphStyle == GraphStyle.DAILY ? game.getGameDefinition().getStatisticsScoreDialogText() : game.getGameDefinition().getStatisticsAverageScoreDialogText())) + " ");
sb.append(getCorrectedScore(selectedGameDefinition, game));
GameDefinition gameDefinition = game.getGameDefinition();
switch(gameDefinition) {
case IN_THE_DARKNESS:
case NIGHT_WATCH:
case KIDNAPPING:return "Mistakes: ";
case ROBBERY:
case SHOOTING_RANGE: return "Score: ";
case PURSUIT: return "Time: ";
}
return null;
return new DialogTextContent(sb.toString());
}
/*In some games is time used as score (less means better).
......
......@@ -16,7 +16,7 @@ import cz.nic.tablexia.util.ui.dialog.text.DialogTextContent;
*/
public class StatisticsScoreDialog extends DynamicBubbleDialog {
public static final float GRAPH_DIALOG_WIDTH = 150;
public static final float GRAPH_DIALOG_WIDTH = 260;
public static final float GRAPH_DIALOG_HEIGHT = 150;
private TextureRegion[] textures; //trofeje
private DialogTextContent dialogTextContent;
......@@ -38,7 +38,7 @@ public class StatisticsScoreDialog extends DynamicBubbleDialog {
getContentTable().row();
BitmapFont font = ApplicationFontManager.getInstance().getFont(ApplicationFontManager.APPLICATION_DEFAULT_FONT_REGULAR);
BitmapFont font = ApplicationFontManager.getInstance().getFont(ApplicationFontManager.FontType.ROBOTO_BOLD_20);
Label.LabelStyle labelStyle = new Label.LabelStyle(font, Color.BLACK);
Label label = new Label(dialogTextContent.getContent(), labelStyle);
label.setFontScale(TextDialog.TITLE_FONT_SCALE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment