Commit 6068c5d7 authored by Matyáš Latner's avatar Matyáš Latner

Merge branch 'feature-gamemenu' into 'V3.2.1'

#447 #459  Fixed a glitch, which caused applications screen to black out after changin…

…g screen and pressing back button right after.

See merge request !402
parents efcb2259 ba0eefae
......@@ -62,7 +62,7 @@ public class TablexiaStorage {
Log.err(TablexiaStorage.class, "Cannot create database connection!", e);
}
} else {
throw new IllegalStateException("Data storage already initialized!");
Log.info(TablexiaStorage.class, "Data storage has already been initialized! Skipping initialization...");
}
}
......
......@@ -72,7 +72,6 @@ import cz.nic.tablexia.util.ui.button.TablexiaButton;
import cz.nic.tablexia.util.ui.dialog.TablexiaComponentDialog;
import cz.nic.tablexia.util.ui.dialog.TablexiaComponentDialogFactory;
import cz.nic.tablexia.util.ui.dialog.components.AdaptiveSizeDialogComponent;
import cz.nic.tablexia.util.ui.dialog.components.BackButtonHideComponent;
import cz.nic.tablexia.util.ui.dialog.components.CenterPositionDialogComponent;
import cz.nic.tablexia.util.ui.dialog.components.DimmerDialogComponent;
import cz.nic.tablexia.util.ui.dialog.components.FixedSpaceContentDialogComponent;
......
......@@ -88,7 +88,6 @@ public class KidnappingGame extends AbstractTablexiaGame<GameState> {
private Group ruleMessage;
private boolean ruleMessageShown = false;
private StandardTablexiaButton ruleButton;
private boolean isBackButtonAllowed;
private DirectionSounds.SoundPack actualSoundPack;
......@@ -105,7 +104,6 @@ public class KidnappingGame extends AbstractTablexiaGame<GameState> {
@Override
protected void gameLoaded(final java.util.Map<String, String> gameState) {
isBackButtonAllowed = false;
getStage().addActor(map = Map.MapFactory.createInstance(this, gfxLibrary, getData()));
map.setMapScale(MAP_SCALE);
......@@ -212,11 +210,6 @@ public class KidnappingGame extends AbstractTablexiaGame<GameState> {
ruleMessageShown = true;
}
@Override
public void backButtonPressed() {
if(isBackButtonAllowed) super.backButtonPressed();
}
private void playRuleSound(float delay) {
Timer.schedule(new Timer.Task(){
@Override
......@@ -248,7 +241,6 @@ public class KidnappingGame extends AbstractTablexiaGame<GameState> {
}
})));
}
isBackButtonAllowed = true;
}
@Override
......
......@@ -198,6 +198,8 @@ public abstract class AbstractTablexiaScreen<T> extends ScreenAdapter {
private boolean loadAsync;
private TablexiaAbstractFileManager.AssetsStorageType storageType;
private boolean backButtonAllowed = false;
private Map<String, TablexiaMusic> notDisposedMusics;
private static class TextManager extends TablexiaDataManager<I18NBundle> {
......@@ -583,6 +585,8 @@ public abstract class AbstractTablexiaScreen<T> extends ScreenAdapter {
private final void performScreenLoaded() {
Log.info(getClass(), "[ ------- Screen Loaded ------- ]");
backButtonAllowed = false;
// reset screen state after loading screen with state
TablexiaStorage.getInstance().resetScreenState(this);
......@@ -602,6 +606,8 @@ public abstract class AbstractTablexiaScreen<T> extends ScreenAdapter {
screenVisible(screenState);
performScreenResumed();
playIntroMusic();
backButtonAllowed = true;
}
private final void performScreenResized(int width, int height) {
......@@ -772,7 +778,7 @@ public abstract class AbstractTablexiaScreen<T> extends ScreenAdapter {
public void backButtonPressed(TablexiaApplication.BackButtonPressed event) {
if (event.shouldProcess(TablexiaApplication.BackButtonPressed.SCREEN_PRIORITY)) {
event.setProcessWithPriority(TablexiaApplication.BackButtonPressed.SCREEN_PRIORITY);
if (loadingComplete && getClass().equals(TablexiaApplication.getActualScreenClass())) {
if (loadingComplete && backButtonAllowed && getClass().equals(TablexiaApplication.getActualScreenClass())) {
backButtonPressed();
}
}
......
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