From 5aa5ed13dc293da85a7d87ef94267d97e2c0e7d0 Mon Sep 17 00:00:00 2001 From: David Schilling Date: Sat, 11 Apr 2015 20:10:16 +0200 Subject: [PATCH] wait 1,5 sec before leaving solved levelGameScene --- .../de/sopa/scene/game/LevelModeGameScene.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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); } }));