Commit 3124b5eb authored by Vitaliy Vashchenko's avatar Vitaliy Vashchenko

Merge branch '976-popisek-k-bonus' into 'V3.7'

#976 Added message to locked bonus dialog

See merge request !762
parents 993e9938 70a59cfa
......@@ -75,7 +75,9 @@ gamedifficulty_easy=Lehká
gamedifficulty_medium=Střední
gamedifficulty_hard=Těžká
gamedifficulty_bonus=Bonus
gamedifficulty_bonus_locked=Obtížnost BONUS je prozatím uzamčená
gamedifficulty_bonus_locked_title=Obtížnost "Bonus" je prozatím uzamčená
gamedifficulty_bonus_locked_description=Bonus se otevře za odehrání 10x 3 poháry na těžkou úroveň hry
gamedifficulty_bonus_locked_current=Máš odehráno {0}/10
victoryscreen_button_replay=Hrát znovu
victoryscreen_button_finish=Ukončit
......
......@@ -76,7 +76,9 @@ gamedifficulty_easy=Leicht
gamedifficulty_medium=Mittel
gamedifficulty_hard=Schwierig
gamedifficulty_bonus=Bonus
gamedifficulty_bonus_locked=BONUS Schwierigkeit ist jetzt noch gesperrt
gamedifficulty_bonus_locked_title=BONUS Schwierigkeit ist jetzt noch gesperrt
gamedifficulty_bonus_locked_description=Für 10x 3 Pokale auf der schwierigen Stufe spielen
gamedifficulty_bonus_locked_current=Sie haben {0}/10 gespielt
victoryscreen_button_replay=Nochmal spielen
victoryscreen_button_finish=Beenden
......
......@@ -77,7 +77,9 @@ gamedifficulty_easy=Ľahká
gamedifficulty_medium=Stredná
gamedifficulty_hard=Ťažká
gamedifficulty_bonus=Bonus
gamedifficulty_bonus_locked=obtiažnosť BONUS je zatiaľ uzamknutá
gamedifficulty_bonus_locked_title=Obtiažnosť BONUS je zatiaľ uzamknutá
gamedifficulty_bonus_locked_description=Za 10x 3 poháry na ťažkú úroveň hry
gamedifficulty_bonus_locked_current=Máš odohraných {0}/10
victoryscreen_button_replay=Hrať znovu
victoryscreen_button_finish=Ukončiť
......
......@@ -166,7 +166,9 @@ public class ApplicationTextManager extends TablexiaDataManager<I18NBundle> impl
public static final String USER_RANK_10 = "user_rank_10";
public static final String USER_RANK_11 = "user_rank_11";
public static final String DIFFICULTY_LOCKED = "gamedifficulty_bonus_locked";
public static final String DIFFICULTY_LOCKED_TITLE = "gamedifficulty_bonus_locked_title";
public static final String DIFFICULTY_LOCKED_DESCRIPTION = "gamedifficulty_bonus_locked_description";
public static final String DIFFICULTY_LOCKED_CURRENT = "gamedifficulty_bonus_locked_current";
public static final String SYNC_QR_REQUEST_BUTTON = "sync_qr_request_button";
public static final String SYNC_QR_REQUEST_INFO_DIALOG_TEXT = "sync_qr_request_info_dialog_text";
......
......@@ -586,6 +586,10 @@ public class GameDAO {
}
public static boolean isBonusDifficultyUnlocked(int gameNumber, long userId) {
return requiredHardGamesCount(gameNumber, userId) >= GameDifficulty.BONUS_DIFFICULTY_UNLOCK_THRESHOLD;
}
public static int requiredHardGamesCount(int gameNumber, long userId) {
List<Game> games = new ArrayList<>();
try {
PreparedStatement statement = TablexiaStorage.getInstance().prepareStatement(GAME_SELECT_BONUS_DIFFICULTY_UNLOCKED);
......@@ -607,10 +611,11 @@ public class GameDAO {
}
int threeStarsHardGamesCount = 0;
for(Game game : games) {
if(GameDAO.getGameResult(game).getStarCount() == AbstractTablexiaGame.GameResult.THREE_STAR.getStarCount()) threeStarsHardGamesCount++;
for (Game game : games) {
if (GameDAO.getGameResult(game).getStarCount() == AbstractTablexiaGame.GameResult.THREE_STAR.getStarCount())
threeStarsHardGamesCount++;
}
return threeStarsHardGamesCount >= GameDifficulty.BONUS_DIFFICULTY_UNLOCK_THRESHOLD;
return threeStarsHardGamesCount;
}
private static Long gameUpdateStart(long id, long startTime) {
......
......@@ -54,6 +54,7 @@ import cz.nic.tablexia.util.ui.dialog.components.BackButtonHideComponent;
import cz.nic.tablexia.util.ui.dialog.components.CenterPositionDialogComponent;
import cz.nic.tablexia.util.ui.dialog.components.CloseButtonContentDialogComponent;
import cz.nic.tablexia.util.ui.dialog.components.DimmerDialogComponent;
import cz.nic.tablexia.util.ui.dialog.components.FixedSpaceContentDialogComponent;
import cz.nic.tablexia.util.ui.dialog.components.ResizableSpaceContentDialogComponent;
import cz.nic.tablexia.util.ui.dialog.components.TextContentDialogComponent;
......@@ -105,8 +106,8 @@ public class GamePageGroup extends Group {
private static final float NEW_GAME_LABEL_OFFSET_RATIO = 1f/10;
private static final int BONUS_DIFFICULTY_LOCKED_DIALOG_WIDTH = 300;
private static final int BONUS_DIFFICULTY_LOCKED_DIALOG_HEIGHT = 200;
private static final int BONUS_DIFFICULTY_LOCKED_DIALOG_WIDTH = 400;
private static final int BONUS_DIFFICULTY_LOCKED_DIALOG_HEIGHT = 300;
//Font for difficulty labels
private static final ApplicationFontManager.FontType DIFFICULTY_FONT_STYLE = ApplicationFontManager.FontType.BOLD_18;
......@@ -390,14 +391,21 @@ public class GamePageGroup extends Group {
}
private void showBonusDifficultyLockedDialog() {
if(bonusDifficultyLockedDialog != null) return;
bonusDifficultyLockedDialog = TablexiaComponentDialogFactory.getInstance().createDialog(
if (bonusDifficultyLockedDialog != null) return;
bonusDifficultyLockedDialog = TablexiaComponentDialogFactory.getInstance().createStandardDialog(
new FixedSpaceContentDialogComponent(),
new TextContentDialogComponent(ApplicationTextManager.getInstance().getText(ApplicationTextManager.ApplicationTextsAssets.DIFFICULTY_LOCKED_TITLE), ApplicationFontManager.FontType.BOLD_20, true, true),
new ResizableSpaceContentDialogComponent(),
new TextContentDialogComponent(ApplicationTextManager.getInstance().getText(ApplicationTextManager.ApplicationTextsAssets.DIFFICULTY_LOCKED)),
new TextContentDialogComponent(ApplicationTextManager.getInstance().getText(ApplicationTextManager.ApplicationTextsAssets.DIFFICULTY_LOCKED_DESCRIPTION) + gameDefinition.getTitle(), true, true),
new ResizableSpaceContentDialogComponent(),
new TextContentDialogComponent(
ApplicationTextManager.getInstance().getFormattedText(
ApplicationTextManager.ApplicationTextsAssets.DIFFICULTY_LOCKED_CURRENT,
GameDAO.requiredHardGamesCount(gameDefinition.getGameNumber(),
TablexiaSettings.getInstance().getSelectedUser().getId()))),
new CloseButtonContentDialogComponent(ApplicationTextManager.getInstance().getText(ApplicationTextManager.ApplicationTextsAssets.SYSTEM_UNDERSTAND)).setInputListener(new ClickListener() {
@Override
public void clicked (InputEvent event, float x, float y) {
public void clicked(InputEvent event, float x, float y) {
hideBonusDifficultyLockedDialog();
}
}),
......
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