Skip to content
Snippets Groups Projects
Commit 9ac5a7bf authored by Matyáš Latner's avatar Matyáš Latner
Browse files

Merge branch 'feature-abstractgame' into 'devel'

Feature abstractgame



See merge request !85
parents a5fc6b6d 25e16e1b
Branches
Tags
No related merge requests found
Showing
with 199 additions and 51 deletions
......@@ -5,10 +5,10 @@ game_robbery_victorytext_threestars=S takovouhle ostrahou nepotřebuje banka ani
game_robbery_victorytext_twostar=Tvoje jméno si už začínají štěbetat\ni straky na střechách.
game_robbery_victorytext_onestar=Otázka je, jestli zůstal trezor poloplný,\nnebo poloprázdný.
game_robbery_victorytext_nostar=U lupičů jsi rozhodně nejoblíbenější hlídač.\nKdyž budeš trénovat, určitě se tě budou brzy bát.
game_robbery_victorytext_stats=Správně jsi {0} <b>{1}/{2}</b> návštěvníků.
game_robbery_victorytext_stats_identification=identifikoval/a
game_robbery_victorytext_stats_identification_male=identifikoval
game_robbery_victorytext_stats_identification_female=identifikovala
game_robbery_victorytext_summary=Správně jsi {0} [BLACK]{1}/{2}[] návštěvníků.
game_robbery_victorytext_summary_identification=identifikoval/a
game_robbery_victorytext_summary_identification_male=identifikoval
game_robbery_victorytext_summary_identification_female=identifikovala
game_robbery_color_red=červen
game_robbery_color_green=zelen
game_robbery_color_blue=modr
......
......@@ -5,10 +5,10 @@ game_robbery_victorytext_threestars=Mit einer solchen Wache braucht die Bank nic
game_robbery_victorytext_twostar=Deinen Namen pfeifen langsam schon \ndie Elstern von den Dächern.
game_robbery_victorytext_onestar=Die Frage ist, ob der Tresor halb voll, \noder halb leer geblieben ist.
game_robbery_victorytext_nostar=Du bist bei den Räubern eindeutig der beliebteste Wächter.\nWenn du trainierst, werden sie bald Angst vor dir haben.
game_robbery_victorytext_stats=Du hast {0} Besucher richtig <b>{1}/{2}</b>.
game_robbery_victorytext_stats_identification=identifiziert
game_robbery_victorytext_stats_identification_male=identifiziert
game_robbery_victorytext_stats_identification_female=identifiziert
game_robbery_victorytext_summary=Du hast {0} Besucher richtig [BLACK]{1}/{2}[].
game_robbery_victorytext_summary_identification=identifiziert
game_robbery_victorytext_summary_identification_male=identifiziert
game_robbery_victorytext_summary_identification_female=identifiziert
game_robbery_color_red=rot
game_robbery_color_green=grün
game_robbery_color_blue=blau
......
......@@ -5,11 +5,11 @@ game_robbery_loadingtext=Na začiatku hry si prečítaj pravidlo, podľa ktoréh
game_robbery_victorytext_threestars=S takouto ostrahou nepotrebuje banka ani trezor.
game_robbery_victorytext_twostar=Tvoje meno si začínajú štebotať aj straky na strechách.
game_robbery_victorytext_onestar=Otázka je, či ostal trezor poloplný alebo poloprázdný.
game_robbery_victorytext_nostar=U lupičov si rozhodne najobľúbenejší strážca. Ak budeš trénovať, určite sa ťa budú skoro báť.
game_robbery_victorytext_stats=Správne si {0} <b>{1}/{2}</b> návštevníkov.
game_robbery_victorytext_stats_identification=identifikoval/a
game_robbery_victorytext_stats_identification_male=identifikoval
game_robbery_victorytext_stats_identification_female=identifikovala
game_robbery_victorytext_nostar=U lupičov si rozhodne najobľúbenejší strážca. \nAk budeš trénovať, určite sa ťa budú skoro báť.
game_robbery_victorytext_summary=Správne si {0} [BLACK]{1}/{2}[] návštevníkov.
game_robbery_victorytext_summary_identification=identifikoval/a
game_robbery_victorytext_summary_identification_male=identifikoval
game_robbery_victorytext_summary_identification_female=identifikovala
game_robbery_color_red=červen
game_robbery_color_green=zelen
game_robbery_color_blue=modr
......
core/assets/common/game/_global/stats.png

1.52 KiB

core/assets/common/game/_global/time.png

