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