Commit e0b2ff51 authored by Matyáš Latner's avatar Matyáš Latner

#7 Vicory screen for tutorial games

parent 02409af6
...@@ -27,6 +27,7 @@ gamedifficulty_hard=Těžká ...@@ -27,6 +27,7 @@ gamedifficulty_hard=Těžká
victoryscreen_button_replay=Hrát znovu victoryscreen_button_replay=Hrát znovu
victoryscreen_button_changegame=Jinou hru victoryscreen_button_changegame=Jinou hru
victoryscreen_text_tutorial=Gratuluji! A teď to zkus sám…
game_robbery_title=Lupiči game_robbery_title=Lupiči
game_kidnapping_title=Únos game_kidnapping_title=Únos
......
...@@ -27,6 +27,7 @@ gamedifficulty_hard=Schwierig ...@@ -27,6 +27,7 @@ gamedifficulty_hard=Schwierig
victoryscreen_button_replay=Nochmal spielen victoryscreen_button_replay=Nochmal spielen
victoryscreen_button_changegame=Anderes Spiel victoryscreen_button_changegame=Anderes Spiel
victoryscreen_text_tutorial=Gratulation! Und nun versuch es selbst…
game_robbery_title=Räuber game_robbery_title=Räuber
game_kidnapping_title=Entführung game_kidnapping_title=Entführung
......
...@@ -27,6 +27,7 @@ gamedifficulty_hard=Ťažká ...@@ -27,6 +27,7 @@ gamedifficulty_hard=Ťažká
victoryscreen_button_replay=Hráť znovu victoryscreen_button_replay=Hráť znovu
victoryscreen_button_changegame=Inú hru victoryscreen_button_changegame=Inú hru
victoryscreen_text_tutorial=Gratulujem! A teraz to skús sám…
game_robbery_title=Lupiči game_robbery_title=Lupiči
game_kidnapping_title=Únos game_kidnapping_title=Únos
......
...@@ -48,8 +48,8 @@ public class TablexiaSettings { ...@@ -48,8 +48,8 @@ public class TablexiaSettings {
private final static BuildType FALLBACK_VARIANT = BuildType.DEVEL; private final static BuildType FALLBACK_VARIANT = BuildType.DEVEL;
private final String key; private final String key;
private final boolean isDebug; private final boolean isDebug;
private final Log.TablexiaLogLevel logLevel; private final Log.TablexiaLogLevel logLevel;
BuildType(String key, boolean isDebug, Log.TablexiaLogLevel logLevel) { BuildType(String key, boolean isDebug, Log.TablexiaLogLevel logLevel) {
...@@ -212,11 +212,11 @@ public class TablexiaSettings { ...@@ -212,11 +212,11 @@ public class TablexiaSettings {
public enum LocaleDefinition { public enum LocaleDefinition {
SYSTEM(null, "system", ApplicationTextManager.LANGUAGE_SYSTEM, null), SYSTEM(null, "system", ApplicationTextManager.LANGUAGE_SYSTEM, null),
cs_CZ(new Locale("cs", "CZ"), "cs_CZ", ApplicationTextManager.LANGUAGE_CZECH, "ěřťůšďžčňĚŘŤŮŠĎŽČŇ"), cs_CZ(new Locale("cs", "CZ"), "cs_CZ", ApplicationTextManager.LANGUAGE_CZECH, "ěřťůšďžčňĚŘŤŮŠĎŽČŇ…"),
sk_SK(new Locale("sk", "SK"), "sk_SK", ApplicationTextManager.LANGUAGE_SLOVAK, "Ľľä"), sk_SK(new Locale("sk", "SK"), "sk_SK", ApplicationTextManager.LANGUAGE_SLOVAK, "Ľľä…"),
de_DE(new Locale("de", "DE"), "de_DE", ApplicationTextManager.LANGUAGE_GERMAN, null); de_DE(new Locale("de", "DE"), "de_DE", ApplicationTextManager.LANGUAGE_GERMAN, "…");
public final static LocaleDefinition DEFAULT_LOCALE = LocaleDefinition.cs_CZ; public final static LocaleDefinition DEFAULT_LOCALE = LocaleDefinition.cs_CZ;
private final static LocaleDefinition FALLBACK_VARIANT = LocaleDefinition.SYSTEM; private final static LocaleDefinition FALLBACK_VARIANT = LocaleDefinition.SYSTEM;
private final Locale locale; private final Locale locale;
......
...@@ -347,6 +347,7 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T> ...@@ -347,6 +347,7 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
private Image[] ratingStarsEnabled; private Image[] ratingStarsEnabled;
private Music victorySpeech; private Music victorySpeech;
private Table ratingStarTable;
public VictoryDialog(String text) { public VictoryDialog(String text) {
super(DIALOG_POSITION_X, super(DIALOG_POSITION_X,
...@@ -385,7 +386,7 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T> ...@@ -385,7 +386,7 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
// RATING STARS // RATING STARS
getContentTable().row(); getContentTable().row();
Table ratingStarTable = new Table(); ratingStarTable = new Table();
ratingStarsEnabled = new Image[RATINGSTARS_COUNT]; ratingStarsEnabled = new Image[RATINGSTARS_COUNT];
for (int i = 0; i < RATINGSTARS_COUNT; i++) { for (int i = 0; i < RATINGSTARS_COUNT; i++) {
createRatingStar(i, ratingStarTable); createRatingStar(i, ratingStarTable);
...@@ -419,31 +420,36 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T> ...@@ -419,31 +420,36 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
// victory dialog sound // victory dialog sound
getSound(VICTORYSCREEN_SHOW_SOUND, false).play(); getSound(VICTORYSCREEN_SHOW_SOUND, false).play();
// result speech if (getGameDifficulty() != GameDifficulty.TUTORIAL) {
final String soundNameForGameResult = getSoundNameForGameResult(gameResult); // result speech
if (soundNameForGameResult != null) { final String soundNameForGameResult = getSoundNameForGameResult(gameResult);
addAction(sequence(delay(VICTORYSCREEN_SHOW_SOUND_DELAY), run(new Runnable() { if (soundNameForGameResult != null) {
@Override addAction(sequence(delay(VICTORYSCREEN_SHOW_SOUND_DELAY), run(new Runnable() {
public void run() { @Override
victorySpeech = getMusic(soundNameForGameResult); public void run() {
if (victorySpeech != null) { victorySpeech = getMusic(soundNameForGameResult);
victorySpeech.play(); if (victorySpeech != null) {
victorySpeech.play();
}
} }
} })));
}))); }
}
// rating stars // rating stars
for (int i = 0; i < gameResult.getStarCount(); i++) { ratingStarTable.setVisible(true);
final Image ratingStarEnabled = ratingStarsEnabled[i]; for (int i = 0; i < gameResult.getStarCount(); i++) {
final int index = i + 1; final Image ratingStarEnabled = ratingStarsEnabled[i];
addAction(sequence(delay((index) * RATINGSTAR_DELAY), run(new Runnable() { final int index = i + 1;
@Override addAction(sequence(delay((index) * RATINGSTAR_DELAY), run(new Runnable() {
public void run() { @Override
ratingStarEnabled.setVisible(true); public void run() {
getSound(GameResult.getGameResultForStartCount(index).getStartSoundName(), false).play(); ratingStarEnabled.setVisible(true);
} getSound(GameResult.getGameResultForStartCount(index).getStartSoundName(), false).play();
}))); }
})));
}
} else {
ratingStarTable.setVisible(false);
} }
return this; return this;
} }
...@@ -485,8 +491,14 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T> ...@@ -485,8 +491,14 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
game.endGame(); game.endGame();
Log.info(getClass(), "[DB] Ended game: " + game); Log.info(getClass(), "[DB] Ended game: " + game);
String gameResultKey = getTextKeyForGameResult(game.getGameResult()); String victoryDialogText;
(new VictoryDialog(gameResultKey != null ? getText(gameResultKey) : "")).show(getStage()); if (getGameDifficulty() == GameDifficulty.TUTORIAL) {
victoryDialogText = ApplicationTextManager.getInstance().getText("victoryscreen_text_tutorial");
} else {
String textKey = getTextKeyForGameResult(game.getGameResult());
victoryDialogText = textKey != null ? getText(textKey) : "";
}
(new VictoryDialog(victoryDialogText)).show(getStage());
} }
public void startNewGame() { public void startNewGame() {
......
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