diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/fr/umlv/java/wallj/controller/GameStateController.java | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/main/java/fr/umlv/java/wallj/controller/GameStateController.java b/src/main/java/fr/umlv/java/wallj/controller/GameStateController.java index d7b1638..7f0464c 100644 --- a/src/main/java/fr/umlv/java/wallj/controller/GameStateController.java +++ b/src/main/java/fr/umlv/java/wallj/controller/GameStateController.java | |||
@@ -13,19 +13,18 @@ public class GameStateController implements Controller { | |||
13 | 13 | ||
14 | @Override | 14 | @Override |
15 | public List<Event> update(Context context) { | 15 | public List<Event> update(Context context) { |
16 | boolean isConfirmEvent = context.getEvents().stream().anyMatch(event -> event instanceof ConfirmOrder); | 16 | boolean isConfirmOrder = Event.findFirst(context.getEvents(),ConfirmOrder.class).isPresent(); |
17 | boolean isGameOverEvent = context.getEvents().stream().anyMatch(event -> event instanceof GameOverEvent); | 17 | boolean isGameOverEvent = Event.findFirst(context.getEvents(),GameOverEvent.class).isPresent(); |
18 | Game currentGame = context.getGame(); | 18 | Game currentGame = context.getGame(); |
19 | LinkedList<Event> events = new LinkedList<>(); | 19 | LinkedList<Event> events = new LinkedList<>(); |
20 | //TODO exiting | ||
21 | if (isGameOverEvent) { | 20 | if (isGameOverEvent) { |
22 | currentGame.setOver(); | 21 | currentGame.setOver(); |
23 | } else { | 22 | } else { |
24 | if (isConfirmEvent) { | 23 | if (isConfirmOrder) { |
25 | if (currentGame.getCurrentStage().isCleared()) { | 24 | if (currentGame.getCurrentStage().isCleared()) { |
26 | if (currentGame.hasNextBoard()) { //continue | 25 | if (currentGame.hasNextBoard()) { //continue |
27 | currentGame.nextStage(); | 26 | currentGame.nextStage(); |
28 | } else { //no more board so game over | 27 | } else { //no more board so game over => exiting |
29 | currentGame.setOver(); | 28 | currentGame.setOver(); |
30 | } | 29 | } |
31 | } else {//retry | 30 | } else {//retry |