diff --git a/android/assets/font/Roboto-Bold_10.ttf b/android/assets/font/Roboto-Bold_10.ttf new file mode 100644 index 0000000000000000000000000000000000000000..072b842925fd64f0964d6dc3735a65f856b01a32 Binary files /dev/null and b/android/assets/font/Roboto-Bold_10.ttf differ diff --git a/android/assets/font/Roboto-Bold_12.ttf b/android/assets/font/Roboto-Bold_12.ttf new file mode 100644 index 0000000000000000000000000000000000000000..072b842925fd64f0964d6dc3735a65f856b01a32 Binary files /dev/null and b/android/assets/font/Roboto-Bold_12.ttf differ diff --git a/android/assets/font/Roboto-Bold_14.ttf b/android/assets/font/Roboto-Bold_14.ttf new file mode 100644 index 0000000000000000000000000000000000000000..072b842925fd64f0964d6dc3735a65f856b01a32 Binary files /dev/null and b/android/assets/font/Roboto-Bold_14.ttf differ diff --git a/android/assets/font/Roboto-Bold_16.ttf b/android/assets/font/Roboto-Bold_16.ttf new file mode 100644 index 0000000000000000000000000000000000000000..072b842925fd64f0964d6dc3735a65f856b01a32 Binary files /dev/null and b/android/assets/font/Roboto-Bold_16.ttf differ diff --git a/android/assets/font/Roboto-Bold_18.ttf b/android/assets/font/Roboto-Bold_18.ttf new file mode 100644 index 0000000000000000000000000000000000000000..072b842925fd64f0964d6dc3735a65f856b01a32 Binary files /dev/null and b/android/assets/font/Roboto-Bold_18.ttf differ diff --git a/android/assets/font/Roboto-Bold_20.ttf b/android/assets/font/Roboto-Bold_20.ttf new file mode 100644 index 0000000000000000000000000000000000000000..072b842925fd64f0964d6dc3735a65f856b01a32 Binary files /dev/null and b/android/assets/font/Roboto-Bold_20.ttf differ diff --git a/android/assets/font/Roboto-Bold_20_nofilter.ttf b/android/assets/font/Roboto-Bold_20_nofilter.ttf new file mode 100644 index 0000000000000000000000000000000000000000..072b842925fd64f0964d6dc3735a65f856b01a32 Binary files /dev/null and b/android/assets/font/Roboto-Bold_20_nofilter.ttf differ diff --git a/android/assets/font/Roboto-Bold_26.ttf b/android/assets/font/Roboto-Bold_26.ttf new file mode 100644 index 0000000000000000000000000000000000000000..072b842925fd64f0964d6dc3735a65f856b01a32 Binary files /dev/null and b/android/assets/font/Roboto-Bold_26.ttf differ diff --git a/android/assets/font/Roboto-Bold_30.ttf b/android/assets/font/Roboto-Bold_30.ttf new file mode 100644 index 0000000000000000000000000000000000000000..072b842925fd64f0964d6dc3735a65f856b01a32 Binary files /dev/null and b/android/assets/font/Roboto-Bold_30.ttf differ diff --git a/android/assets/font/Roboto-Regular_10.ttf b/android/assets/font/Roboto-Regular_10.ttf new file mode 100644 index 0000000000000000000000000000000000000000..0ba95c98c467518fb352517c31603c993763272c Binary files /dev/null and b/android/assets/font/Roboto-Regular_10.ttf differ diff --git a/android/assets/font/Roboto-Regular_12.ttf b/android/assets/font/Roboto-Regular_12.ttf new file mode 100644 index 0000000000000000000000000000000000000000..0ba95c98c467518fb352517c31603c993763272c Binary files /dev/null and b/android/assets/font/Roboto-Regular_12.ttf differ diff --git a/android/assets/font/Roboto-Regular_14.ttf b/android/assets/font/Roboto-Regular_14.ttf new file mode 100644 index 0000000000000000000000000000000000000000..0ba95c98c467518fb352517c31603c993763272c Binary files /dev/null and b/android/assets/font/Roboto-Regular_14.ttf differ diff --git a/android/assets/font/Roboto-Regular_14_nofilter.ttf b/android/assets/font/Roboto-Regular_14_nofilter.ttf new file mode 100644 index 0000000000000000000000000000000000000000..0ba95c98c467518fb352517c31603c993763272c Binary files /dev/null and b/android/assets/font/Roboto-Regular_14_nofilter.ttf differ diff --git a/android/assets/font/Roboto-Regular_16.ttf b/android/assets/font/Roboto-Regular_16.ttf new file mode 100644 index 0000000000000000000000000000000000000000..0ba95c98c467518fb352517c31603c993763272c Binary files /dev/null and b/android/assets/font/Roboto-Regular_16.ttf differ diff --git a/android/assets/font/Roboto-Regular_18.ttf b/android/assets/font/Roboto-Regular_18.ttf new file mode 100644 index 0000000000000000000000000000000000000000..0ba95c98c467518fb352517c31603c993763272c Binary files /dev/null and b/android/assets/font/Roboto-Regular_18.ttf differ diff --git a/android/assets/font/Roboto-Regular_20.ttf b/android/assets/font/Roboto-Regular_20.ttf new file mode 100644 index 0000000000000000000000000000000000000000..0ba95c98c467518fb352517c31603c993763272c Binary files /dev/null and b/android/assets/font/Roboto-Regular_20.ttf differ diff --git a/android/assets/font/Roboto-Regular_26.ttf b/android/assets/font/Roboto-Regular_26.ttf new file mode 100644 index 0000000000000000000000000000000000000000..0ba95c98c467518fb352517c31603c993763272c Binary files /dev/null and b/android/assets/font/Roboto-Regular_26.ttf differ diff --git a/android/assets/font/Roboto-Regular_30.ttf b/android/assets/font/Roboto-Regular_30.ttf new file mode 100644 index 0000000000000000000000000000000000000000..0ba95c98c467518fb352517c31603c993763272c Binary files /dev/null and b/android/assets/font/Roboto-Regular_30.ttf differ diff --git a/core/src/cz/nic/tablexia/game/AbstractTablexiaGame.java b/core/src/cz/nic/tablexia/game/AbstractTablexiaGame.java index 032fdca883e4682866e28c071314bfe3a4418437..bbf874e5b65076b885b0adba83185b3e9088decd 100644 --- a/core/src/cz/nic/tablexia/game/AbstractTablexiaGame.java +++ b/core/src/cz/nic/tablexia/game/AbstractTablexiaGame.java @@ -118,17 +118,13 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T> 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 Color VICTORY_DIALOG_BUTTON_TEXT_FONT_COLOR = Color.BLACK; + private static final ApplicationFontManager.FontType VICTORY_DIALOG_BUTTON_TEXT_FONT_TYPE = ApplicationFontManager.FontType.ROBOTO_BOLD_14; 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_SUMMARY_IMAGE_SIZE = 0.7f; private static final Color VICTORY_DIALOG_SUMMARY_FONT_COLOR = Color.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"; @@ -423,13 +419,18 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T> private class VictoryDialog extends TwoButtonDialog { - public static final int RATINGSTARS_COUNT = 3; - public static final float RATINGSTAR_DELAY = 0.5f; + public static final int RATINGSTARS_COUNT = 3; + public static final float RATINGSTAR_DELAY = 0.5f; - public static final float RESULTSBANNER_WIDTH_RATIO = 2f / 3; - public static final float RESULTSBANNER_TOPPADDING_RATIO = 1f / 30; - public static final float RATINGSTAR_HEIGHT_RATIO = 1f / 8; - public static final float TEXT_TOP_PADDING_RATIO = 1f / 15; + public static final float RESULTSBANNER_WIDTH_RATIO = 2f / 3; + public static final float CONTENT_ITEMS_TOPPADDING_RATIO = 1f / 30; + public static final float RATINGSTAR_HEIGHT_RATIO = 1f / 8; + public static final float TEXT_TOP_PADDING_RATIO = 1f / 15; + private static final int SUMMARY_TEXT_BOTTOM_PADDING = 10; + + private final ApplicationFontManager.FontType SUMMARY_TEXT_FONT = ApplicationFontManager.FontType.ROBOTO_REGULAR_14; + private final ApplicationFontManager.FontType RESULT_TEXT_FONT = ApplicationFontManager.FontType.ROBOTO_REGULAR_16; + private final Color DIALOG_FONTS_COLOR = Color.BLACK; private Image[] ratingStarsEnabled; private Music victorySpeech; @@ -457,7 +458,7 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T> @Override public Cell<Label> addLabel(String text, BitmapFont font) { - Cell<Label> labelCell = super.addLabel(text, font); + Cell<Label> labelCell = addLabel(text, new Label.LabelStyle(font, DIALOG_FONTS_COLOR), getTextAlignment(), 1); labelCell.padTop(getHeight() * TEXT_TOP_PADDING_RATIO); return labelCell; } @@ -468,7 +469,7 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T> Image resultsBanner = new Image(getGameGlobalTextureRegion(VICTORY_DIALOG_RESULTSBANNER)); float resultBannerWidth = getWidth() * RESULTSBANNER_WIDTH_RATIO; float resultsBannerSizeRatio = resultBannerWidth / resultsBanner.getWidth(); - addImage(resultsBanner, resultsBannerSizeRatio).center().colspan(3); + addImage(resultsBanner, resultsBannerSizeRatio).center().colspan(3).padTop(getHeight() * CONTENT_ITEMS_TOPPADDING_RATIO); // RATING STARS getContentTable().row(); @@ -477,7 +478,7 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T> for (int i = 0; i < RATINGSTARS_COUNT; i++) { createRatingStar(i, ratingStarTable); } - getContentTable().add(ratingStarTable).center(); + getContentTable().add(ratingStarTable).center().padTop(getHeight() * CONTENT_ITEMS_TOPPADDING_RATIO); getContentTable().row(); // MAIN TEXT @@ -490,7 +491,7 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T> } getContentTable().row(); - addLabel(victoryDialogText, ApplicationFontManager.getInstance().getFont(VICTORY_DIALOG_TEXT_FONT_TYPE)); + addLabel(victoryDialogText, getFont(RESULT_TEXT_FONT)); getContentTable().row(); // SUMMARY TEXT @@ -501,7 +502,7 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T> horizontalGroup.addActor(createSummaryGroup(summaryMessage)); } } - getContentTable().add(horizontalGroup).padBottom(15).center(); + getContentTable().add(horizontalGroup).padBottom(SUMMARY_TEXT_BOTTOM_PADDING).padTop(getHeight() * CONTENT_ITEMS_TOPPADDING_RATIO).center(); getContentTable().row(); showTrophies(); @@ -539,10 +540,9 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T> } if (summaryMessage.getText() != null) { - BitmapFont font = ApplicationFontManager.getInstance().getFont(VICTORY_DIALOG_SUMMARY_FONT_TYPE); + BitmapFont font = getFont(SUMMARY_TEXT_FONT); 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); } @@ -610,7 +610,6 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T> @Override public void createButton(TablexiaButton 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); } diff --git a/core/src/cz/nic/tablexia/game/games/in_the_darkness/InTheDarknessGame.java b/core/src/cz/nic/tablexia/game/games/in_the_darkness/InTheDarknessGame.java index 224d94ad5e795a78e74aa0f83fe8eae4288f6c59..207060c11e5d6c361b7591ee8de711acfbdee191 100644 --- a/core/src/cz/nic/tablexia/game/games/in_the_darkness/InTheDarknessGame.java +++ b/core/src/cz/nic/tablexia/game/games/in_the_darkness/InTheDarknessGame.java @@ -45,7 +45,7 @@ import static com.badlogic.gdx.scenes.scene2d.actions.Actions.parallel; import static com.badlogic.gdx.scenes.scene2d.actions.Actions.run; import static com.badlogic.gdx.scenes.scene2d.actions.Actions.scaleTo; import static com.badlogic.gdx.scenes.scene2d.actions.Actions.sequence; -import static cz.nic.tablexia.util.ui.TablexiaButton.*; +import static cz.nic.tablexia.util.ui.TablexiaButton.ButtonType; /** * Created by Matyáš Latner on 7.9.15. @@ -142,12 +142,11 @@ public class InTheDarknessGame extends AbstractTablexiaGame<List<MapWidget>> imp private static final double KEY_ICON_TILE_SIZE_RATION_X = 0.7; private static final double KEY_ICON_TILE_SIZE_RATION_Y = 0.4; - private static final float START_BUTTON_FONT_SCALE = 0.8f; private static final int START_BUTTON_WIDTH = 135; private static final int START_BUTTON_HEIGHT = 72; private static final float START_BUTTON_X_OFFSET_RATIO = 1f / 4; private static final float START_BUTTON_Y_OFFSET_RATIO = 1f / 4; - private static final ButtonType START_BUTTON_TYPE = ButtonType.GREEN; + private static final ButtonType START_BUTTON_TYPE = ButtonType.GREEN; private static final String START_BUTTON_TEXT_KEY = "complete"; public static final float ANIMATION_DURATION = 0.4f; @@ -531,7 +530,6 @@ public class InTheDarknessGame extends AbstractTablexiaGame<List<MapWidget>> imp setTouchable(isDisabled ? Touchable.disabled : Touchable.enabled); } }; - startButton.getLabel().setFontScale(START_BUTTON_FONT_SCALE); startButton.setSize(START_BUTTON_WIDTH, START_BUTTON_HEIGHT); startButton.setPosition(MAP_START_POSITION_X + (MAP_X_SIZE * TILE_SIZE) + (startButton.getWidth() * START_BUTTON_X_OFFSET_RATIO), MAP_START_POSITION_Y - (startButton.getHeight() * START_BUTTON_Y_OFFSET_RATIO)); diff --git a/core/src/cz/nic/tablexia/game/games/in_the_darkness/map/widget/MapWidget.java b/core/src/cz/nic/tablexia/game/games/in_the_darkness/map/widget/MapWidget.java index 48a1a5c92ca97981d0de390963c598a4bd5dd1d7..4fda538c1200ba3d011d4c3e27008ab11eb33e36 100644 --- a/core/src/cz/nic/tablexia/game/games/in_the_darkness/map/widget/MapWidget.java +++ b/core/src/cz/nic/tablexia/game/games/in_the_darkness/map/widget/MapWidget.java @@ -39,13 +39,13 @@ import cz.nic.tablexia.util.ui.ClickListenerWithSound; public class MapWidget extends Group { - private static final float BOOKMARKBUTTON_TILE_SIZE_RATIO_HEIGHT = 0.3f; - private static final float BOOKMARKBUTTON_TILE_SIZE_RATIO_WIDTH = 1.5f; - public static final Color BOOKMARKBUTTON_BACKGROUND_COLOR_CHECKED = new Color(0.428f, 0.369f, 0.350f, 1f); - public static final Color BOOKMARKBUTTON_BACKGROUND_COLOR_UP = new Color(0.588f, 0.529f, 0.510f, 1f); - private static final Color BOOKMARKBUTTON_TEXT_COLOR = Color.BLACK; - private static final float BOOKMARKBUTTON_TEXT_SCALE = 0.8f; - private static final float BOOKMARKBUTTON_PADDING_RATIO = 1f / 20; + private static final float BOOKMARKBUTTON_TILE_SIZE_RATIO_HEIGHT = 0.3f; + private static final float BOOKMARKBUTTON_TILE_SIZE_RATIO_WIDTH = 1.5f; + public static final Color BOOKMARKBUTTON_BACKGROUND_COLOR_CHECKED = new Color(0.428f, 0.369f, 0.350f, 1f); + public static final Color BOOKMARKBUTTON_BACKGROUND_COLOR_UP = new Color(0.588f, 0.529f, 0.510f, 1f); + private static final Color BOOKMARKBUTTON_TEXT_COLOR = Color.BLACK; + private static final float BOOKMARKBUTTON_PADDING_RATIO = 1f / 20; + private static final ApplicationFontManager.FontType BOOKMARK_TITLE_TEXT_FONT = ApplicationFontManager.FontType.ROBOTO_REGULAR_16; private Group mapLayer; private Group backgroundLayer; @@ -88,21 +88,12 @@ public class MapWidget extends Group { return this; } -// public void setClickable(boolean clickable) { -// if (bookmarkButton != null) { -// bookmarkButton.setTouchable(clickable ? Touchable.enabled : Touchable.disabled); -// } -// } - public TileMap getTileMap() { return tileMap; } public void setClickable(TileMapClickListener tileMapClickListener) { this.tileMapClickListener = tileMapClickListener; -// if (bookmarkButton != null) { -// scene.registerTouchArea(bookmarkButton); -// } } public void setInFront() { @@ -124,13 +115,12 @@ public class MapWidget extends Group { float bookmarkHeight = InTheDarknessGame.TILE_SIZE * BOOKMARKBUTTON_TILE_SIZE_RATIO_HEIGHT; TextButton.TextButtonStyle bookmarkButtonStyle = new TextButton.TextButtonStyle(); - bookmarkButtonStyle.font = ApplicationFontManager.getInstance().getDefaultApplicationRegularFont(); + bookmarkButtonStyle.font = ApplicationFontManager.getInstance().getFont(BOOKMARK_TITLE_TEXT_FONT); bookmarkButtonStyle.fontColor = BOOKMARKBUTTON_TEXT_COLOR; bookmarkButtonStyle.checked = new SpriteDrawable(new Sprite(ApplicationAtlasManager.getInstance().getColorTextureRegion(BOOKMARKBUTTON_BACKGROUND_COLOR_CHECKED))); bookmarkButtonStyle.up = new SpriteDrawable(new Sprite(ApplicationAtlasManager.getInstance().getColorTextureRegion(BOOKMARKBUTTON_BACKGROUND_COLOR_UP))); bookmarkButton = new TextButton((floorNumber + 1) + ". " + buttonText, bookmarkButtonStyle); - bookmarkButton.getLabel().setFontScale(BOOKMARKBUTTON_TEXT_SCALE); bookmarkButton.setBounds(floorNumber * (bookmarkWidth + (bookmarkWidth * BOOKMARKBUTTON_PADDING_RATIO)), -(bookmarkHeight + 2), bookmarkWidth, diff --git a/core/src/cz/nic/tablexia/game/games/kidnapping/actors/EarOverlay.java b/core/src/cz/nic/tablexia/game/games/kidnapping/actors/EarOverlay.java index 0dee5ae520583db9cc1bd434996e66c221733a49..058ef43ecf1874e37c4557b2022591f38155c9ee 100644 --- a/core/src/cz/nic/tablexia/game/games/kidnapping/actors/EarOverlay.java +++ b/core/src/cz/nic/tablexia/game/games/kidnapping/actors/EarOverlay.java @@ -2,26 +2,28 @@ package cz.nic.tablexia.game.games.kidnapping.actors; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Texture; -import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.scenes.scene2d.Group; import com.badlogic.gdx.scenes.scene2d.ui.Image; import com.badlogic.gdx.scenes.scene2d.ui.Label; +import cz.nic.tablexia.loader.application.ApplicationFontManager; + /** * Created by lhoracek on 5/19/15. */ public class EarOverlay extends Group { + + private static final ApplicationFontManager.FontType FONT_TYPE = ApplicationFontManager.FontType.ROBOTO_REGULAR_30; + private static final Color FONT_COLOR = Color.WHITE; + private Image ear, overlay; private Label text; public EarOverlay(String text, Texture overlayTexture, TextureRegion earTexture) { this.addActor(overlay = new Image(overlayTexture)); this.addActor(ear = new Image(earTexture)); - - BitmapFont bf = new BitmapFont(); // TODO change font - bf.getData().setScale(3); - this.addActor(this.text = new Label(text, new Label.LabelStyle(bf, Color.WHITE))); + this.addActor(this.text = new Label(text, new Label.LabelStyle(ApplicationFontManager.getInstance().getFont(FONT_TYPE), FONT_COLOR))); } @Override @@ -32,10 +34,6 @@ public class EarOverlay extends Group { text.setPosition(getWidth() / 2 - text.getWidth() / 2, getHeight() / 5 - text.getHeight() / 2); } - public Image getEar() { - return ear; - } - public Label getText() { return text; } diff --git a/core/src/cz/nic/tablexia/game/games/kidnapping/actors/ReplayButton.java b/core/src/cz/nic/tablexia/game/games/kidnapping/actors/ReplayButton.java index 064b9af0ce3af502b43cd89b16d73ba5c90317b2..6032467493b82f77d8328a72d069f2130fdaeee8 100644 --- a/core/src/cz/nic/tablexia/game/games/kidnapping/actors/ReplayButton.java +++ b/core/src/cz/nic/tablexia/game/games/kidnapping/actors/ReplayButton.java @@ -9,10 +9,13 @@ import cz.nic.tablexia.util.ui.TablexiaButton; */ public class ReplayButton extends TablexiaButton { + private static final String REPLAY_BUTTON_TEXT_KEY = "game_kidnapping_replay"; + private static final int WIDTH = 200; + private static final int HEIGHT = 80; + public ReplayButton(KidnappingGame screen) { - // TODO fix getting text through screen - super(screen.getText("game_kidnapping_replay"), ButtonType.GREEN); - setSize(150, 80); + super(screen.getText(REPLAY_BUTTON_TEXT_KEY), ButtonType.GREEN); + setSize(WIDTH, HEIGHT); setDisabled(true); } } diff --git a/core/src/cz/nic/tablexia/game/games/robbery/GameScreen.java b/core/src/cz/nic/tablexia/game/games/robbery/GameScreen.java index 9c6bab779f7796678964027455e15c8413563454..8a3cf508369bbf1a7e41e28e98bf0df19c9dd247 100644 --- a/core/src/cz/nic/tablexia/game/games/robbery/GameScreen.java +++ b/core/src/cz/nic/tablexia/game/games/robbery/GameScreen.java @@ -23,6 +23,7 @@ import java.util.Random; import cz.nic.tablexia.game.difficulty.GameDifficulty; import cz.nic.tablexia.game.games.robbery.assets.RobberyAssets; import cz.nic.tablexia.game.games.robbery.creature.CreatureRoot; +import cz.nic.tablexia.loader.application.ApplicationFontManager; import cz.nic.tablexia.util.ui.TablexiaNoBlendingImage; import static com.badlogic.gdx.scenes.scene2d.actions.Actions.alpha; @@ -226,9 +227,10 @@ public class GameScreen extends AbstractRobberyScreen { private static final float COLORBANNER_X_POSITION_RATIO = 1f/2; private static final float COLORBANNER_WIDTH_RATIO = 1f/3; - private static final float PERSON_COUNTER_POSITION_X_RATIO = 5f/6; - private static final float PERSON_COUNTER_POSITION_Y_RATIO = 1f/4; - private static final Color PERSON_COUNTER_TEXT_COLOR = Color.WHITE; + private static final float PERSON_COUNTER_POSITION_X_RATIO = 5f/6; + private static final float PERSON_COUNTER_POSITION_Y_RATIO = 1f/4; + private static final Color PERSON_COUNTER_TEXT_COLOR = Color.WHITE; + private static final ApplicationFontManager.FontType PERSON_COUNTER_FONT = ApplicationFontManager.FontType.ROBOTO_BOLD_20; private static final Interpolation INFOITEM_HIDE_INTERPOLATION = Interpolation.pow4In; private static final Interpolation INFOITEM_SHOW_ALPHA_INTERPOLATION = Interpolation.pow4Out; @@ -316,7 +318,7 @@ public class GameScreen extends AbstractRobberyScreen { getSceneWidth() + BACKGROUND_BOTTOM_WIDTH_CORRECTION_OFFSET, getSceneOuterHeight()); - personCounter = new Label("", new Label.LabelStyle(getDefaultBoldFont(), PERSON_COUNTER_TEXT_COLOR)); + personCounter = new Label("", new Label.LabelStyle(getFont(PERSON_COUNTER_FONT), PERSON_COUNTER_TEXT_COLOR)); personCounter.setPosition(width * PERSON_COUNTER_POSITION_X_RATIO, height * PERSON_COUNTER_POSITION_Y_RATIO); getStage().addActor(doorBackground); diff --git a/core/src/cz/nic/tablexia/game/games/robbery/RuleScreen.java b/core/src/cz/nic/tablexia/game/games/robbery/RuleScreen.java index 9d2ca7f1cfdaf3295a558d877d9c58d769c52134..29e275ac7569d49a6bcb0e22b24aae6c181d6abe 100644 --- a/core/src/cz/nic/tablexia/game/games/robbery/RuleScreen.java +++ b/core/src/cz/nic/tablexia/game/games/robbery/RuleScreen.java @@ -14,6 +14,7 @@ import java.util.Map; import cz.nic.tablexia.game.games.robbery.assets.RobberyAssets; import cz.nic.tablexia.loader.application.ApplicationAtlasManager; +import cz.nic.tablexia.loader.application.ApplicationFontManager; import cz.nic.tablexia.util.ui.TablexiaButton; import cz.nic.tablexia.util.ui.TablexiaNoBlendingImage; @@ -23,7 +24,6 @@ public class RuleScreen extends AbstractRobberyScreen { private static final float LABEL_Y_POSITION_RATIO = 23f/40; private static final Color LABEL_TEXT_COLOR = Color.GRAY; - private static final float LABEL_FONT_SCALE = 0.8f; private static final float TITLE_PAPER_POSITION_X_OFFSET = 1f/20; private static final float TITLE_PAPER_Y_POSITION_RATIO = 3f/5; @@ -103,10 +103,9 @@ public class RuleScreen extends AbstractRobberyScreen { float labelWidth = paperWidth * TITLE_WIDTH_RATIO; float labelHeight = paperHeight * TITLE_HEIGHT_RATIO; - BitmapFont font = getDefaultRegularFont(); + BitmapFont font = getFont(ApplicationFontManager.FontType.ROBOTO_REGULAR_18); font.getData().markupEnabled = true; Label label = new Label(getData().getRuleMessageText(this), new LabelStyle(font, LABEL_TEXT_COLOR)); - label.setFontScale(LABEL_FONT_SCALE); label.setWrap(true); label.setBounds(paperX + (paperWidth / 2) - (labelWidth / 2), paperY + (paperHeight * LABEL_Y_POSITION_RATIO) - labelHeight, diff --git a/core/src/cz/nic/tablexia/game/games/shooting_range/ShootingRangeGame.java b/core/src/cz/nic/tablexia/game/games/shooting_range/ShootingRangeGame.java index bafa78ac33b82aa551fd0cc683f105755ecff6f9..449f665d9e05d6d715481f219658fbe6e7889a04 100644 --- a/core/src/cz/nic/tablexia/game/games/shooting_range/ShootingRangeGame.java +++ b/core/src/cz/nic/tablexia/game/games/shooting_range/ShootingRangeGame.java @@ -31,6 +31,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.loader.application.ApplicationFontManager; import cz.nic.tablexia.model.game.Game; /** @@ -38,6 +39,9 @@ import cz.nic.tablexia.model.game.Game; */ public class ShootingRangeGame extends AbstractTablexiaGame<GameState> { + private static final ApplicationFontManager.FontType SCORE_COUNTER_TEXT_FONT = ApplicationFontManager.FontType.ROBOTO_BOLD_20; + private static final Color SCORE_COUNTER_TEXT_COLOR = Color.WHITE; + private GfxLibrary gfxLibrary = new GfxLibrary(this, TextureType.values()); private SfxLibrary sfxLibrary = new SfxLibrary(this, SoundType.values()); @@ -254,7 +258,7 @@ public class ShootingRangeGame extends AbstractTablexiaGame<GameState> { watch.setScale(0.4f); getStage().addActor(carousel = new Carousel(gfxLibrary)); carousel.setScale(0.6f); - Label.LabelStyle labelStyle = new Label.LabelStyle(getDefaultBoldFont(), Color.WHITE); + Label.LabelStyle labelStyle = new Label.LabelStyle(getFont(SCORE_COUNTER_TEXT_FONT), SCORE_COUNTER_TEXT_COLOR); getStage().addActor(score = new Label("0", labelStyle)); screenResized((int) getStage().getWidth(), (int) getStage().getHeight()); diff --git a/core/src/cz/nic/tablexia/loader/application/ApplicationFontManager.java b/core/src/cz/nic/tablexia/loader/application/ApplicationFontManager.java index 47e1ad529db78ea386327c8bd0c1e558bcc122f7..bb880cbb97db7c8b91488178fabbc1642c5cdd1a 100644 --- a/core/src/cz/nic/tablexia/loader/application/ApplicationFontManager.java +++ b/core/src/cz/nic/tablexia/loader/application/ApplicationFontManager.java @@ -21,6 +21,50 @@ import cz.nic.tablexia.loader.IApplicationLoader; */ public class ApplicationFontManager extends AssetManager implements IApplicationLoader { + public enum FontType { + + ROBOTO_REGULAR_10 ("Roboto-Regular_10.ttf", 10, true), + ROBOTO_REGULAR_12 ("Roboto-Regular_12.ttf", 12, true), + ROBOTO_REGULAR_14 ("Roboto-Regular_14.ttf", 14, true), + ROBOTO_REGULAR_14_NOFILTER ("Roboto-Regular_14_nofilter.ttf", 14, false), + ROBOTO_REGULAR_16 ("Roboto-Regular_16.ttf", 16, true), + ROBOTO_REGULAR_18 ("Roboto-Regular_18.ttf", 18, true), + ROBOTO_REGULAR_20 ("Roboto-Regular_20.ttf", 20, true), + ROBOTO_REGULAR_26 ("Roboto-Regular_26.ttf", 26, true), + ROBOTO_REGULAR_30 ("Roboto-Regular_30.ttf", 30, true), + ROBOTO_BOLD_10 ("Roboto-Bold_10.ttf", 10, true), + ROBOTO_BOLD_12 ("Roboto-Bold_12.ttf", 12, true), + ROBOTO_BOLD_14 ("Roboto-Bold_14.ttf", 14, true), + ROBOTO_BOLD_16 ("Roboto-Bold_16.ttf", 16, true), + ROBOTO_BOLD_18 ("Roboto-Bold_18.ttf", 18, true), + ROBOTO_BOLD_20 ("Roboto-Bold_20.ttf", 20, true), + ROBOTO_BOLD_20_NOFILTER ("Roboto-Bold_20_nofilter.ttf", 20, false), + ROBOTO_BOLD_26 ("Roboto-Bold_26.ttf", 26, true), + ROBOTO_BOLD_30 ("Roboto-Bold_30.ttf", 30, true); + + private String fontName; + private int size; + private boolean filtering; + + FontType(String fontName, int size, boolean filtering) { + this.fontName = fontName; + this.size = size; + this.filtering = filtering; + } + + public String getFontName() { + return FONT_PATH + fontName; + } + + public int getSize() { + return size; + } + + public boolean isFiltering() { + return filtering; + } + } + private static final int FONT_SIZE = 20; private static final String FONT_PATH = "font/"; public static final String FONT_ROBOTO_REGULAR = FONT_PATH + "Roboto-Regular.ttf"; @@ -53,6 +97,22 @@ public class ApplicationFontManager extends AssetManager implements IApplication public void load() { loadFont(FONT_ROBOTO_REGULAR); loadFont(FONT_ROBOTO_BOLD); + + for (FontType fontType: FontType.values()) { + loadFont(fontType); + } + } + + private void loadFont(FontType fontType) { + FreeTypeFontLoaderParameter fontParams = new FreeTypeFontLoaderParameter(); + fontParams.fontFileName = fontType.getFontName(); + fontParams.fontParameters.size = fontType.getSize(); + fontParams.fontParameters.characters = FreeTypeFontGenerator.DEFAULT_CHARS + TablexiaSettings.LocaleDefinition.getAllSpecialCharacters(); + if (fontType.isFiltering()) { + fontParams.fontParameters.minFilter = TextureFilter.Linear; + fontParams.fontParameters.magFilter = TextureFilter.Linear; + } + load(fontType.getFontName(), BitmapFont.class, fontParams); } private void loadFont(String fontFile) { @@ -65,14 +125,21 @@ public class ApplicationFontManager extends AssetManager implements IApplication load(fontFile, BitmapFont.class, fontParams); } + public BitmapFont getFont(FontType fontType) { + return get(fontType.getFontName(), BitmapFont.class); + } + + @Deprecated public BitmapFont getFont(String fontName) { return get(fontName, BitmapFont.class); } + @Deprecated public BitmapFont getDefaultApplicationRegularFont() { return getFont(APPLICATION_DEFAULT_FONT_REGULAR); } + @Deprecated public BitmapFont getDefaultApplicationBoldFont() { return getFont(APPLICATION_DEFAULT_FONT_BOLD); } diff --git a/core/src/cz/nic/tablexia/menu/AbstractMenu.java b/core/src/cz/nic/tablexia/menu/AbstractMenu.java index 0d50fdea21a5ea6e339d31b71934a33d7ff24236..568110458ad16506aac8f3975cd2f61056ec43fd 100644 --- a/core/src/cz/nic/tablexia/menu/AbstractMenu.java +++ b/core/src/cz/nic/tablexia/menu/AbstractMenu.java @@ -129,6 +129,7 @@ public abstract class AbstractMenu extends Stack implements Disposable { private Action moveAction; private boolean isClosing; private boolean isOpening; + private Boolean lastPauseState; private final Stack backgroundStack; private boolean disableMenuGravity = false; @@ -342,7 +343,6 @@ public abstract class AbstractMenu extends Stack implements Disposable { public void run() { moveAction = null; isClosing = false; - menuPositionChanged(); } })); addAction(moveAction); @@ -350,7 +350,6 @@ public abstract class AbstractMenu extends Stack implements Disposable { moveAction = null; isClosing = false; setPosition(menuHidePositionX, menuPositionY); - menuPositionChanged(); } } } @@ -369,7 +368,6 @@ public abstract class AbstractMenu extends Stack implements Disposable { public void run() { moveAction = null; isClosing = false; - menuPositionChanged(); } })); addAction(moveAction); @@ -377,7 +375,6 @@ public abstract class AbstractMenu extends Stack implements Disposable { moveAction = null; isClosing = false; setPosition(menuClosePositionX, menuPositionY); - menuPositionChanged(); } } } @@ -387,7 +384,6 @@ public abstract class AbstractMenu extends Stack implements Disposable { removeMoveAction(); isClosing = false; isOpening = true; - menuPositionChanged(); if (animated) { moveAction = Actions.sequence( Actions.moveTo(menuOpenPositionX, menuPositionY, MENU_MOVE_DURATION, MENU_MOVE_INTERPOLATION), @@ -415,24 +411,16 @@ public abstract class AbstractMenu extends Stack implements Disposable { } -//////////////////////////// POSITION CHANGED EVENT +//////////////////////////// POSITION CHANGED - public static class MenuOpenEvent implements ApplicationBus.ApplicationEvent { - - private boolean isMenuOpen; - - private MenuOpenEvent(boolean isMenuOpen) { - this.isMenuOpen = isMenuOpen; - } - - public boolean isMenuOpen() { - return isMenuOpen; + @Override + protected void positionChanged() { + boolean pauseState = isScreenPause() && !isMenuHidden() && !isMenuClose(); + if (lastPauseState == null || lastPauseState != pauseState) { + lastPauseState = pauseState; + ApplicationBus.getInstance().post(new MenuPauseEvent(pauseState)).asynchronously(); } - } - - private void menuPositionChanged() { - ApplicationBus.getInstance().post(new MenuOpenEvent(!isMenuHidden() && !isMenuClose())).asynchronously(); - ApplicationBus.getInstance().post(new MenuPauseEvent(isScreenPause() && !isMenuHidden() && !isMenuClose())).asynchronously(); + super.positionChanged(); } diff --git a/core/src/cz/nic/tablexia/menu/game/GameMenuItemGroup.java b/core/src/cz/nic/tablexia/menu/game/GameMenuItemGroup.java index 1ee9272a30a97779925db7e6f5893f73866100c8..0b3e0843aba6616efb415774c35a7658864c28fb 100644 --- a/core/src/cz/nic/tablexia/menu/game/GameMenuItemGroup.java +++ b/core/src/cz/nic/tablexia/menu/game/GameMenuItemGroup.java @@ -32,13 +32,11 @@ public class GameMenuItemGroup extends Container<Table> { private static final Color HIGHLITED_COLOR = new Color(0.780f, 0.698f, 0.600f, 1); - private static final String TITLE_FONT_TYPE = ApplicationFontManager.APPLICATION_DEFAULT_FONT_BOLD; - private static final Color TITLE_FONT_COLOR = new Color(0.325f, 0.278f, 0.255f, 1); - private static final float TITLE_FONT_SCALE = 0.9f; + private static final ApplicationFontManager.FontType TITLE_FONT_TYPE = ApplicationFontManager.FontType.ROBOTO_BOLD_18; + private static final Color TITLE_FONT_COLOR = new Color(0.325f, 0.278f, 0.255f, 1); - private static final String DESCRIPTION_FONT_TYPE = ApplicationFontManager.APPLICATION_DEFAULT_FONT_REGULAR; - private static final Color DESCRIPTION_FONT_COLOR = new Color(0.325f, 0.278f, 0.255f, 1); - private static final float DESCRIPTION_FONT_SCALE = 0.6f; + private static final ApplicationFontManager.FontType DESCRIPTION_FONT_TYPE = ApplicationFontManager.FontType.ROBOTO_REGULAR_12; + private static final Color DESCRIPTION_FONT_COLOR = new Color(0.325f, 0.278f, 0.255f, 1); private static final float LABLES_PADDING_LEFT_RATIO = 1f / 40; private static final float LABELS_PADDING_DEFAULT = 5f; @@ -96,10 +94,8 @@ public class GameMenuItemGroup extends Container<Table> { // texts Label titleLabel = new Label(menuItem.getTitle(), new Label.LabelStyle(ApplicationFontManager.getInstance().getFont(TITLE_FONT_TYPE), TITLE_FONT_COLOR)); titleLabel.setWrap(true); - titleLabel.setFontScale(TITLE_FONT_SCALE); Label descritopnLabel = new Label(menuItem.getDescription(), new Label.LabelStyle(ApplicationFontManager.getInstance().getFont(DESCRIPTION_FONT_TYPE), DESCRIPTION_FONT_COLOR)); descritopnLabel.setWrap(true); - descritopnLabel.setFontScale(DESCRIPTION_FONT_SCALE); Table labelsContainer = new Table(); labelsContainer.add(titleLabel).align(Align.left); labelsContainer.row(); diff --git a/core/src/cz/nic/tablexia/menu/main/MainMenu.java b/core/src/cz/nic/tablexia/menu/main/MainMenu.java index ecf4ca44d2b7d98ca4e73343671d1874f76559ee..9e9252c40244c094751729b7da7f4a7f0ea7d88f 100644 --- a/core/src/cz/nic/tablexia/menu/main/MainMenu.java +++ b/core/src/cz/nic/tablexia/menu/main/MainMenu.java @@ -34,20 +34,19 @@ import cz.nic.tablexia.menu.main.user.UserSelectBox; */ public class MainMenu extends AbstractMenu { - private static final MenuControlType MENU_CONTROL_TYPE = MenuControlType.MANUAL; - private static final boolean MENU_SCREEN_PAUSE = true; - - private static final float MAINMENU_PADDING = 10f; - private static final float SCROLLBAR_PADDING_BOTTOM = 10f; - private static final float SCROLLBAR_PADDING_TOP = 10f; - private static final int SELECTBOX_USER_HEIGHT = 70; - private static final int SELECTBOX_LOCALE_HEIGHT = 40; - private static final float SELECTBOX_LOCALE_TEXT_SCALE = 0.65f; - private static final float SELECTBOX_LOCALE_WIDTH_RATIO = 2f/5; - private static final int APP_NAME_TEXT_ALIGN = Align.left; - private static final float APP_NAME_TEXT_SCALE = 0.5f; - private static final float APP_NAME_TEXT_PADDING_LEFT = 10f; - private static final float APP_NAME_WIDTH_RATIO = 3f/5; + private static final MenuControlType MENU_CONTROL_TYPE = MenuControlType.MANUAL; + private static final boolean MENU_SCREEN_PAUSE = true; + + private static final float MAINMENU_PADDING = 10f; + private static final float SCROLLBAR_PADDING_BOTTOM = 10f; + private static final float SCROLLBAR_PADDING_TOP = 10f; + private static final int SELECTBOX_USER_HEIGHT = 70; + private static final int SELECTBOX_LOCALE_HEIGHT = 40; + private static final float SELECTBOX_LOCALE_WIDTH_RATIO = 2f/5; + private static final ApplicationFontManager.FontType APP_NAME_TEXT_FONT = ApplicationFontManager.FontType.ROBOTO_REGULAR_10; + private static final int APP_NAME_TEXT_ALIGN = Align.left; + private static final float APP_NAME_TEXT_PADDING_LEFT = 10f; + private static final float APP_NAME_WIDTH_RATIO = 3f/5; private Map<IMenuItem, Group> subMenus = new HashMap<IMenuItem, Group>(); private VerticalGroup menuItemsLayout; @@ -92,10 +91,10 @@ public class MainMenu extends AbstractMenu { // Locale SelectBox and App name Table footerTable = new Table(); float footerContentWidth = getBackground().getDrawable().getMinWidth() - (2 * MAINMENU_PADDING) - APP_NAME_TEXT_PADDING_LEFT; - footerTable.add(new LocaleSelectBox(SELECTBOX_LOCALE_HEIGHT, SELECTBOX_LOCALE_TEXT_SCALE)).width(footerContentWidth * SELECTBOX_LOCALE_WIDTH_RATIO); - Label appName = new Label(TablexiaSettings.getInstance().getAppName() + System.lineSeparator() + TablexiaSettings.getInstance().getVersionName(), new Label.LabelStyle(font, Color.BLACK)); + footerTable.add(new LocaleSelectBox(SELECTBOX_LOCALE_HEIGHT)).width(footerContentWidth * SELECTBOX_LOCALE_WIDTH_RATIO); + Label appName = new Label(TablexiaSettings.getInstance().getAppName() + System.lineSeparator() + TablexiaSettings.getInstance().getVersionName(), + new Label.LabelStyle(ApplicationFontManager.getInstance().getFont(APP_NAME_TEXT_FONT), Color.BLACK)); appName.setAlignment(APP_NAME_TEXT_ALIGN); - appName.setFontScale(APP_NAME_TEXT_SCALE); appName.setWrap(true); footerTable.add(appName).width(footerContentWidth * APP_NAME_WIDTH_RATIO).padLeft(APP_NAME_TEXT_PADDING_LEFT); layoutTable.add(footerTable).fillX(); diff --git a/core/src/cz/nic/tablexia/menu/main/locale/LocaleSelectBox.java b/core/src/cz/nic/tablexia/menu/main/locale/LocaleSelectBox.java index 92d8f9edaae14412977e9256ef5594d8deef0e91..7dc4cbe5412047eab5a487febfe148d56fdd4a99 100644 --- a/core/src/cz/nic/tablexia/menu/main/locale/LocaleSelectBox.java +++ b/core/src/cz/nic/tablexia/menu/main/locale/LocaleSelectBox.java @@ -24,10 +24,9 @@ import cz.nic.tablexia.util.ui.AbstractTablexiaSelectBox; */ public class LocaleSelectBox extends AbstractTablexiaSelectBox<LocaleSelectBox.LocaleItem> { - private static final Color LOCALE_TEXT_COLOR = new Color(0.098f, 0.086f, 0.075f, 1f); - private static final int LOCALE_TEXT_ALIGN = Align.center; - - private final float textSize; + private static final ApplicationFontManager.FontType LOCALE_TEXT_FONT = ApplicationFontManager.FontType.ROBOTO_REGULAR_14_NOFILTER; + private static final Color LOCALE_TEXT_COLOR = new Color(0.098f, 0.086f, 0.075f, 1f); + private static final int LOCALE_TEXT_ALIGN = Align.center; public class LocaleItem extends Actor { @@ -41,7 +40,7 @@ public class LocaleSelectBox extends AbstractTablexiaSelectBox<LocaleSelectBox.L this.localeDefinition = localeDefinition; background = ApplicationAtlasManager.getInstance().getPatch(ApplicationAtlasManager.USERMENU_MENUITEM_BACKGROUND); - font = ApplicationFontManager.getInstance().getDefaultApplicationRegularFont(); + font = ApplicationFontManager.getInstance().getFont(LOCALE_TEXT_FONT); text = ApplicationTextManager.getInstance().getText(localeDefinition.getDescriptionKey()); glyphLayout = new GlyphLayout(); } @@ -57,10 +56,8 @@ public class LocaleSelectBox extends AbstractTablexiaSelectBox<LocaleSelectBox.L background.draw(batch, getX(), getY(), getWidth(), getHeight()); - font.getData().setScale(textSize); glyphLayout.setText(font, text, LOCALE_TEXT_COLOR, getWidth(), LOCALE_TEXT_ALIGN, false); font.draw(batch, glyphLayout, getX(), getY() + getHeight() / 2 + font.getLineHeight() / 3); - font.getData().setScale(1f); } } @@ -71,9 +68,8 @@ public class LocaleSelectBox extends AbstractTablexiaSelectBox<LocaleSelectBox.L } }; - public LocaleSelectBox(float itemHeight, float textSize) { + public LocaleSelectBox(float itemHeight) { super(itemHeight); - this.textSize = textSize; ApplicationBus.getInstance().subscribe(this); prepareLocales(); } diff --git a/core/src/cz/nic/tablexia/menu/user/UserMenuNewSelectBoxItemGroup.java b/core/src/cz/nic/tablexia/menu/user/UserMenuNewSelectBoxItemGroup.java index 5c396afb2e25af31ae173739e75bd48684a8325e..b465d730c68cd7024479ad191349343d10261987 100644 --- a/core/src/cz/nic/tablexia/menu/user/UserMenuNewSelectBoxItemGroup.java +++ b/core/src/cz/nic/tablexia/menu/user/UserMenuNewSelectBoxItemGroup.java @@ -18,8 +18,9 @@ import cz.nic.tablexia.menu.main.user.UserSelectBox; */ public abstract class UserMenuNewSelectBoxItemGroup extends Actor implements UserSelectBox.UserSelectBoxItem { - private static final Color NEWUSER_TEXT_COLOR = new Color(0.098f, 0.086f, 0.075f, 1f); - private static final int NEWUSER_TEXT_ALIGN = Align.center; + private static final ApplicationFontManager.FontType NEWUSER_TEXT_FONT = ApplicationFontManager.FontType.ROBOTO_BOLD_20_NOFILTER; + private static final Color NEWUSER_TEXT_COLOR = new Color(0.098f, 0.086f, 0.075f, 1f); + private static final int NEWUSER_TEXT_ALIGN = Align.center; private final NinePatch background; private final BitmapFont font; @@ -27,9 +28,9 @@ public abstract class UserMenuNewSelectBoxItemGroup extends Actor implements Use private final GlyphLayout glyphLayout; public UserMenuNewSelectBoxItemGroup() { - background = ApplicationAtlasManager.getInstance().getPatch(ApplicationAtlasManager.USERMENU_MENUBUTTON_BACKGROUND); - font = ApplicationFontManager.getInstance().getDefaultApplicationBoldFont(); - text = ApplicationTextManager.getInstance().getText(ApplicationTextManager.ApplicationTextsAssets.USERMENU_NEWUSER); + background = ApplicationAtlasManager.getInstance().getPatch(ApplicationAtlasManager.USERMENU_MENUBUTTON_BACKGROUND); + font = ApplicationFontManager.getInstance().getFont(NEWUSER_TEXT_FONT); + text = ApplicationTextManager.getInstance().getText(ApplicationTextManager.ApplicationTextsAssets.USERMENU_NEWUSER); glyphLayout = new GlyphLayout(); } diff --git a/core/src/cz/nic/tablexia/menu/user/UserMenuSelectBoxItemGroup.java b/core/src/cz/nic/tablexia/menu/user/UserMenuSelectBoxItemGroup.java index e8d104c1cd5dc603e28aec6a475d7288bae1c80c..6eb5957a0eab33dc9e104347e87fef65e2775f5c 100644 --- a/core/src/cz/nic/tablexia/menu/user/UserMenuSelectBoxItemGroup.java +++ b/core/src/cz/nic/tablexia/menu/user/UserMenuSelectBoxItemGroup.java @@ -18,21 +18,22 @@ import cz.nic.tablexia.model.User; */ public class UserMenuSelectBoxItemGroup extends Group implements UserSelectBox.UserSelectBoxItem { - private static final int TEXT_LEFT_OFFSET = 20; - private static final int IMAGE_BORDER_OFFSET = 4; - private static final Color FOREGROUND_COLOR = new Color(0.322f, 0.278f, 0.255f, 1f); + private static final ApplicationFontManager.FontType TEXT_FONT = ApplicationFontManager.FontType.ROBOTO_REGULAR_20; + private static final int TEXT_LEFT_OFFSET = 20; + private static final int IMAGE_BORDER_OFFSET = 4; + private static final Color FOREGROUND_COLOR = new Color(0.322f, 0.278f, 0.255f, 1f); - private final NinePatch background; - private final BitmapFont font; + private final NinePatch background; + private final BitmapFont font; private final TextureRegionDrawable image; - private final User user; + private final User user; public UserMenuSelectBoxItemGroup(IMenuItem menuItem, float width) { - this.user = (User) menuItem; + this.user = (User) menuItem; - background = ApplicationAtlasManager.getInstance().getPatch(ApplicationAtlasManager.USERMENU_MENUITEM_BACKGROUND); - font = ApplicationFontManager.getInstance().getDefaultApplicationRegularFont(); - image = new TextureRegionDrawable(ApplicationAtlasManager.getInstance().getTextureRegion(ApplicationAtlasManager.USERMENU_MENUITEM_SAMPLE)); + background = ApplicationAtlasManager.getInstance().getPatch(ApplicationAtlasManager.USERMENU_MENUITEM_BACKGROUND); + font = ApplicationFontManager.getInstance().getFont(TEXT_FONT); + image = new TextureRegionDrawable(ApplicationAtlasManager.getInstance().getTextureRegion(ApplicationAtlasManager.USERMENU_MENUITEM_SAMPLE)); } public void performAction() { diff --git a/core/src/cz/nic/tablexia/screen/AbstractTablexiaScreen.java b/core/src/cz/nic/tablexia/screen/AbstractTablexiaScreen.java index 44a7747c01f966cbba76c5ca99ad148278e456df..5018ecc807c8a8f418f2f00091e0897bfc09f4a1 100644 --- a/core/src/cz/nic/tablexia/screen/AbstractTablexiaScreen.java +++ b/core/src/cz/nic/tablexia/screen/AbstractTablexiaScreen.java @@ -16,6 +16,7 @@ import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.utils.Disposable; import com.badlogic.gdx.utils.I18NBundle; import com.badlogic.gdx.utils.async.AsyncTask; +import com.badlogic.gdx.utils.viewport.Viewport; import java.util.ArrayList; import java.util.HashMap; @@ -313,7 +314,7 @@ public abstract class AbstractTablexiaScreen<T> extends ScreenAdapter { //////////////////////////// STAGE private Stage prepareStage() { - return new Stage(new XFillViewport()); + return new Stage(getViewport()); } public Stage getStage() { @@ -328,6 +329,10 @@ public abstract class AbstractTablexiaScreen<T> extends ScreenAdapter { stage.addAction(action); } + protected Viewport getViewport() { + return new XFillViewport(); + } + //////////////////////////// INPUT PROCESSORS public InputProcessor getInputProcessor() { @@ -650,10 +655,12 @@ public abstract class AbstractTablexiaScreen<T> extends ScreenAdapter { return textManager.getResult().get(key); } + @Deprecated public BitmapFont getDefaultRegularFont() { return ApplicationFontManager.getInstance().getDefaultApplicationRegularFont(); } + @Deprecated public BitmapFont getDefaultBoldFont() { return ApplicationFontManager.getInstance().getDefaultApplicationBoldFont(); } @@ -670,6 +677,10 @@ public abstract class AbstractTablexiaScreen<T> extends ScreenAdapter { return dataManager.getResult(); } + protected BitmapFont getFont(ApplicationFontManager.FontType fontType) { + return ApplicationFontManager.getInstance().getFont(fontType); + } + //////////////////////////// SCREEN SCENE diff --git a/core/src/cz/nic/tablexia/screen/createuser/FormScreen.java b/core/src/cz/nic/tablexia/screen/createuser/FormScreen.java index 584817ed7bbedb96bccf7a24d1359c86f0adaa9c..1705986f90afb4622c548a1e9f02b5fdbf907f8f 100644 --- a/core/src/cz/nic/tablexia/screen/createuser/FormScreen.java +++ b/core/src/cz/nic/tablexia/screen/createuser/FormScreen.java @@ -50,8 +50,11 @@ import cz.nic.tablexia.util.ui.dialog.text.DialogTextContent; public class FormScreen extends AbstractTablexiaScreen<Void> { - private static final String CREATEUSER_FORM_AGE_TEXT_KEY = "createuser_form_age"; - private static final String CREATEUSER_FORM_GENDER_TEXT_KEY = "createuser_form_gender"; + private static final String CREATEUSER_FORM_AGE_TEXT_KEY = "createuser_form_age"; + private static final String CREATEUSER_FORM_GENDER_TEXT_KEY = "createuser_form_gender"; + private static final Color TEXT_COLOR = Color.BLACK; + private static final ApplicationFontManager.FontType TEXT_14 = ApplicationFontManager.FontType.ROBOTO_REGULAR_14; + private static final ApplicationFontManager.FontType TEXT_20 = ApplicationFontManager.FontType.ROBOTO_REGULAR_20; private static final int MUGSHOT_HEIGHT = 250; public static final String GFX_PATH = "gfx/"; @@ -80,7 +83,6 @@ public class FormScreen extends AbstractTablexiaScreen<Void> { @Override protected void screenLoaded(Map<String, String> screenState) { - //getStage().setDebugAll(TablexiaSettings.getInstance().isShowBoundingBoxes()); final Group group = new Group(); Image background = new TablexiaNoBlendingImage(getScreenTextureRegion(GFX_PATH + "table")); @@ -104,13 +106,13 @@ public class FormScreen extends AbstractTablexiaScreen<Void> { }); this.age = 10; - final Label age = new Label(getText(CREATEUSER_FORM_AGE_TEXT_KEY), getLabelStyle()); - ageLabel = new Label(String.valueOf(this.age), getLabelStyle()); - final Label gender = new Label(getText(CREATEUSER_FORM_GENDER_TEXT_KEY), getLabelStyle()); - nameLabel = new Label("", getLabelStyle()); + Label.LabelStyle labelStyleFontSize16 = new Label.LabelStyle(getFont(TEXT_14), TEXT_COLOR); + Label.LabelStyle labelStyleFontSize20 = new Label.LabelStyle(getFont(TEXT_20), TEXT_COLOR); + final Label age = new Label(getText(CREATEUSER_FORM_AGE_TEXT_KEY), labelStyleFontSize16); + ageLabel = new Label(String.valueOf(this.age), labelStyleFontSize20); + final Label gender = new Label(getText(CREATEUSER_FORM_GENDER_TEXT_KEY), labelStyleFontSize16); + nameLabel = new Label("", labelStyleFontSize20); - age.setFontScale(0.7f); - gender.setFontScale(0.7f); nameLabel.setSize(getStage().getWidth() * 0.2f, getStage().getWidth() * 0.05f); nameLabel.setPosition(getStage().getWidth() * 0.57f, getStage().getWidth() * 0.27f); age.setPosition(getStage().getWidth() * 0.58f, getStage().getWidth() * 0.225f); @@ -182,8 +184,8 @@ public class FormScreen extends AbstractTablexiaScreen<Void> { signaturePane.setBounds(600, getStage().getHeight() * 0.1f, 300, getStage().getHeight() * 0.2f); // pencil and stamp layers - group.addActor(pen = ScaleUtil.createImageWidthPosition(getScreenTextureRegion(GFX_PATH + "pencil_dropped"), getStage().getWidth() * 0.2f, getStage().getWidth() * 0.85f, getStage().getWidth() * -0.13f)); - group.addActor(stamp = ScaleUtil.createImageWidthPosition(getScreenTextureRegion(GFX_PATH + "stamp_left_dropped"), getStage().getWidth() * 0.2f, getStage().getWidth() * -0.01f, getStage().getWidth() * -0.05f)); + group.addActor(pen = ScaleUtil.createImageWidthPosition(getScreenTextureRegion(GFX_PATH + "pencil_dropped", false), getStage().getWidth() * 0.2f, getStage().getWidth() * 0.85f, getStage().getWidth() * -0.13f)); + group.addActor(stamp = ScaleUtil.createImageWidthPosition(getScreenTextureRegion(GFX_PATH + "stamp_left_dropped", false), getStage().getWidth() * 0.2f, getStage().getWidth() * -0.01f, getStage().getWidth() * -0.05f)); pen.addListener(new DragActorListener(pen, true, new DragActorListener.DragDropListener() { @Override public void dropped(float x, float y) { @@ -356,10 +358,6 @@ public class FormScreen extends AbstractTablexiaScreen<Void> { return vg; } - private Label.LabelStyle getLabelStyle() { - return new Label.LabelStyle(ApplicationFontManager.getInstance().getFont(ApplicationFontManager.APPLICATION_DEFAULT_FONT_REGULAR), Color.BLACK); - } - public void setAge(int age) { ageLabel.setText(String.valueOf(this.age = age)); } diff --git a/core/src/cz/nic/tablexia/screen/createuser/form/SignatureDialog.java b/core/src/cz/nic/tablexia/screen/createuser/form/SignatureDialog.java index 95c84e43d873ee733081087ef83a41537ed88e35..b83d17770788e36e56ebd9497501c2f1cdabed1d 100644 --- a/core/src/cz/nic/tablexia/screen/createuser/form/SignatureDialog.java +++ b/core/src/cz/nic/tablexia/screen/createuser/form/SignatureDialog.java @@ -23,7 +23,6 @@ public abstract class SignatureDialog extends TwoButtonDialog { TablexiaButton.ButtonType.GREEN, formScreen.getText("createuser_form_cancel"), formScreen.getText("createuser_form_sign")); - setDebug(true); } @Override diff --git a/core/src/cz/nic/tablexia/screen/halloffame/HallOfFameScreen.java b/core/src/cz/nic/tablexia/screen/halloffame/HallOfFameScreen.java index b08b5f3d6fd298d2173ed75ebbd33ea3218d88e5..ab5c2c3d6df57323736f780838b033c577fedc50 100644 --- a/core/src/cz/nic/tablexia/screen/halloffame/HallOfFameScreen.java +++ b/core/src/cz/nic/tablexia/screen/halloffame/HallOfFameScreen.java @@ -15,6 +15,8 @@ import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; import com.badlogic.gdx.scenes.scene2d.ui.Stack; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.badlogic.gdx.scenes.scene2d.utils.SpriteDrawable; +import com.badlogic.gdx.utils.viewport.ExtendViewport; +import com.badlogic.gdx.utils.viewport.Viewport; import java.util.ArrayList; import java.util.Arrays; @@ -69,6 +71,11 @@ public class HallOfFameScreen extends AbstractTablexiaScreen<Map<ITrophyDefiniti private ScrollPane scrollPane; + @Override + protected Viewport getViewport() { + return new ExtendViewport(0, TablexiaSettings.getMinWorldHeight()); + } + @Override protected void screenPaused(Map<String, String> screenState) { screenState.put(SCREEN_STATE_SCROLL_POSITION_X, String.valueOf(scrollPane.getScrollPercentX())); @@ -84,7 +91,7 @@ public class HallOfFameScreen extends AbstractTablexiaScreen<Map<ITrophyDefiniti @Override protected void screenLoaded(Map<String, String> screenState) { Stack contentStack = new Stack(); - contentStack.setHeight(SCREEN_SIZE.y); + contentStack.setHeight(getStage().getViewport().getScreenHeight()); prepareBackgroundLayer(); prepareForegroundLayer(); @@ -94,7 +101,7 @@ public class HallOfFameScreen extends AbstractTablexiaScreen<Map<ITrophyDefiniti scrollPane = new ScrollPane(contentStack); scrollPane.setScrollingDisabled(false, true); - scrollPane.setSize(SCREEN_SIZE.x, SCREEN_SIZE.y); + scrollPane.setFillParent(true); getStage().addActor(scrollPane); @@ -200,7 +207,7 @@ public class HallOfFameScreen extends AbstractTablexiaScreen<Map<ITrophyDefiniti @Override public void clicked(InputEvent event, float x, float y) { Log.info(getClass(), "HEAP CLICKED "); - final TrophyThreeStarsGamesDialog dialog = new TrophyThreeStarsGamesDialog(SCREEN_SIZE.x / 2 - TROPHY_DIALOG_WIDTH / 2, SCREEN_SIZE.y/2-TROPHY_DIALOG_HEIGHT/2, TROPHY_DIALOG_WIDTH, TROPHY_DIALOG_HEIGHT, TablexiaDialog.BackGroundType.DIALOG_SQUARE_BORDERLINES, getText("count_sum"), starResults); + final TrophyThreeStarsGamesDialog dialog = new TrophyThreeStarsGamesDialog(TablexiaSettings.getSceneWidth(getStage()) / 2 - TROPHY_DIALOG_WIDTH / 2, SCREEN_SIZE.y / 2 - TROPHY_DIALOG_HEIGHT / 2, TROPHY_DIALOG_WIDTH, TROPHY_DIALOG_HEIGHT, TablexiaDialog.BackGroundType.DIALOG_SQUARE_BORDERLINES, getText("count_sum"), starResults); dialog.show(getStage()); dialog.addListener(new ClickListener() { @Override @@ -246,7 +253,7 @@ public class HallOfFameScreen extends AbstractTablexiaScreen<Map<ITrophyDefiniti String name = ApplicationTextManager.getInstance().getText(trophy.getTrophyName()); String desc = ApplicationTextManager.getInstance().getText(trophy.getTrophyDescription()); - final TrophyDialog trophyDialog = new TrophyDialog(SCREEN_SIZE.x / 2 - TROPHY_DIALOG_WIDTH / 2, SCREEN_SIZE.y/2-TROPHY_DIALOG_HEIGHT/2, TROPHY_DIALOG_WIDTH, TROPHY_DIALOG_HEIGHT, TablexiaDialog.BackGroundType.DIALOG_SQUARE_BORDERLINES, new DialogTextContent(name, desc), textures); + final TrophyDialog trophyDialog = new TrophyDialog(TablexiaSettings.getSceneWidth(getStage()) / 2 - TROPHY_DIALOG_WIDTH / 2, SCREEN_SIZE.y / 2 - TROPHY_DIALOG_HEIGHT / 2, TROPHY_DIALOG_WIDTH, TROPHY_DIALOG_HEIGHT, TablexiaDialog.BackGroundType.DIALOG_SQUARE_BORDERLINES, new DialogTextContent(name, desc), textures); trophyDialog.show(getStage()); trophyDialog.addListener(new ClickListener() { @Override @@ -332,7 +339,7 @@ public class HallOfFameScreen extends AbstractTablexiaScreen<Map<ITrophyDefiniti float trophyWidth = texture.getRegionWidth() * position.getThird(); scrollPane.layout(); - scrollPane.setScrollX(trophyX - SCREEN_SIZE.x / 2 + trophyWidth / 2); + scrollPane.setScrollX(trophyX - TablexiaSettings.getSceneWidth(getStage()) / 2 + trophyWidth / 2); scrollPane.updateVisualScroll(); } } diff --git a/core/src/cz/nic/tablexia/util/ui/TablexiaButton.java b/core/src/cz/nic/tablexia/util/ui/TablexiaButton.java index 956ad1cfc14225df3a29d4f1fb88ff5d8f7409fa..95759592658cc4a323e879b5417c49c48b02fa26 100644 --- a/core/src/cz/nic/tablexia/util/ui/TablexiaButton.java +++ b/core/src/cz/nic/tablexia/util/ui/TablexiaButton.java @@ -22,9 +22,9 @@ import static com.badlogic.gdx.scenes.scene2d.actions.Actions.sequence; */ public class TablexiaButton extends TextButton { - private static final Color DEFAULT_BUTTON_TEXT_COLOR = Color.BLACK; - private static final String DEFAULT_BUTTON_TEXT_FONT = ApplicationFontManager.APPLICATION_DEFAULT_FONT_REGULAR; - private static final float DEFAULT_BUTTON_HIGHLITE_DURATION = 0.5f; + private static final Color DEFAULT_BUTTON_TEXT_COLOR = Color.BLACK; + private static final ApplicationFontManager.FontType DEFAULT_BUTTON_TEXT_FONT = ApplicationFontManager.FontType.ROBOTO_REGULAR_20; + private static final float DEFAULT_BUTTON_HIGHLITE_DURATION = 0.5f; private Image solarizedBackgroundImage; private RepeatAction highliteAction;