diff --git a/app/src/main/java/de/sopa/scene/game/LevelModeGameScene.java b/app/src/main/java/de/sopa/scene/game/LevelModeGameScene.java index 0d0ebc8d..e322ce45 100644 --- a/app/src/main/java/de/sopa/scene/game/LevelModeGameScene.java +++ b/app/src/main/java/de/sopa/scene/game/LevelModeGameScene.java @@ -38,8 +38,9 @@ public void onClick(ButtonSprite pButtonSprite, float pTouchAreaLocalX, float pT @Override public void onBackKeyPressed() { - leaveScene = true; - sceneService.loadLevelChoiceSceneFromGameScene(); + if(!leaveScene) { + sceneService.loadLevelChoiceSceneFromGameScene(); + } } public void onSolvedGame() { @@ -48,13 +49,12 @@ public void onSolvedGame() { levelService.persistLevelResult(levelResult); int nextLevelId = level.getId() + 1; levelService.unlockLevel(nextLevelId); - engine.registerUpdateHandler(new TimerHandler(1.5f, new ITimerCallback() { + this.leaveScene = true; + engine.registerUpdateHandler(new TimerHandler(1.5f,new ITimerCallback() { @Override public void onTimePassed(TimerHandler pTimerHandler) { - if (!leaveScene) { - engine.unregisterUpdateHandler(pTimerHandler); - sceneService.loadScoreScreen(levelResult); - } + engine.unregisterUpdateHandler(pTimerHandler); + sceneService.loadScoreScreen(levelResult); } }));