1.81 KiB

......@@ -2,16 +2,20 @@ package cz.nic.tablexia.game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.Action;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Cell;
import com.badlogic.gdx.scenes.scene2d.ui.Dialog;
import com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Stack;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.utils.Align;
import net.engio.mbassy.listener.Handler;
......@@ -29,13 +33,13 @@ import cz.nic.tablexia.bus.event.DimmerControlEvent;
import cz.nic.tablexia.bus.event.MenuControlEvent;
import cz.nic.tablexia.game.common.TablexiaRandom;
import cz.nic.tablexia.game.difficulty.GameDifficulty;
import cz.nic.tablexia.loader.application.ApplicationFontManager;
import cz.nic.tablexia.loader.application.ApplicationTextManager;
import cz.nic.tablexia.model.game.Game;
import cz.nic.tablexia.screen.AbstractTablexiaScreen;
import cz.nic.tablexia.util.Log;
import cz.nic.tablexia.util.ui.TablexiaButton;
import cz.nic.tablexia.util.ui.dialog.TwoButtonDialog;
import cz.nic.tablexia.util.ui.dialog.text.DialogTextContent;
import static com.badlogic.gdx.scenes.scene2d.actions.Actions.delay;
import static com.badlogic.gdx.scenes.scene2d.actions.Actions.run;
......@@ -95,16 +99,33 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
private static final String GAME_GLOBAL_PATH = "game/_global/";
private static final String GLOBAL_ATLAS_NAME = GAME_GLOBAL_PATH + "_global.atlas";
private static final String VICTORYSCREEN_SHOW_SOUND = GAME_GLOBAL_PATH + "victoryscreen_show.mp3";
private static final String RATINGSTAR1_SOUND = GAME_GLOBAL_PATH + "victoryscreen_star1.mp3";
private static final String RATINGSTAR2_SOUND = GAME_GLOBAL_PATH + "victoryscreen_star2.mp3";
private static final String RATINGSTAR3_SOUND = GAME_GLOBAL_PATH + "victoryscreen_star3.mp3";
public static final String VICTORYSCREEN_RESULTSBANNER = "resultsbanner";
public static final String VICTORYSCREEN_RATINGSTAR_DISABLED = "ratingstar_disabled";
public static final String VICTORYSCREEN_RATINGSTAR_ENABLED = "ratingstar_enabled";
private static final int VICTORYSCREEN_SHOW_SOUND_DELAY = 2;
private static final String VICTORY_DIALOG_SHOW_SOUND = GAME_GLOBAL_PATH + "victoryscreen_show.mp3";
public static final String VICTORY_DIALOG_RESULTSBANNER = "resultsbanner";
public static final String VICTORY_DIALOG_RATINGSTAR_DISABLED = "ratingstar_disabled";
public static final String VICTORY_DIALOG_RATINGSTAR_ENABLED = "ratingstar_enabled";
public static final String VICTORY_DIALOG_SUMMARY_ICON_STATS = "stats";
public static final String VICTORY_DIALOG_SUMMARY_ICON_TIME = "time";
private static final String VICTORY_DIALOG_TUTORIAL_TEXT = "victoryscreen_text_tutorial";
private static final float VICTORY_DIALOG_BUTTON_TEXT_SCALE = 0.7f;
private static final String VICTORY_DIALOG_BUTTON_TEXT_FONT_TYPE = ApplicationFontManager.APPLICATION_DEFAULT_FONT_BOLD;
private static final Color VICTORY_DIALOG_BUTTON_TEXT_FONT_COLOR = Color.BLACK;
private static final int VICTORY_DIALOG_SHOW_SOUND_DELAY = 2;
private static final String VICTORY_DIALOG_TEXT_FONT_TYPE = ApplicationFontManager.APPLICATION_DEFAULT_FONT_REGULAR;
private static final float VICTORY_DIALOG_TEXT_FONT_SCALE = 0.8f;
private static final int VICTORY_DIALOG_TEXT_PADDING_BOTTOM = 25;
private static final int VICTORY_DIALOG_TEXT_PADDING_TOP = 15;
private static final Color VICTORY_DIALOG_TEXT_FONT_COLOR = Color.BLACK;
private static final float VICTORY_DIALOG_SUMMARY_IMAGE_SIZE = 0.7f;
private static final Color VICTORY_DIALOG_SUMMARY_FONT_COLOR = Color.DARK_GRAY;
private static final String VICTORY_DIALOG_SUMMARY_FONT_TYPE = ApplicationFontManager.APPLICATION_DEFAULT_FONT_REGULAR;
private static final float VICTORY_DIALOG_SUMMARY_TEXT_SIZE = 0.7f;
public static final String RANDOM_SEED_SCREEN_INFO_LABEL = "Random Seed";
public static final String GAME_DIFFICULTY_SCREEN_INFO_LABEL = "Game Difficulty";
......@@ -202,7 +223,7 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
@Override
protected final void prepareScreenSoundAssetNames(List<String> soundsFileNames) {
prepareGameSoundAssetNames(soundsFileNames);
loadSound(VICTORYSCREEN_SHOW_SOUND);
loadSound(VICTORY_DIALOG_SHOW_SOUND);
loadSound(RATINGSTAR1_SOUND);
loadSound(RATINGSTAR2_SOUND);
loadSound(RATINGSTAR3_SOUND);
......@@ -335,6 +356,41 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
private final float DIALOG_POSITION_X = (AbstractTablexiaGame.this.getStage().getWidth() / 2) - (DIALOG_WIDTH / 2);
private final float DIALOG_POSITION_Y = (TablexiaSettings.getMinWorldHeight() / 2) - (DIALOG_HEIGHT / 2); // TODO fix for floating screen
public enum SummaryImage {
STATS (VICTORY_DIALOG_SUMMARY_ICON_STATS),
TIME (VICTORY_DIALOG_SUMMARY_ICON_TIME);
private String imageName;
SummaryImage(String imageName) {
this.imageName = imageName;
}
public String getImageName() {
return imageName;
}
}
public static class SummaryMessage {
private final SummaryImage summaryImage;
private final String text;
public SummaryMessage(SummaryImage summaryImage, String text) {
this.summaryImage = summaryImage;
this.text = text;
}
public SummaryImage getSummaryImage() {
return summaryImage;
}
public String getText() {
return text;
}
}
private class VictoryDialog extends TwoButtonDialog {
public static final int RATINGSTARS_COUNT = 3;
......@@ -349,13 +405,13 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
private Music victorySpeech;
private Table ratingStarTable;
public VictoryDialog(String text) {
public VictoryDialog() {
super(DIALOG_POSITION_X,
DIALOG_POSITION_Y,
DIALOG_WIDTH,
DIALOG_HEIGHT,
BackGroundType.DIALOG_SQUARE_BORDERLINES,
new DialogTextContent(text),
null,
TablexiaButton.ButtonType.BLUE,
TablexiaButton.ButtonType.GREEN,
ApplicationTextManager.getInstance().getText(ApplicationTextManager.ApplicationTextsAssets.VICTORYSCREEN_BUTTON_CHANGEGAME),
......@@ -379,7 +435,7 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
@Override
protected void prepareContent() {
// RESULTS BANNER
Image resultsBanner = new Image(getGameGlobalTextureRegion(VICTORYSCREEN_RESULTSBANNER));
Image resultsBanner = new Image(getGameGlobalTextureRegion(VICTORY_DIALOG_RESULTSBANNER));
float resultBannerWidth = getWidth() * RESULTSBANNER_WIDTH_RATIO;
float resultsBannerSizeRatio = resultBannerWidth / resultsBanner.getWidth();
getContentTable().add(resultsBanner).width(resultBannerWidth).height(resultsBanner.getHeight() * resultsBannerSizeRatio).padTop(getHeight() * RESULTSBANNER_TOPPADDING_RATIO).center().colspan(3);
......@@ -393,13 +449,61 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
}
getContentTable().add(ratingStarTable).center();
getContentTable().row();
// MAIN TEXT
String victoryDialogText;
if (getGameDifficulty() == GameDifficulty.TUTORIAL) {
victoryDialogText = ApplicationTextManager.getInstance().getText(VICTORY_DIALOG_TUTORIAL_TEXT);
} else {
String textKey = getTextKeyForGameResult(game.getGameResult());
victoryDialogText = textKey != null ? getText(textKey) : "";
}
getContentTable().row();
Label resultText = new Label(victoryDialogText, new Label.LabelStyle(ApplicationFontManager.getInstance().getFont(VICTORY_DIALOG_TEXT_FONT_TYPE), VICTORY_DIALOG_TEXT_FONT_COLOR));
resultText.setAlignment(Align.center);
resultText.setFontScale(VICTORY_DIALOG_TEXT_FONT_SCALE);
getContentTable().add(resultText).padBottom(VICTORY_DIALOG_TEXT_PADDING_BOTTOM).padTop(VICTORY_DIALOG_TEXT_PADDING_TOP).center();
getContentTable().row();
// SUMMARY TEXT
HorizontalGroup horizontalGroup = new HorizontalGroup();
List<SummaryMessage> summaryMessages = getSummaryMessageForGameResult(getGame());
if (summaryMessages != null) {
for (SummaryMessage summaryMessage : summaryMessages) {
horizontalGroup.addActor(createSummaryGroup(summaryMessage));
}
}
getContentTable().add(horizontalGroup).padBottom(15).center();
getContentTable().row();
super.prepareContent();
}
private HorizontalGroup createSummaryGroup(SummaryMessage summaryMessage) {
HorizontalGroup horizontalGroup = new HorizontalGroup();
if (summaryMessage.getSummaryImage() != null) {
Image image = new Image(getGameGlobalTextureRegion(summaryMessage.getSummaryImage().getImageName()));
image.setOrigin(Align.center);
image.setScale(VICTORY_DIALOG_SUMMARY_IMAGE_SIZE);
horizontalGroup.addActor(image);
}
if (summaryMessage.getText() != null) {
BitmapFont font = ApplicationFontManager.getInstance().getFont(VICTORY_DIALOG_SUMMARY_FONT_TYPE);
font.getData().markupEnabled = true;
Label summaryText = new Label(summaryMessage.getText(), new Label.LabelStyle(font, VICTORY_DIALOG_SUMMARY_FONT_COLOR));
summaryText.setFontScale(VICTORY_DIALOG_SUMMARY_TEXT_SIZE);
horizontalGroup.addActor(summaryText);
}
return horizontalGroup;
}
private void createRatingStar(int starNumber, Table ratingStartTable) {
Stack ratingStack = new Stack();
Image ratingStarDisabled = new Image(getGameGlobalTextureRegion(VICTORYSCREEN_RATINGSTAR_DISABLED));
Image ratingStarEnabled = new Image(getGameGlobalTextureRegion(VICTORYSCREEN_RATINGSTAR_ENABLED));
Image ratingStarDisabled = new Image(getGameGlobalTextureRegion(VICTORY_DIALOG_RATINGSTAR_DISABLED));
Image ratingStarEnabled = new Image(getGameGlobalTextureRegion(VICTORY_DIALOG_RATINGSTAR_ENABLED));
ratingStarEnabled.setVisible(false);
ratingStarsEnabled[starNumber] = ratingStarEnabled;
......@@ -418,13 +522,13 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
final GameResult gameResult = game.getGameResult();
// victory dialog sound
getSound(VICTORYSCREEN_SHOW_SOUND, false).play();
getSound(VICTORY_DIALOG_SHOW_SOUND, false).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() {
addAction(sequence(delay(VICTORY_DIALOG_SHOW_SOUND_DELAY), run(new Runnable() {
@Override
public void run() {
victorySpeech = getMusic(soundNameForGameResult);
......@@ -454,6 +558,13 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
return this;
}
@Override
public void createButton(TextButton textButton, ClickListener clickListener) {
textButton.getLabel().setStyle(new Label.LabelStyle(ApplicationFontManager.getInstance().getFont(VICTORY_DIALOG_BUTTON_TEXT_FONT_TYPE), VICTORY_DIALOG_BUTTON_TEXT_FONT_COLOR));
textButton.getLabel().setFontScale(VICTORY_DIALOG_BUTTON_TEXT_SCALE);
super.createButton(textButton, clickListener);
}
@Override
public void hide(Action action) {
if (victorySpeech != null) {
......@@ -490,15 +601,7 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
gamePhase = GamePhase.FINISHED;
game.endGame();
Log.info(getClass(), "[DB] Ended game: " + game);
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());
(new VictoryDialog()).show(getStage());
}
public void startNewGame() {
......@@ -514,6 +617,8 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
});
}
protected abstract List<SummaryMessage> getSummaryMessageForGameResult(Game game);
protected abstract String getTextKeyForGameResult(GameResult gameResult);
protected abstract String getSoundNameForGameResult(GameResult gameResult);
......
......@@ -319,6 +319,11 @@ public class InTheDarknessGame extends AbstractTablexiaGame<List<MapWidget>> imp
alignScreenContent();
}
@Override
protected List<SummaryMessage> getSummaryMessageForGameResult(Game game) {
return null;
}
@Override
protected String getTextKeyForGameResult(GameResult gameResult) {
switch (gameResult) {
......
......@@ -33,6 +33,7 @@ import cz.nic.tablexia.game.games.kidnapping.model.Direction;
import cz.nic.tablexia.game.games.kidnapping.model.GameState;
import cz.nic.tablexia.game.games.kidnapping.model.Position;
import cz.nic.tablexia.game.games.kidnapping.util.DirectionsHelper;
import cz.nic.tablexia.model.game.Game;
import cz.nic.tablexia.util.Log;
/**
......@@ -193,6 +194,11 @@ public class KidnappingGame extends AbstractTablexiaGame<GameState> {
return 0;
}
@Override
protected List<SummaryMessage> getSummaryMessageForGameResult(Game game) {
return null;
}
@Override
protected String getTextKeyForGameResult(GameResult gameResult) {
return null;
......
......@@ -27,6 +27,7 @@ import cz.nic.tablexia.game.games.night_watch.helper.TextureHelper;
import cz.nic.tablexia.game.games.night_watch.solution.GameSolutionGenerator;
import cz.nic.tablexia.game.games.night_watch.solution.Solution;
import cz.nic.tablexia.game.games.night_watch.subscene.Watch;
import cz.nic.tablexia.model.game.Game;
import cz.nic.tablexia.util.Log;
import cz.nic.tablexia.util.Utility;
import cz.nic.tablexia.util.ui.TablexiaButton;
......@@ -194,7 +195,7 @@ public class NightWatchGame extends AbstractTablexiaGame<int[][]> {
Action action = new Action() {
@Override
public boolean act(float delta) {
Log.info(getClass(),"PLAY");
Log.info(getClass(), "PLAY");
userPlaying = true;
enableClickables(true);
return true;
......@@ -345,6 +346,11 @@ public class NightWatchGame extends AbstractTablexiaGame<int[][]> {
return new Color(getData()[clickX][clickY]);
}
@Override
protected List<SummaryMessage> getSummaryMessageForGameResult(Game game) {
return null;
}
@Override
protected String getTextKeyForGameResult(GameResult gameResult) {
return null;
......
......@@ -8,6 +8,7 @@ import com.badlogic.gdx.scenes.scene2d.Group;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.utils.Array;
import java.util.List;
import java.util.Map;
import cz.nic.tablexia.TablexiaSettings;
......@@ -255,6 +256,11 @@ public class PursuitGame extends AbstractTablexiaGame<int[][]> {
finishFlag.setVisible(true);
}
@Override
protected List<SummaryMessage> getSummaryMessageForGameResult(Game game) {
return null;
}
@Override
protected String getTextKeyForGameResult(GameResult gameResult) {
return ResultMapping.getResultTextMappingForGameResult(gameResult).getTextKey();
......
......@@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputMultiplexer;
import com.badlogic.gdx.InputProcessor;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
......@@ -13,6 +14,7 @@ import cz.nic.tablexia.game.games.robbery.assets.RobberyAssets;
import cz.nic.tablexia.game.games.robbery.creature.CreatureFactory;
import cz.nic.tablexia.game.games.robbery.rules.GameRule;
import cz.nic.tablexia.game.games.robbery.rules.GameRulesDefinition;
import cz.nic.tablexia.model.User;
import cz.nic.tablexia.model.game.Game;
import cz.nic.tablexia.screen.AbstractTablexiaScreen;
......@@ -69,6 +71,10 @@ public class RobberyGame extends AbstractTablexiaGame<GameRule> {
}
}
private static final String SUMMARY_TEXT_KEY = "game_robbery_victorytext_summary";
private static final String SUMMARY_IDENTIFICATION_MALE_TEXT_KEY = "game_robbery_victorytext_summary_identification_male";
private static final String SUMMARY_IDENTIFICATION_FEMALE_TEXT_KEY = "game_robbery_victorytext_summary_identification_female";
private static final String SCORE_KEY_PERSON_COUNT = "person_count";
private static final String SCORE_KEY_THIEVES_COUNT = "thieves_count";
private static final String SCORE_KEY_CAUGHT_THIEF = "caught_thief";
......@@ -190,6 +196,13 @@ public class RobberyGame extends AbstractTablexiaGame<GameRule> {
//////////////////////////// ABSTRACT TABLEXIA GAME
@Override
protected List<SummaryMessage> getSummaryMessageForGameResult(Game game) {
String identification = game.getUser().getGender() == User.Gender.MALE ? getText(SUMMARY_IDENTIFICATION_MALE_TEXT_KEY) : getText(SUMMARY_IDENTIFICATION_FEMALE_TEXT_KEY);
return Arrays.asList(new SummaryMessage(null, getFormattedText(SUMMARY_TEXT_KEY, identification, game.getGameScore(SCORE_KEY_PERSON_NUMBER, "0"), game.getGameScore(SCORE_KEY_PERSON_COUNT))));
}
@Override
protected String getTextKeyForGameResult(GameResult gameResult) {
return ResultMapping.getResultTextMappingForGameResult(gameResult).getTextKey();
......
......@@ -30,6 +30,7 @@ import cz.nic.tablexia.game.games.shooting_range.tools.HitEvaluator;
import cz.nic.tablexia.game.games.shooting_range.tools.PixelPerfectHitEvaluator;
import cz.nic.tablexia.game.games.shooting_range.tools.TargetGenerator;
import cz.nic.tablexia.game.games.shooting_range.tools.TargetPositionController;
import cz.nic.tablexia.model.game.Game;
/**
* Created by lhoracek
......@@ -273,6 +274,11 @@ public class ShootingRangeGame extends AbstractTablexiaGame<GameState> {
score.setPosition(getStage().getWidth() - score.getWidth() - 50, 25);
}
@Override
protected List<SummaryMessage> getSummaryMessageForGameResult(Game game) {
return null;
}
@Override
protected String getTextKeyForGameResult(GameResult gameResult) {
return Properties.RESULT_TEXT[gameResult.getStarCount()];
......
......@@ -160,6 +160,11 @@ public class Game {
}).start();
}
public String getGameScore(String key, String defaultValue) {
String gameScore = getGameScore(key);
return gameScore != null ? gameScore : defaultValue;
}
public String getGameScore(String key) {
return gameScoreMap.get(key);
}
......
......@@ -73,8 +73,8 @@ public class TablexiaButton extends TextButton {
}
public TablexiaButton(NinePatchDrawable npdUp, NinePatchDrawable npdDown, NinePatchDrawable npdDis, NinePatchDrawable solarizedBackground, String buttonText) {
super(buttonText, getButtonStyle(npdUp, npdDown, npdDis));
super(buttonText, new TextButton.TextButtonStyle(npdUp, npdDown, npdDis, ApplicationFontManager.getInstance().getFont(DEFAULT_BUTTON_TEXT_FONT)));
getStyle().fontColor = DEFAULT_BUTTON_TEXT_COLOR;
if (solarizedBackground != null) {
solarizedBackgroundImage = new Image(solarizedBackground);
solarizedBackgroundImage.setSize(getWidth(), getHeight());
......@@ -110,12 +110,6 @@ public class TablexiaButton extends TextButton {
}
}
private static TextButton.TextButtonStyle getButtonStyle(NinePatchDrawable npdUp, NinePatchDrawable npdDown, NinePatchDrawable npdDis){
TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle(npdUp, npdDown, npdDis, ApplicationFontManager.getInstance().getFont(DEFAULT_BUTTON_TEXT_FONT));
textButtonStyle.fontColor = DEFAULT_BUTTON_TEXT_COLOR;
return textButtonStyle;
}
public void highliteButton(boolean enable) {
if (solarizedBackgroundImage != null) {
if (enable) {
......
......@@ -30,11 +30,13 @@ public class TextDialog extends TablexiaDialog {
@Override
protected void prepareContent() {
if (dialogTextContent.getTitle() != null && !dialogTextContent.getTitle().equals("")) {
addLabel(dialogTextContent.getTitle(), ApplicationFontManager.getInstance().getFont(ApplicationFontManager.APPLICATION_DEFAULT_FONT_BOLD));
getContentTable().row();
if (dialogTextContent != null) {
if (dialogTextContent.getTitle() != null && !dialogTextContent.getTitle().equals("")) {
addLabel(dialogTextContent.getTitle(), ApplicationFontManager.getInstance().getFont(ApplicationFontManager.APPLICATION_DEFAULT_FONT_BOLD));
getContentTable().row();
}
addLabel(dialogTextContent.getContent(), ApplicationFontManager.getInstance().getFont(ApplicationFontManager.APPLICATION_DEFAULT_FONT_REGULAR)).center().expand().top().fillX();
}
addLabel(dialogTextContent.getContent(), ApplicationFontManager.getInstance().getFont(ApplicationFontManager.APPLICATION_DEFAULT_FONT_REGULAR)).center().expand().top().fillX();
}
protected Cell<Label> addLabel(String text, BitmapFont font) {
......
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