Skip to content
Snippets Groups Projects
Commit 3f2b83d5 authored by Frantisek Simon's avatar Frantisek Simon
Browse files

Merge remote-tracking branch 'remotes/origin/devel' into feature-encyclopedia

parents 657b1c94 607c7529
No related branches found
No related tags found
No related merge requests found
Showing
with 215 additions and 96 deletions
android/assets/gfx/bar_background.png

695 B

android/assets/gfx/bar_bg.png

20.1 KiB

android/assets/gfx/bar_fg.png

11.4 KiB

android/assets/gfx/bar_foreground.png

6.29 KiB

......@@ -2,7 +2,8 @@ paragraph_1=Autoři
game_concept=Herní koncept, Grafika
game_concept_details=Jakub Rumler
developers=Programátoři
developers_details=Luboš Horáček, Matyáš Latner, Václav Tarantík, František Šimon, Anton Danilov, Vitaliy Vashchenko
developers_details_1=Luboš Horáček, Matyáš Latner, Václav Tarantík, František Šimon
developers_details_2=Anton Danilov, Vitaliy Vashchenko, Drahomír Karchňák
about_info_1 =Sdružení CZ.NIC je správcem registru doménových jmen .CZ a\u00A0 věnuje se podpoře projektů prospěšných pro internetovou infrastrukturu v\u00A0 České republice. Laboratoře CZ.NIC jsou vývojovým a\u00A0 výzkumným pracovištěm sdružení.
illustrators=Ilustrace
illustrators_details=Aneta Biskupová
......
......@@ -2,7 +2,8 @@ paragraph_1=AutorInnen
game_concept=Spielkonzept, Grafik
game_concept_details=Jakub Rumler
developers=Programmierer
developers_details=Luboš Horáček, Matyáš Latner, Václav Tarantík, František Šimon, Anton Danilov, Vitaliy Vashchenko
developers_details_1=Luboš Horáček, Matyáš Latner, Václav Tarantík, František Šimon
developers_details_2=Anton Danilov, Vitaliy Vashchenko, Drahomír Karchňák
about_info_1=Tablexia ist eine App, die vom Labor der Vereinigung CZ.NIC. zu Trainingszwecken für Menschen mit einer Lese-und Rechtschreibschwäche entwickelt wurde.
illustrators=Bilder
illustrators_details=Aneta Biskupová
......
......@@ -2,7 +2,8 @@ paragraph_1=Autori
game_concept=Herný koncept, Grafika
game_concept_details=Jakub Rumler
developers=Programátori
developers_details=Luboš Horáček, Matyáš Latner, Václav Tarantík, František Šimon, Anton Danilov, Vitaliy Vashchenko
developers_details_1=Luboš Horáček, Matyáš Latner, Václav Tarantík, František Šimon
developers_details_2=Anton Danilov, Vitaliy Vashchenko, Drahomír Karchňák
about_info_1=Aplikácia na podporu jedincov s\u00A0 dyslexiou vyvinutá Laboratóriami združenia CZ.NIC.
illustrators=Ilustrácie
illustrators_details=Aneta Biskupová
......
......@@ -25,6 +25,8 @@ public class AndroidLauncher extends AndroidApplication {
public static final Tablexia.SQLConnectionType SQL_CONNECTION_TYPE = new Tablexia.SQLConnectionType("org.sqldroid.SQLDroidDriver", "jdbc:sqldroid:");
private static final int MULTI_SAMPLING_2X = 2;
private Tablexia tablexia;
@Override
......@@ -32,6 +34,7 @@ public class AndroidLauncher extends AndroidApplication {
super.onCreate(savedInstanceState);
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
config.useWakelock = true;
config.numSamples = MULTI_SAMPLING_2X;
initialize(tablexia = new Tablexia(BuildConfig.BUILD_TYPE,
getResources().getConfiguration().locale,
SQL_CONNECTION_TYPE,
......
......@@ -153,6 +153,9 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
private boolean inGameLoading;
private Map<ITrophyDefinition, Boolean> hasTrophies;
private boolean menuPause = false;
private boolean dialogPause = false;
private boolean playAgainButtonClicked = false;
private ArrayList<TablexiaComponentDialog> receivedTrophyDialogs;
......@@ -171,8 +174,8 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
@Override
public boolean hasQuitConfirmDialog() {
if(gamePhase == GamePhase.STARTED || gamePhase == GamePhase.PREPARED)
// quit from game immediately after user logout
return getSelectedUser() != null;
// quit from game immediately after user logout or user change
return getSelectedUser() != null && getSelectedUser().equals(game.getUser());
else
return false;
}
......@@ -215,7 +218,18 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
@Handler
public void handleMenuPauseEvent(AbstractMenu.MenuPauseEvent menuPauseEvent) {
if (menuPauseEvent.isPause()) {
menuPause = menuPauseEvent.isPause();
performPauseResumeAction();
}
@Handler
public void handleDialogVisibleEvent(TablexiaComponentDialog.DialogVisibleEvent dialogVisibleEvent) {
dialogPause = dialogVisibleEvent.isDialogVisible();
performPauseResumeAction();
}
private void performPauseResumeAction() {
if (menuPause || dialogPause) {
performScreenPaused();
} else {
performScreenResumed();
......@@ -463,7 +477,7 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
private final float TROPHY_DIALOG_WIDTH = getSceneWidth() * 0.18f;
private final float TROPHY_DIALOG_HEIGHT = TROPHY_DIALOG_WIDTH * 1.2f;
private final int TROPHY_DIALOG_MAX_COUNT = 4;
private final float TROPHY_DIALOG_OFFSET_X = 1/5f;
private final float TROPHY_DIALOG_OFFSET_X = 3f / 10;
private final float TROPHY_DIALOG_GAP_Y = 24;
private final float TROPHY_DIALOG_IMAGE_SCALE = 1f;
......@@ -531,9 +545,10 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
List<TablexiaDialogComponentAdapter> adapters = new ArrayList<TablexiaDialogComponentAdapter>();
//Result Banner
adapters.add(new AdaptiveSizeDialogComponent());
adapters.add(new CenterPositionDialogComponent());
adapters.add(new DimmerDialogComponent());
adapters.add(new ViewportMaximumSizeComponent());
adapters.add(new CenterPositionDialogComponent());
adapters.add(new FixedSpaceContentDialogComponent(VICTORY_DIALOG_TOP_PADDING_HEIGHT_RATIO));
adapters.add(new ImageContentDialogComponent(new Image(getGameGlobalTextureRegion(VICTORY_DIALOG_RESULTSBANNER)), VICTORY_DIALOG_TITLE_IMAGE_SCALING, VICTORY_DIALOG_TITLE_IMAGE_WIDTH_RATIO, VICTORY_DIALOG_TITLE_IMAGE_HEIGHT_RATIO));
......@@ -711,24 +726,24 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
}));
adapters.add(new FixedSpaceContentDialogComponent());
adapters.add(new TablexiaDialogComponentAdapter() {
private boolean sizeChanged = true;
@Override
public void sizeChanged() {
positionReceivedTrophyDialogs(
getDialog().getInnerLeftX(),
getDialog().getInnerBottomY(),
getDialog().getInnerWidth(),
getDialog().getInnerHeight()
);
public void beforeDraw() {
if(sizeChanged) {
positionReceivedTrophyDialogs(
getDialog().getInnerLeftX(),
getDialog().getInnerBottomY(),
getDialog().getInnerWidth(),
getDialog().getInnerHeight()
);
sizeChanged = false;
}
}
@Override
public void adaptiveSizeThresholdChanged() {
positionReceivedTrophyDialogs(
getDialog().getInnerLeftX(),
getDialog().getInnerBottomY(),
getDialog().getInnerWidth(),
getDialog().getInnerHeight()
);
public void sizeChanged() {
sizeChanged = true;
}
@Override
......@@ -738,7 +753,6 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
}
});
adapters.add(new AdaptiveSizeDialogComponent());
//Create the dialog
victoryDialog = TablexiaComponentDialogFactory.getInstance().createDialog(
adapters.toArray(new TablexiaDialogComponentAdapter[]{}));
......@@ -806,6 +820,7 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
}
private void positionReceivedTrophyDialogs(float dialogX, float dialogY, float dialogWidth, float dialogHeight) {
System.out.println(dialogX + " " + dialogY + " " + dialogWidth + " " + dialogHeight);
float thresholdScale = AdaptiveSizeDialogComponent.DIALOG_SCALE_RATIO;
int trophyCount = receivedTrophyDialogs.size();
......@@ -832,7 +847,6 @@ public abstract class AbstractTablexiaGame<T> extends AbstractTablexiaScreen<T>
dialog.setPosition(
x,
startY + currentHeight
);
currentHeight += trophyDialogHeight + TROPHY_DIALOG_GAP_Y;
......
......@@ -12,6 +12,7 @@ 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.Align;
import com.badlogic.gdx.utils.Timer;
import com.badlogic.gdx.utils.Scaling;
import com.google.common.collect.ObjectArrays;
......@@ -84,8 +85,11 @@ public class KidnappingGame extends AbstractTablexiaGame<GameState> {
private Map map;
private Group ruleMessage;
private boolean ruleMessageShown = false;
private StandardTablexiaButton ruleButton;
private ApplicationFontManager.FontType HELP_OVERLAY_FONT = ApplicationFontManager.FontType.ROBOTO_BOLD_18;
private DirectionSounds.SoundPack actualSoundPack;
@Override
protected void prepareGameSoundAssetNames(List<String> soundsFileNames) {
soundsFileNames.addAll(sfxLibrary.values());
......@@ -145,9 +149,9 @@ public class KidnappingGame extends AbstractTablexiaGame<GameState> {
ruleMessage.addActor(image);
//Adds 'understand' button
StandardTablexiaButton button = new StandardTablexiaButton(getText(KidnappingTextAssets.RULE_MESSAGE_UNDERSTAND), StandardTablexiaButton.TablexiaButtonType.GREEN);
button.setPosition(getSceneLeftX() + getSceneWidth() / 2 - button.getWidth() / 2, getSceneInnerBottomY() + getSceneInnerHeight() * BUTTON_BOTTOM_OFFSET);
button.setInputListener(new ClickListenerWithSound() {
ruleButton = new StandardTablexiaButton(getText(KidnappingTextAssets.RULE_MESSAGE_UNDERSTAND), StandardTablexiaButton.TablexiaButtonType.GREEN);
ruleButton.setPosition(getSceneLeftX() + getSceneWidth() / 2 - ruleButton.getWidth() / 2, getSceneInnerBottomY() + getSceneInnerHeight() * BUTTON_BOTTOM_OFFSET);
ruleButton.setInputListener(new ClickListenerWithSound() {
@Override
public void onClick(InputEvent event, float x, float y) {
super.onClick(event, x, y);
......@@ -155,7 +159,7 @@ public class KidnappingGame extends AbstractTablexiaGame<GameState> {
ruleMessage.addAction(new SequenceAction(Actions.fadeOut(RULE_MESSAGE_FADE_OUT_TIME), Actions.visible(false)));
stopRuleSound(RULE_SOUND_FADE_OUT_TIME);
map.addAction(Actions.sequence(Actions.delay(RULE_MESSAGE_FADE_OUT_TIME + GAME_DELAY),
map.addAction(Actions.sequence(Actions.delay(RULE_MESSAGE_FADE_OUT_TIME + GAME_DELAY),
Actions.run(new Runnable() {
public void run() {
startRound();
......@@ -163,7 +167,8 @@ public class KidnappingGame extends AbstractTablexiaGame<GameState> {
})));
}
});
ruleMessage.addActor(button);
ruleButton.setVisible(false);
ruleMessage.addActor(ruleButton);
//Decide which text to use
String helpText = getText(KidnappingTextAssets.RULE_EASY);
......@@ -205,24 +210,25 @@ public class KidnappingGame extends AbstractTablexiaGame<GameState> {
}
private void playRuleSound(float delay) {
addAction(new SequenceAction(Actions.delay(delay), Actions.run(new Runnable() {
@Override
public void run() {
getRuleSound().play();
}
})));
Timer.schedule(new Timer.Task(){
@Override
public void run() {
ruleButton.setVisible(true);
getRuleSound().play();
}
}, delay);
}
private void stopRuleSound(float fadeoutTime) {
if(getRuleSound().isPlaying()) {
MusicUtil.fadeOut(getRuleSound(), fadeoutTime);
if (getRuleSound().isPlaying()) {
MusicUtil.fadeOut(getRuleSound(), fadeoutTime, true);
}
}
@Override
protected void gameVisible() {
// center first tile and start game
if(!ruleMessageShown) {
if (!ruleMessageShown) {
showRuleMessage();
playRuleSound(RULE_SOUND_DELAY);
}
......@@ -265,7 +271,7 @@ public class KidnappingGame extends AbstractTablexiaGame<GameState> {
*/
private void playSounds() {
final Position position = getData().getCurrentPosition();
final DirectionSounds.SoundPack soundPack = getData().getSounds().get(getData().getStep());
actualSoundPack = getData().getSounds().get(getData().getStep());
final Direction[] directions = DirectionsHelper.getNextDirections(getData().getLastDirectionFrom());
final Arrow[] arrows = map.getDirectionArrow(position, directions);
for (final Arrow a : arrows) {
......@@ -274,10 +280,10 @@ public class KidnappingGame extends AbstractTablexiaGame<GameState> {
}
}
map.addAction(Actions.sequence(ReplayAlphaAction.fadeOut(), new PlayExample(soundPack.getExample(this)), Actions.run(new Runnable() {
map.addAction(Actions.sequence(ReplayAlphaAction.fadeOut(), new PlayExample(actualSoundPack.getExample(this)), Actions.run(new Runnable() {
@Override
public void run() {
Music[] sounds = soundPack.getSoundsInOrder(KidnappingGame.this, directions, getData().getNextDirection());
Music[] sounds = actualSoundPack.getSoundsInOrder(KidnappingGame.this, directions, getData().getNextDirection());
map.addAction(Actions.sequence(ShowArrowAction.arrowsFadeIn(arrows), Actions.delay(0.5f), ArrowMusicAction.arrowSequence(sounds, arrows), ReplayAlphaAction.fadeIn(), Actions.run(new Runnable() {
public void run() {
map.getReplayButton().setEnabled();
......@@ -319,6 +325,9 @@ public class KidnappingGame extends AbstractTablexiaGame<GameState> {
}
public void correct() {
if (actualSoundPack != null) {
actualSoundPack.disposeMusic();
}
if (getData().getStep() == getData().getPath().size() - 1) {
gameComplete();
} else {
......
......@@ -53,6 +53,9 @@ public class DirectionSounds {
private static final long serialVersionUID = -4529735716574493739L;
private Music[] musics;
private Music exampleMusic;
public SoundPack(int soundNumber, String example, String correct, String wrong1, String wrong2) {
super();
this.soundNumber = soundNumber;
......@@ -87,7 +90,8 @@ public class DirectionSounds {
}
public Music getExample(KidnappingGame kidnappingGame) {
return getMusic(kidnappingGame, example);
exampleMusic = getMusic(kidnappingGame, example);
return exampleMusic;
}
public Music getWrong1(KidnappingGame kidnappingGame) {
......@@ -104,7 +108,7 @@ public class DirectionSounds {
public Music[] getSoundsInOrder(KidnappingGame kidnappingGame, Direction[] directions, Direction next) {
String[] sounds = getSoundNamesInOrder(directions, next);
Music[] musics = new Music[3];
musics = new Music[3];
for (int i = 0; i < 3; i++) {
musics[i] = getMusic(kidnappingGame, sounds[i]);
}
......@@ -124,6 +128,18 @@ public class DirectionSounds {
return soundNumber;
}
public void disposeMusic() {
if (musics != null) {
for (Music music : musics) {
music.dispose();
}
}
if (exampleMusic != null) {
exampleMusic.dispose();
}
}
@Override
public String toString() {
return "SoundPack{" +
......
......@@ -18,6 +18,7 @@ import com.badlogic.gdx.utils.viewport.Viewport;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import cz.nic.tablexia.TablexiaApplication;
import cz.nic.tablexia.TablexiaSettings;
......@@ -137,6 +138,8 @@ public class PursuitGame extends AbstractTablexiaGame<int[][]> {
private int movesCounter;
private int mapNumber = 0;
private AtomicBoolean gameFinished = new AtomicBoolean(false);
private Vehicle vehicle;
private Image finishFlag;
private Texture roadMap;
......@@ -233,6 +236,7 @@ public class PursuitGame extends AbstractTablexiaGame<int[][]> {
@Override
protected void gameLoaded(Map<String, String> gameState) {
gameFinished.set(false);
movesCounter = 0;
gridColumnCount = GameRulesHelper.getNumberOfColumns(getGameDifficulty());
overlappedPieceZIndex = (int) Math.pow(gridColumnCount, 2) - 1;
......@@ -347,10 +351,11 @@ public class PursuitGame extends AbstractTablexiaGame<int[][]> {
}
private void checkEndGameCondition() {
if (grid.allPiecesInCorrectPositions()) {
if (grid.allPiecesInCorrectPositions() && !gameFinished.get()) {
backgroundImage.removeListener(dragAndRotateActorListener);
endGame();
showCheckpoints();
gameFinished.set(true);
}
}
......
......@@ -5,6 +5,7 @@ import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.Touchable;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.badlogic.gdx.scenes.scene2d.actions.RunnableAction;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.utils.Align;
......@@ -14,6 +15,7 @@ import com.badlogic.gdx.utils.TimeUtils;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
import cz.nic.tablexia.TablexiaApplication;
import cz.nic.tablexia.TablexiaSettings;
......@@ -52,15 +54,18 @@ import cz.nic.tablexia.util.ui.dialog.components.TwoColumnContentDialogComponent
*/
public class ShootingRangeGame extends AbstractTablexiaGame<GameState> {
private static final ApplicationFontManager.FontType SCORE_COUNTER_TEXT_FONT = ApplicationFontManager.FontType.ROBOTO_BOLD_30;
private static final Color SCORE_COUNTER_TEXT_COLOR = Color.WHITE;
private static final Color ANIMATION_COLOR = Color.RED;
private static final float ANIMATION_DURATION = 0.1f;
private static final int SCORE_BOTTOM_PAD = 10;
private static final int SCORE_HORIZONTAL_PAD = 50;
private static final int NO_EFFECT = -1;
private static final int SLOW_DOWN_EFFECT = 0;
private static final int SPEED_UP_EFFECT = 1;
private static final ApplicationFontManager.FontType SCORE_COUNTER_TEXT_FONT = ApplicationFontManager.FontType.ROBOTO_BOLD_30;
private static final Color SCORE_COUNTER_TEXT_COLOR = Color.WHITE;
private static final Color ANIMATION_COLOR = Color.RED;
private static final float ANIMATION_DURATION = 0.1f;
private static final int SCORE_BOTTOM_PAD = 10;
private static final int SCORE_HORIZONTAL_PAD = 50;
private static final int NO_EFFECT = -1;
private static final int SLOW_DOWN_EFFECT = 0;
private static final int SPEED_UP_EFFECT = 1;
private static final int ONE_SECOND_DELAY = 1;
private static final float FLOWER_ANIMATION_DURATION = 0.35f;
private static final float WATCH_AND_CAROUSEL_HIDE_DURATION = 0.5f;
private GfxLibrary gfxLibrary = new GfxLibrary(this, TextureType.values());
private SfxLibrary sfxLibrary = new SfxLibrary(this, SoundType.values());
......@@ -218,17 +223,25 @@ public class ShootingRangeGame extends AbstractTablexiaGame<GameState> {
@Override
protected void gameVisible() {
scene.addAction(Actions.sequence(Actions.delay(3), Actions.run(new Runnable() {
// TODO animate flowers in
// TODO animate hand in
// TODO animate carousel in
@Override
public void run() {
scene.setTouchable(Touchable.enabled);
newTarget();
getData().setRunning(true);
}
})));
carousel.moveBy(0, carousel.getHeight());
watch.moveBy(0, -watch.getWatchHeight());
scene.addAction(Actions.sequence(Actions.delay(ONE_SECOND_DELAY), Actions.run(new Runnable() {
@Override
public void run() {
for (Row row : scene.getRows()) {
row.addActionToFlowers(Actions.sequence(Actions.show(), Actions.scaleTo(1, 1, FLOWER_ANIMATION_DURATION)));
}
carousel.addAction(Actions.sequence(Actions.delay(FLOWER_ANIMATION_DURATION), Actions.show(), Actions.moveBy(0, -carousel.getHeight(), WATCH_AND_CAROUSEL_HIDE_DURATION)));
watch.addAction(Actions.sequence(Actions.delay(FLOWER_ANIMATION_DURATION), Actions.show(), Actions.moveBy(0, watch.getWatchHeight(), WATCH_AND_CAROUSEL_HIDE_DURATION)));
}
}), Actions.delay(ONE_SECOND_DELAY), Actions.run(new Runnable() {
@Override
public void run() {
scene.setTouchable(Touchable.enabled);
newTarget();
getData().setRunning(true);
}
})));
}
@Override
......@@ -266,7 +279,7 @@ public class ShootingRangeGame extends AbstractTablexiaGame<GameState> {
*/
private void newTarget() {
getData().setHitLimit(getNewHitLimit());
getData().setCurrentTarget(getRandomFlower());
getData().setCurrentTarget(getRandomFlower(getData().getCurrentTarget()));
carousel.showNextFlower(getData().getCurrentTarget());
targetPositionController.setTargetType(getData().getCurrentTarget());
}
......@@ -276,9 +289,11 @@ public class ShootingRangeGame extends AbstractTablexiaGame<GameState> {
*
* @return TextureType of flower
*/
private TextureType getRandomFlower() {
if (targetPositionController.getAvailableTypes().size() > 0) {
TextureType[] types = targetPositionController.getAvailableTypes().toArray(new TextureType[0]);
private TextureType getRandomFlower(final TextureType previousTextureType) {
Set<TextureType> flowers = targetPositionController.getAvailableTypes();
flowers.remove(previousTextureType);
if (flowers.size() > 0) {
TextureType[] types = flowers.toArray(new TextureType[0]);
return types[getRandom().nextInt(types.length)];
}
return targetGenerator.getRandomFlowerType(getGameDifficulty());
......@@ -298,7 +313,7 @@ public class ShootingRangeGame extends AbstractTablexiaGame<GameState> {
}
getData().addTime(delta);
targetPositionController.onUpdate(delta * getData().getGameSpeed());
if (currentEffect!=NO_EFFECT && TimeUtils.timeSinceMillis(effectEntry)>effectDuration && !effectInterrupted) {
if (currentEffect != NO_EFFECT && TimeUtils.timeSinceMillis(effectEntry) > effectDuration && !effectInterrupted) {
//back to normal
currentEffect = NO_EFFECT;
effectDuration = 0;
......@@ -315,9 +330,18 @@ public class ShootingRangeGame extends AbstractTablexiaGame<GameState> {
getData().setRunning(false);
scene.setTouchable(Touchable.disabled);
sfxLibrary.getSound(SoundType.BELL).play();
// TODO hide flowers
// TODO play finish sound
gameComplete();
// elements hide animations
for (Row row : scene.getRows()) {
row.addActionToFlowers(Actions.sequence(Actions.scaleTo(1, 0, FLOWER_ANIMATION_DURATION), Actions.removeActor()));
}
carousel.addAction(Actions.sequence(Actions.moveBy(0, carousel.getHeight(), WATCH_AND_CAROUSEL_HIDE_DURATION), Actions.removeActor()));
watch.addAction(Actions.sequence(Actions.delay(WATCH_AND_CAROUSEL_HIDE_DURATION), Actions.moveBy(0, -watch.getWatchHeight(), WATCH_AND_CAROUSEL_HIDE_DURATION), new RunnableAction() {
@Override
public void run() {
gameComplete();
}
}));
}
@Override
......@@ -342,6 +366,8 @@ public class ShootingRangeGame extends AbstractTablexiaGame<GameState> {
watch.setPosition(0, getStage().getCamera().position.y - getViewportHeight() / 2);
carousel.setPosition(getViewportWidth() - (carousel.getWidth() / 2), getStage().getCamera().position.y + (getViewportHeight() / 2) - (carousel.getHeight() / 2));
score.setPosition(getViewportWidth() - score.getWidth() - SCORE_HORIZONTAL_PAD, SCORE_BOTTOM_PAD);
carousel.setVisible(false);
watch.setVisible(false);
}
/**
......@@ -362,7 +388,6 @@ public class ShootingRangeGame extends AbstractTablexiaGame<GameState> {
*/
@Override
protected void screenResized(int width, int height) {
// TODO: 3.2.16 fix screen resizing
super.screenResized(width, height);
scene.setBounds(0, getStage().getCamera().position.y - getViewportHeight() / 2, getViewportWidth(), getViewportHeight()); // scaling viewport camera y-position adjustment
watch.setPosition(0, getStage().getCamera().position.y - getViewportHeight() / 2);
......
package cz.nic.tablexia.game.games.shooting_range.actors;
import com.badlogic.gdx.scenes.scene2d.Action;
import com.badlogic.gdx.scenes.scene2d.Group;
import com.badlogic.gdx.scenes.scene2d.Touchable;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
......@@ -16,6 +17,9 @@ import cz.nic.tablexia.game.games.shooting_range.model.Wave;
* Created by lhoracek on 6/23/15.
*/
public class Row extends Group {
private static final float INITIAL_ROW_SCALE = 0.1f;
private Image waveImage;
private Group targetGroup;
private List<Target> targets = new CopyOnWriteArrayList<Target>();
......@@ -29,6 +33,9 @@ public class Row extends Group {
setTouchable(Touchable.childrenOnly);
targetGroup.setTouchable(Touchable.childrenOnly);
waveImage.setTouchable(Touchable.disabled);
// we start with stretched flowers to be able to run pop up animation on them
targetGroup.setScaleY(INITIAL_ROW_SCALE);
}
public void setWave(Wave wave) {
......@@ -70,4 +77,8 @@ public class Row extends Group {
waveImage.setSize(getWidth(), getHeight());
targetGroup.setSize(getWidth(), getHeight());
}
public void addActionToFlowers(Action action) {
targetGroup.addAction(action);
}
}
......@@ -24,7 +24,11 @@ public class Watch extends Group {
}
public void setTime(int time) {
int newRotation = (time%60) * -6;
int newRotation = (time % 60) * -6;
watchHand.addAction(Actions.rotateTo(newRotation, Math.abs(watch.getRotation() - newRotation) * 0.002f, Interpolation.elasticOut));
}
public float getWatchHeight() {
return watch.getHeight();
}
}
......@@ -172,7 +172,8 @@ public class AboutScreen extends AbstractTablexiaScreen<Void> {
addDefaultTextToContainer(AboutAssets.PSYCHOLOGICAL_CONCEPT_DETAILS);
addBoldTextToContainer(AboutAssets.DEVELOPERS);
addDefaultTextToContainer(AboutAssets.DEVELOPERS_DETAILS);
addDefaultTextToContainer(AboutAssets.DEVELOPERS_DETAILS_1);
addDefaultTextToContainer(AboutAssets.DEVELOPERS_DETAILS_2);
addBoldTextToContainer(AboutAssets.GAME_CONCEPT);
addDefaultTextToContainer(AboutAssets.GAME_CONCEPT_DETAILS);
......
......@@ -36,7 +36,8 @@ public class AboutAssets {
public static final String DEVELOPERS = "developers";
public static final String GAME_CONCEPT = "game_concept";
public static final String GAME_CONCEPT_DETAILS = "game_concept_details";
public static final String DEVELOPERS_DETAILS = "developers_details";
public static final String DEVELOPERS_DETAILS_1 = "developers_details_1";
public static final String DEVELOPERS_DETAILS_2 = "developers_details_2";
public static final String ILLUSTRATORS = "illustrators";
public static final String ILLUSTRATORS_DETAILS = "illustrators_details";
......
......@@ -117,6 +117,7 @@ public class FormScreen extends AbstractTablexiaScreen<Void> {
protected SignaturePane signaturePane;
protected Map<String, Boolean> validations;
protected Set<String> alreadyPlayedHints;
private Group mugshots;
protected TextField nameField;
......@@ -435,7 +436,7 @@ public class FormScreen extends AbstractTablexiaScreen<Void> {
}
private void showMugshotDialog() {
final Group mugshots = new Group();
mugshots = new Group();
// grey translucent overlay
Image overlay = new Image(ApplicationAtlasManager.getInstance().getColorTexture(ApplicationAtlasManager.COLOR_OVERLAY));
......@@ -616,12 +617,10 @@ public class FormScreen extends AbstractTablexiaScreen<Void> {
components.add(new ResizableSpaceContentDialogComponent());
components.add(new FixedSpaceContentDialogComponent());
dialog = new TablexiaComponentDialog(
dialog = TablexiaComponentDialogFactory.getInstance().createDialog(
getStage(),
TablexiaComponentDialog.TablexiaDialogType.BUBBLE_SQUARE,
components.toArray(new TablexiaDialogComponentAdapter[]{})
);
components.toArray(new TablexiaDialogComponentAdapter[]{}));
dialog.show(FormActorsLayout.HINT_DIALOG_WIDTH, FormActorsLayout.HINT_DIALOG_HEIGHT);
}
......@@ -643,6 +642,11 @@ public class FormScreen extends AbstractTablexiaScreen<Void> {
@Override
public void backButtonPressed() {
ApplicationBus.getInstance().post(new Tablexia.ChangeScreenEvent(TablexiaSettings.LOADER_SCREEN, TablexiaApplication.ScreenTransaction.FADE)).asynchronously();
if(mugshots != null) {
mugshots.remove();
mugshots = null;
} else {
ApplicationBus.getInstance().post(new Tablexia.ChangeScreenEvent(TablexiaSettings.LOADER_SCREEN, TablexiaApplication.ScreenTransaction.FADE)).asynchronously();
}
}
}
\ No newline at end of file
......@@ -99,6 +99,9 @@ public class PanoramaScreen extends AbstractTablexiaScreen<int[][]> {
private static final float NEWSPAPER_DETAIL_DIALOG_DIMMER = 0.6f;
private static final float NEWS_DIALOG_MAX_WIDTH = 0.85f;
private static final float NEWS_DIALOG_MAX_HEIGHT = 0.85f;
private TextureRegion clickmap;
private Group panel;
......@@ -412,13 +415,17 @@ public class PanoramaScreen extends AbstractTablexiaScreen<int[][]> {
components.add(new TouchCloseDialogComponent());
components.add(new AdaptiveSizeDialogComponent());
components.add(new SpeechDialogComponent(
components.add(
new SpeechDialogComponent(
new Point(
//4 is just a little offset to make sure that dialog appears to the top and right...
newsDetailDialog.getInnerLeftX() + newsDetailDialog.getInnerWidth() / 2 + 4,
newsDetailDialog.getInnerBottomY() + newsDetailDialog.getInnerHeight() / 2 + 4),
//4 is just a little offset to make sure that dialog appears to the top and right...
newsDetailDialog.getInnerLeftX() + newsDetailDialog.getInnerWidth() / 2 + 4,
newsDetailDialog.getInnerBottomY() + newsDetailDialog.getInnerHeight() / 2 + 4
),
new Vector2(newsDetailDialog.getInnerWidth() / 2f * 0.8f, newsDetailDialog.getInnerHeight() / 2f * 0.8f),
SpeechDialogComponent.ArrowType.BEND_ARROW, true));
SpeechDialogComponent.ArrowType.ARROW, true
)
);
components.add(new FixedSpaceContentDialogComponent());
components.add(new ResizableSpaceContentDialogComponent());
......@@ -485,10 +492,29 @@ public class PanoramaScreen extends AbstractTablexiaScreen<int[][]> {
TablexiaComponentDialog.TablexiaDialogType.DIALOG_RECTANGLE,
components.toArray(new TablexiaDialogComponentAdapter[]{})
);
int origNewsDetailWidth = getScreenTextureRegion(GFX_PATH + NEWSPAPER_DETAIL + (dialogIndex + 1)).getRegionWidth();
int origNewsDetailHeight = getScreenTextureRegion(GFX_PATH + NEWSPAPER_DETAIL + (dialogIndex + 1)).getRegionHeight();
this.newsDetailDialog.show(
getScreenTextureRegion(GFX_PATH + NEWSPAPER_DETAIL + (dialogIndex + 1)).getRegionWidth(),
getScreenTextureRegion(GFX_PATH + NEWSPAPER_DETAIL + (dialogIndex + 1)).getRegionHeight()
origNewsDetailWidth,
origNewsDetailHeight
);
if(newsDetailDialog.getOutterHeight() > getSceneInnerHeight() * NEWS_DIALOG_MAX_HEIGHT) {
int currNewsDetailHeight;
int currNewsDetailWidth;
currNewsDetailHeight = (int) (getSceneInnerHeight() * NEWS_DIALOG_MAX_HEIGHT);
currNewsDetailWidth = (int) (currNewsDetailHeight * ((float)(origNewsDetailWidth) / origNewsDetailHeight));
if(currNewsDetailWidth > getSceneWidth() * NEWS_DIALOG_MAX_WIDTH) {
currNewsDetailWidth = (int) (getSceneWidth() * NEWS_DIALOG_MAX_WIDTH);
currNewsDetailHeight = (int) (currNewsDetailWidth * ((float)(origNewsDetailHeight) / origNewsDetailWidth));
}
this.newsDetailDialog.setSize(currNewsDetailWidth, currNewsDetailHeight);
}
}
private Music playingMusic;
......@@ -604,12 +630,10 @@ public class PanoramaScreen extends AbstractTablexiaScreen<int[][]> {
components.add(new ResizableSpaceContentDialogComponent());
components.add(new FixedSpaceContentDialogComponent());
new TablexiaComponentDialog(
TablexiaComponentDialogFactory.getInstance().createDialog(
getStage(),
TablexiaComponentDialog.TablexiaDialogType.DIALOG_SQUARE_SHADOW,
components.toArray(new TablexiaDialogComponentAdapter[]{})
).show(getSceneWidth() * PanoramaActorsLayout.OFFICE_DIALOG_WIDTH, getSceneWidth() * PanoramaActorsLayout.OFFICE_DIALOG_HEIGHT);
components.toArray(new TablexiaDialogComponentAdapter[]{})).show(getSceneWidth() * PanoramaActorsLayout.OFFICE_DIALOG_WIDTH, getSceneWidth() * PanoramaActorsLayout.OFFICE_DIALOG_HEIGHT);
playMusic(MFX_PATH + "detective/" + num + ".mp3");
}
......
......@@ -379,11 +379,10 @@ public class HallOfFameScreen extends AbstractTablexiaScreen<Map<ITrophyDefiniti
GlyphLayout layout = new GlyphLayout();
layout.setText(font, text);
TablexiaComponentDialog tcd = new TablexiaComponentDialog(
TablexiaComponentDialog tcd = TablexiaComponentDialogFactory.getInstance().createDialog(
getStage(),
TablexiaComponentDialog.TablexiaDialogType.BUBBLE_ROUNDED,
components.toArray(new TablexiaDialogComponentAdapter[]{})
);
components.toArray(new TablexiaDialogComponentAdapter[]{}));
tcd.show(layout.width + 28, layout.height + 16);
}
});
......
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