Skip to content
Snippets Groups Projects
Commit 6ae6be72 authored by Luboš Horáček's avatar Luboš Horáček
Browse files

#22 Dialog text resources

parent f805547f
No related branches found
No related tags found
No related merge requests found
createuser_detective_1=Dialog 1
createuser_detective_2=Dialog 2
createuser_detective_3=Dialog 3
createuser_detective_4=Dialog 4
createuser_detective_1=Dialog 1 SK
createuser_detective_2=Dialog 2 SK
createuser_detective_3=Dialog 3 SK
createuser_detective_4=Dialog 4 SK
......@@ -17,10 +17,14 @@ public class AbstractAutoloadTablexiaScreen<T> extends AbstractLinearTextureTabl
public static final String TEXTURE_ASSET_PATH_SUFFIX = "/gfx";
public static final String SOUND_ASSET_PATH_SUFFIX = "/sfx";
public static final String MUSIC_ASSET_PATH_SUFFIX = "/mfx";
public static final String TEXT_ASSET_PATH_SUFFIX = "/resource";
public static final String TEXT_ASSET_PATH_PREFIX = "text/";
private DirectoryAsset textureAssets;
private DirectoryAsset soundAssets;
private DirectoryAsset musicAssets;
private String basePath;
public AbstractAutoloadTablexiaScreen(String basePath) {
initAssets(basePath);
......@@ -35,6 +39,7 @@ public class AbstractAutoloadTablexiaScreen<T> extends AbstractLinearTextureTabl
textureAssets = new DirectoryAsset(basePath + TEXTURE_ASSET_PATH_SUFFIX);
soundAssets = new DirectoryAsset(basePath + SOUND_ASSET_PATH_SUFFIX);
musicAssets = new DirectoryAsset(basePath + MUSIC_ASSET_PATH_SUFFIX);
this.basePath = basePath;
}
@Override
......@@ -49,6 +54,10 @@ public class AbstractAutoloadTablexiaScreen<T> extends AbstractLinearTextureTabl
soundsFileNames.addAll(soundAssets.values());
}
@Override
protected String prepareScreenTextResourcesAssetName() {
return TEXT_ASSET_PATH_PREFIX + basePath + TEXT_ASSET_PATH_SUFFIX;
}
@Override
public Texture getTexture(String textureName) {
......
......@@ -17,6 +17,9 @@ 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 cz.nic.tablexia.Tablexia;
import cz.nic.tablexia.TablexiaApplication;
import cz.nic.tablexia.bus.ApplicationBus;
import cz.nic.tablexia.screen.AbstractAutoloadTablexiaScreen;
import cz.nic.tablexia.util.Log;
import cz.nic.tablexia.util.ScaleUtil;
......@@ -404,8 +407,13 @@ public class PanoramaScreen extends AbstractAutoloadTablexiaScreen<Void> {
return group;
}
/**
* Show detective dialog with text and play sound. If last dialog, go to FormScreen
* @param num
*/
private void showDialog(final int num) {
final Dialog dialog = new TablexiaDialog(0, 0, getStage().getWidth() * 0.3f, getStage().getHeight() * 0.3f, TablexiaDialog.BackGroundType.BUBBLE_CLASSIC_CONTINUE_BUTTON, new DialogTextContent("", "Text")).show(getStage());
String text = getText("createuser_detective_" + num) ;
final Dialog dialog = new TablexiaDialog(0, 0, getStage().getWidth() * 0.3f, getStage().getHeight() * 0.3f, TablexiaDialog.BackGroundType.BUBBLE_CLASSIC_CONTINUE_BUTTON, new DialogTextContent("", text)).show(getStage());
dialog.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
......@@ -413,7 +421,7 @@ public class PanoramaScreen extends AbstractAutoloadTablexiaScreen<Void> {
dialog.hide();
if(num == 4){
// TODO switch to form screen
ApplicationBus.getInstance().publishAsync(new Tablexia.ChangeScreenEvent(FormScreen.class, TablexiaApplication.ScreenTransaction.MOVE_LEFT));
}else {
showDialog(num + 1);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment