Commit 00b63482 authored by Matyáš Latner's avatar Matyáš Latner

#7 Preloader generic content and custom content from AbstractTablexiaScreen

parent 148fffa5
......@@ -20,6 +20,7 @@ mainmenu_panorama=Panorama
usermenu_newuser=+ Nový detektiv
preloader_title=Jak hrát?
confirm_button=Rozumím
gamedifficulty_tutorial=Cvičení
......@@ -44,6 +45,8 @@ game_shooting_range_title=Střelnice
game_shooting_range_description=Procvičování pozornosti
game_in_the_darkness_title=Potmě
game_in_the_darkness_description=Procvičování seriality
game_in_the_darkness_preloader1=Naplánuj krok za krokem průchod labyrintem.
game_in_the_darkness_preloader2=Přetahuj správné úkony do pásu vpravo a dávej pozor na všechny překážky. Teprve až budeš mít naplánovanou celou trasu, stiskni tlačítko HOTOVO.
# <!-- Robbery -->
robbery_1_finished=Pouta standard
......
......@@ -20,6 +20,7 @@ mainmenu_panorama=Panorama
usermenu_newuser=+ Neuer Detektiv
preloader_title=Wie spielt man?
confirm_button=Ich verstehe
gamedifficulty_tutorial=Lernprogramm
......@@ -44,6 +45,8 @@ game_shooting_range_title=Schießstand
game_shooting_range_description=Aufmerksamkeitstraining
game_in_the_darkness_title=Im Dunkeln
game_in_the_darkness_description=Training der Serialität
game_in_the_darkness_preloader1=Plane Schritt für Schritt den Weg durch das Labyrinth.
game_in_the_darkness_preloader2=Ziehe die richtigen Handlungen in das Band auf der rechten Seite und pass auf alle Hindernisse auf. Sobald du die ganze Route geplant hast, drücke den Knopf FERTIG.
# <!-- Robbery -->
robbery_1_finished=Handschellen Standard
......
......@@ -20,6 +20,7 @@ mainmenu_panorama=Panorama
usermenu_newuser=+ Nový detektív
preloader_title=Ako hrať?
confirm_button=Rozumiem
gamedifficulty_tutorial=Cvičenie
......@@ -44,6 +45,8 @@ game_shooting_range_title=Strelnica
game_shooting_range_description=Precvičovanie pozornosti
game_in_the_darkness_title=Potme
game_in_the_darkness_description=Precvičovanie seriality
game_in_the_darkness_preloader1=Naplánuj krok za krokom prechod labyrintom.
game_in_the_darkness_preloader2=Preťahuj správne úkony do pásu vpravo a dávaj pozor na všetky prekážky. Až keď budeš mať naplánovanú celú trasu, stlač tlačítko HOTOVO.
# <!-- Robbery -->
robbery_1_finished=Púta štandard
......
......@@ -13,6 +13,7 @@ import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.Touchable;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.utils.viewport.ScreenViewport;
......@@ -24,6 +25,7 @@ import cz.nic.tablexia.bus.event.DimmerControlEvent;
import cz.nic.tablexia.debug.DebugInfo;
import cz.nic.tablexia.loader.TablexiaAtlasManager;
import cz.nic.tablexia.loader.application.ApplicationAtlasManager;
import cz.nic.tablexia.loader.application.ApplicationFontManager;
import cz.nic.tablexia.loader.application.ApplicationTextManager;
import cz.nic.tablexia.menu.MenuController;
import cz.nic.tablexia.screen.AbstractTablexiaScreen;
......@@ -230,7 +232,7 @@ public abstract class TablexiaApplication implements ApplicationListener {
//////////////////////////// SCREEN PRELOADER
private static abstract class PreloaderDialog extends TablexiaDialog {
private abstract class PreloaderDialog extends TablexiaDialog {
private TablexiaButton textButton;
......@@ -241,6 +243,12 @@ public abstract class TablexiaApplication implements ApplicationListener {
@Override
protected void prepareContent() {
super.prepareContent();
Label.LabelStyle titleLableStyle = new Label.LabelStyle(ApplicationFontManager.getInstance().getFont(ApplicationFontManager.FontType.ROBOTO_BOLD_20), Color.BLACK);
Label titleLabel = new Label(ApplicationTextManager.getInstance().getText(ApplicationTextManager.ApplicationTextsAssets.PRELOADER_TITLE), titleLableStyle);
getContentTable().add(titleLabel);
getContentTable().row();
screen.preparePreloaderContent(getContentTable(), preloaderAtlasManager, ApplicationTextManager.getInstance(), ApplicationFontManager.getInstance());
getContentTable().row();
textButton = new TablexiaButton(ApplicationTextManager.getInstance().getText(ApplicationTextManager.ApplicationTextsAssets.CONFIRM_BUTTON), TablexiaButton.ButtonType.GREEN);
textButton.addListener(new ClickListener() {
@Override
......@@ -298,13 +306,6 @@ public abstract class TablexiaApplication implements ApplicationListener {
protected void buttonAction() {
currentScreenTransaction.continueWithTransaction();
}
@Override
protected void prepareContent() {
getContentTable().add(new Image(preloaderAtlasManager.getTextureRegionFromAtlas(screen.preparePreloaderAtlasPath(), "preloader_info", null)));
getContentTable().row();
super.prepareContent();
}
};
loadingDialog.show(getStage());
}
......
......@@ -8,6 +8,8 @@ import com.badlogic.gdx.scenes.scene2d.Touchable;
import com.badlogic.gdx.scenes.scene2d.actions.AlphaAction;
import com.badlogic.gdx.scenes.scene2d.actions.ParallelAction;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.utils.Align;
......@@ -31,6 +33,9 @@ import cz.nic.tablexia.game.games.in_the_darkness.map.mapobject.MapObject;
import cz.nic.tablexia.game.games.in_the_darkness.map.mapobject.MapObjectType;
import cz.nic.tablexia.game.games.in_the_darkness.map.tile.Tile;
import cz.nic.tablexia.game.games.in_the_darkness.map.widget.MapWidget;
import cz.nic.tablexia.loader.TablexiaAtlasManager;
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.util.Log;
import cz.nic.tablexia.util.ScaleUtil;
......@@ -127,6 +132,13 @@ public class InTheDarknessGame extends AbstractTablexiaGame<List<MapWidget>> imp
}
}
private static final ApplicationFontManager.FontType PRELOADER_TEXT_FONT = ApplicationFontManager.FontType.ROBOTO_REGULAR_20;
private static final Color PRELOADER_TEXT_COLOR = Color.BLACK;
private static final String PRELOADER_INFO_IMAGE = "preloader_info";
private static final String PRELOADER_ANIM_IMAGE = "preloader_anim";
private static final String PRELOADER_TEXT1_KEY = ApplicationTextManager.ApplicationTextsAssets.GAME_IN_THE_DARKNESS_PRELOADER_TEXT1;
private static final String PRELOADER_TEXT2_KEY = ApplicationTextManager.ApplicationTextsAssets.GAME_IN_THE_DARKNESS_PRELOADER_TEXT2;
private static final String SCORE_KEY_PLANNING_DURATION = "planning_duration";
public static final String SCORE_KEY_ERRORS_COUNT = "errors_count";
......@@ -363,6 +375,22 @@ public class InTheDarknessGame extends AbstractTablexiaGame<List<MapWidget>> imp
}
}
@Override
public void preparePreloaderContent(Table contentTable, TablexiaAtlasManager preloaderAtlasManager, ApplicationTextManager applicationTextManager, ApplicationFontManager applicationFontManager) {
contentTable.setDebug(TablexiaSettings.getInstance().isShowBoundingBoxes(), true);
Image preloaderInfoImage = new Image(getPreloaderTextureRegion(preloaderAtlasManager, PRELOADER_INFO_IMAGE));
contentTable.add(preloaderInfoImage);
Label.LabelStyle textLabelStyle = new Label.LabelStyle(applicationFontManager.getFont(PRELOADER_TEXT_FONT), PRELOADER_TEXT_COLOR);
Label preloaderText1 = new Label(applicationTextManager.getText(PRELOADER_TEXT1_KEY), textLabelStyle);
preloaderText1.setWrap(true);
contentTable.add(preloaderText1);
contentTable.row();
Label preloaderText2 = new Label(applicationTextManager.getText(PRELOADER_TEXT2_KEY), textLabelStyle);
preloaderText2.setWrap(true);
contentTable.add(preloaderText2);
contentTable.add(new Image(getPreloaderTextureRegion(preloaderAtlasManager, PRELOADER_ANIM_IMAGE)));
}
//////////////////////////////////////////// IN THE DARKNESS DIFFICULTY
......
......@@ -26,6 +26,7 @@ public class ApplicationTextManager extends TablexiaDataManager<I18NBundle> impl
public static final String USERMENU_NEWUSER = "usermenu_newuser";
public static final String PRELOADER_TITLE = "preloader_title";
public static final String CONFIRM_BUTTON = "confirm_button";
public static final String SYSTEM_EXIT = "system_exit";
......@@ -46,18 +47,20 @@ public class ApplicationTextManager extends TablexiaDataManager<I18NBundle> impl
public static final String MAINMENU_LOGOUT = "mainmenu_logout";
public static final String MAINMENU_DEBUG = "mainmenu_screendebug";
public static final String GAME_ROBBERY_TITLE = "game_robbery_title";
public static final String GAME_ROBBERY_DESCRIPTION = "game_robbery_description";
public static final String GAME_PURSUIT_TITLE = "game_pursuit_title";
public static final String GAME_PURSUIT_DESCRIPTION = "game_pursuit_description";
public static final String GAME_KIDNAPPING_TITLE = "game_kidnapping_title";
public static final String GAME_KIDNAPPING_DESCRIPTION = "game_kidnapping_description";
public static final String GAME_NIGHT_WATCH_TITLE = "game_night_watch_title";
public static final String GAME_NIGHT_WATCH_DESCRIPTION = "game_night_watch_description";
public static final String GAME_SHOOTING_RANGE_TITLE = "game_shooting_range_title";
public static final String GAME_SHOOTING_RANGE_DESCRIPTION = "game_shooting_range_description";
public static final String GAME_IN_THE_DARKNESS_TITLE = "game_in_the_darkness_title";
public static final String GAME_IN_THE_DARKNESS_DESCRIPTION = "game_in_the_darkness_description";
public static final String GAME_ROBBERY_TITLE = "game_robbery_title";
public static final String GAME_ROBBERY_DESCRIPTION = "game_robbery_description";
public static final String GAME_PURSUIT_TITLE = "game_pursuit_title";
public static final String GAME_PURSUIT_DESCRIPTION = "game_pursuit_description";
public static final String GAME_KIDNAPPING_TITLE = "game_kidnapping_title";
public static final String GAME_KIDNAPPING_DESCRIPTION = "game_kidnapping_description";
public static final String GAME_NIGHT_WATCH_TITLE = "game_night_watch_title";
public static final String GAME_NIGHT_WATCH_DESCRIPTION = "game_night_watch_description";
public static final String GAME_SHOOTING_RANGE_TITLE = "game_shooting_range_title";
public static final String GAME_SHOOTING_RANGE_DESCRIPTION = "game_shooting_range_description";
public static final String GAME_IN_THE_DARKNESS_TITLE = "game_in_the_darkness_title";
public static final String GAME_IN_THE_DARKNESS_DESCRIPTION = "game_in_the_darkness_description";
public static final String GAME_IN_THE_DARKNESS_PRELOADER_TEXT1 = "game_in_the_darkness_preloader1";
public static final String GAME_IN_THE_DARKNESS_PRELOADER_TEXT2 = "game_in_the_darkness_preloader2";
}
private static final String APPLICATION_TEXT_RESOURCE_FILE = "text/application/application";
......
......@@ -13,6 +13,7 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.Action;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.utils.Disposable;
import com.badlogic.gdx.utils.I18NBundle;
import com.badlogic.gdx.utils.async.AsyncTask;
......@@ -41,6 +42,7 @@ import cz.nic.tablexia.loader.TablexiaDataManager;
import cz.nic.tablexia.loader.TablexiaSoundManager;
import cz.nic.tablexia.loader.application.ApplicationAtlasManager;
import cz.nic.tablexia.loader.application.ApplicationFontManager;
import cz.nic.tablexia.loader.application.ApplicationTextManager;
import cz.nic.tablexia.model.User;
import cz.nic.tablexia.util.Log;
import cz.nic.tablexia.util.ScaleUtil;
......@@ -301,6 +303,17 @@ public abstract class AbstractTablexiaScreen<T> extends ScreenAdapter {
}
//////////////////////////// PRELOADER
public void preparePreloaderContent(Table contentTable, TablexiaAtlasManager preloaderAtlasManager, ApplicationTextManager applicationTextManager, ApplicationFontManager applicationFontManager) {
// nothing needed
}
public boolean hasPreloader() {
return false;
}
//////////////////////////// LOADING LISTENER
private void notifyLoadingCompleteListeners() {
......@@ -317,10 +330,6 @@ public abstract class AbstractTablexiaScreen<T> extends ScreenAdapter {
screenLoadingListener = null;
}
public boolean hasPreloader() {
return false;
}
//////////////////////////// STAGE
......@@ -622,6 +631,10 @@ public abstract class AbstractTablexiaScreen<T> extends ScreenAdapter {
//////////////////////////// ASSETS ACCESS
public TextureRegion getPreloaderTextureRegion(TablexiaAtlasManager preloaderAtlasManager, String regionName) {
return preloaderAtlasManager.getTextureRegionFromAtlas(preparePreloaderAtlasPath(), regionName, null);
}
public TextureRegion getTextureRegionForAtlas(String atlasName, String regionName) {
return atlasManager.getTextureRegionFromAtlas(atlasName, regionName, null);
}
......
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