diff --git a/app/src/main/java/de/sopa/manager/StoryService.java b/app/src/main/java/de/sopa/manager/StoryService.java index b6a5f2b7..58531fc4 100644 --- a/app/src/main/java/de/sopa/manager/StoryService.java +++ b/app/src/main/java/de/sopa/manager/StoryService.java @@ -94,4 +94,6 @@ public interface StoryService { void loadLevelModeCompleteSceneFromScoreScene(); void loadLevelChoiceFromLevelModeCompleteScene(); + + void loadJustPlaySceneFromJustPlayLostScene(); } diff --git a/app/src/main/java/de/sopa/manager/StoryServiceImpl.java b/app/src/main/java/de/sopa/manager/StoryServiceImpl.java index d64366cf..c61ea62c 100644 --- a/app/src/main/java/de/sopa/manager/StoryServiceImpl.java +++ b/app/src/main/java/de/sopa/manager/StoryServiceImpl.java @@ -106,6 +106,11 @@ public void loadLevelChoiceFromLevelModeCompleteScene() { levelModeSceneService.loadLevelChoiceFromLevelModeCompleteScene(); } + @Override + public void loadJustPlaySceneFromJustPlayLostScene() { + justPlaySceneService.loadJustPlaySceneFromJustPlayLostScene(); + } + @Override public void loadLevelChoiceSceneFromMenuScene() { diff --git a/app/src/main/java/de/sopa/scene/justplay/JustPlayLostScene.java b/app/src/main/java/de/sopa/scene/justplay/JustPlayLostScene.java index f0604e7d..16f893ae 100644 --- a/app/src/main/java/de/sopa/scene/justplay/JustPlayLostScene.java +++ b/app/src/main/java/de/sopa/scene/justplay/JustPlayLostScene.java @@ -47,7 +47,20 @@ public JustPlayLostScene(final JustPlayResult justPlayResult) { } private void addShareButton() { - final ButtonSprite shareLogo = new ButtonSprite((camera.getWidth() * 0.5f), (camera.getHeight() - 400), resourcesManager.shareScoreTexture, vbom, new ButtonSprite.OnClickListener() { + + + final ButtonSprite restartButton = new ButtonSprite((camera.getWidth() / 2 - 200), (camera.getHeight() - 400), resourcesManager.restartRegion, vbom, new ButtonSprite.OnClickListener() { + @Override + public void onClick(ButtonSprite pButtonSprite, float pTouchAreaLocalX, float pTouchAreaLocalY) { + storyService.loadJustPlaySceneFromJustPlayLostScene(); + } + }); + attachChild(restartButton); + registerTouchArea(restartButton); + + + + final ButtonSprite shareLogo = new ButtonSprite((float) (camera.getWidth() * 0.64), (camera.getHeight() - 400), resourcesManager.shareScoreTexture, vbom, new ButtonSprite.OnClickListener() { @Override public void onClick(ButtonSprite pButtonSprite, float pTouchAreaLocalX, float pTouchAreaLocalY) { Intent shareIntent = new Intent(); @@ -68,7 +81,7 @@ private void addParticleSystem() { } private void addBackToMenuButton() { - ButtonSprite backToMenuButton = new ButtonSprite((camera.getWidth() / 2 - 400), (camera.getHeight() - 400), + ButtonSprite backToMenuButton = new ButtonSprite(0, (camera.getHeight() - 400), resourcesManager.backToMenuRegionP, vbom, new ButtonSprite.OnClickListener() { @Override public void onClick(ButtonSprite pButtonSprite, float pTouchAreaLocalX, float pTouchAreaLocalY) { diff --git a/app/src/main/java/de/sopa/scene/justplay/JustPlaySceneService.java b/app/src/main/java/de/sopa/scene/justplay/JustPlaySceneService.java index 7f8b0426..9c3e169c 100644 --- a/app/src/main/java/de/sopa/scene/justplay/JustPlaySceneService.java +++ b/app/src/main/java/de/sopa/scene/justplay/JustPlaySceneService.java @@ -19,4 +19,6 @@ public interface JustPlaySceneService extends BaseSceneService { void loadJustPlaySceneFromJustPlayScoreScene(); void loadJustPlaySceneFromJustPlayScene(TimeBasedGameService timeBasedGameService, JustPlayLevel justPlayLevel); + + void loadJustPlaySceneFromJustPlayLostScene(); } diff --git a/app/src/main/java/de/sopa/scene/justplay/JustPlaySceneServiceImpl.java b/app/src/main/java/de/sopa/scene/justplay/JustPlaySceneServiceImpl.java index 7fd699b5..59bc20ce 100644 --- a/app/src/main/java/de/sopa/scene/justplay/JustPlaySceneServiceImpl.java +++ b/app/src/main/java/de/sopa/scene/justplay/JustPlaySceneServiceImpl.java @@ -104,15 +104,31 @@ public void loadJustPlaySceneFromJustPlayScene(final TimeBasedGameService timeBa engine.registerUpdateHandler(new TimerHandler(0.1f, new ITimerCallback() { - @Override - public void onTimePassed(final TimerHandler pTimerHandler) { + @Override + public void onTimePassed(final TimerHandler pTimerHandler) { - engine.unregisterUpdateHandler(pTimerHandler); - justPlayGameScene.disposeScene(); - justPlayGameScene = new JustPlayGameScene(timeBasedGameService, justPlayLevel); - setScene(justPlayGameScene); - } - })); + engine.unregisterUpdateHandler(pTimerHandler); + justPlayGameScene.disposeScene(); + justPlayGameScene = new JustPlayGameScene(timeBasedGameService, justPlayLevel); + setScene(justPlayGameScene); + } + })); + } + + @Override + public void loadJustPlaySceneFromJustPlayLostScene() { + + this.justPlayService = new JustPlayServiceImpl(); + engine.registerUpdateHandler(new TimerHandler(0.1f, new ITimerCallback() { + + @Override + public void onTimePassed(final TimerHandler pTimerHandler) { + + engine.unregisterUpdateHandler(pTimerHandler); + justPlayGameScene = new JustPlayGameScene(justPlayService.getNextLevel()); + setScene(justPlayGameScene); + } + })); }