Skip to content

Commit

Permalink
Add reloadbutton for justPlayLostScene
Browse files Browse the repository at this point in the history
This closes #63
  • Loading branch information
Raphael committed Sep 4, 2015
1 parent 87b699a commit 96aef08
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 10 deletions.
2 changes: 2 additions & 0 deletions app/src/main/java/de/sopa/manager/StoryService.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,6 @@ public interface StoryService {
void loadLevelModeCompleteSceneFromScoreScene();

void loadLevelChoiceFromLevelModeCompleteScene();

void loadJustPlaySceneFromJustPlayLostScene();
}
5 changes: 5 additions & 0 deletions app/src/main/java/de/sopa/manager/StoryServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ public void loadLevelChoiceFromLevelModeCompleteScene() {
levelModeSceneService.loadLevelChoiceFromLevelModeCompleteScene();
}

@Override
public void loadJustPlaySceneFromJustPlayLostScene() {
justPlaySceneService.loadJustPlaySceneFromJustPlayLostScene();
}


@Override
public void loadLevelChoiceSceneFromMenuScene() {
Expand Down
17 changes: 15 additions & 2 deletions app/src/main/java/de/sopa/scene/justplay/JustPlayLostScene.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ public interface JustPlaySceneService extends BaseSceneService {
void loadJustPlaySceneFromJustPlayScoreScene();

void loadJustPlaySceneFromJustPlayScene(TimeBasedGameService timeBasedGameService, JustPlayLevel justPlayLevel);

void loadJustPlaySceneFromJustPlayLostScene();
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}));
}


Expand Down

0 comments on commit 96aef08

Please sign in to comment.