Skip to content

Commit

Permalink
forbidd game movement when its solved
Browse files Browse the repository at this point in the history
References #46
  • Loading branch information
David Schilling committed Aug 24, 2015
1 parent bb7da5b commit 235d0a4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 6 additions & 4 deletions app/src/main/java/de/sopa/model/game/GameServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ public boolean lostLevel() {
@Override
public void shiftLine(boolean horizontal, int row, int steps, boolean silent) {

gameFieldService.shiftLine(level, horizontal, row, steps);
solvedPuzzle = gameFieldService.solvedPuzzle(level);
if (!solvedPuzzle) {
gameFieldService.shiftLine(level, horizontal, row, steps);
solvedPuzzle = gameFieldService.solvedPuzzle(level);

if (!silent) {
notifyAllObserver();
if (!silent) {
notifyAllObserver();
}
}
}

Expand Down
10 changes: 4 additions & 6 deletions app/src/main/java/de/sopa/scene/game/GameScene.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@ public GameScene(Level level) {
@Override
public void updateGameScene() {

if (!gameFieldView.isActive()) {
updateTiles(gameService.solvedPuzzle());
}

scoreText.setText(String.valueOf(gameService.getLevel().getMovesCount()));

if (gameService.solvedPuzzle()) {
setOnSceneTouchListener(null);
gameService.detatch(this);
Expand All @@ -72,7 +66,11 @@ public void onTimePassed(final TimerHandler pTimerHandler) {
onSolvedGame();
}
}));
} else {
scoreText.setText(String.valueOf(gameService.getLevel().getMovesCount()));
}

updateTiles(gameService.solvedPuzzle());
}


Expand Down

0 comments on commit 235d0a4

Please sign in to comment.