aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpacien2018-02-04 22:30:21 +0100
committerpacien2018-02-04 22:30:21 +0100
commit276753488bf2e6670bdd77d59042ed168e807a40 (patch)
treea9ea2bfbf1bd81f0c94bfbb6a2936a0a79a6653e
parent652db1608644b790489ffd4295a63a340364b88f (diff)
parente9e931b0e098bc4c97ea0be400683408150a4028 (diff)
downloadwallj-276753488bf2e6670bdd77d59042ed168e807a40.tar.gz
Merge branch 'master' of https://github.com/pacien/upem-java-wallj
Signed-off-by: pacien <pacien.trangirard@pacien.net> # Conflicts: # src/main/java/fr/umlv/java/wallj/viewer/ScreenManager.java
-rw-r--r--src/main/java/fr/umlv/java/wallj/board/BoardConverter.java2
-rw-r--r--src/main/java/fr/umlv/java/wallj/context/Game.java17
-rw-r--r--src/main/java/fr/umlv/java/wallj/context/GraphicsContext.java6
-rw-r--r--src/main/java/fr/umlv/java/wallj/event/ConfirmOrder.java2
4 files changed, 13 insertions, 14 deletions
diff --git a/src/main/java/fr/umlv/java/wallj/board/BoardConverter.java b/src/main/java/fr/umlv/java/wallj/board/BoardConverter.java
index 84feb41..53f11c0 100644
--- a/src/main/java/fr/umlv/java/wallj/board/BoardConverter.java
+++ b/src/main/java/fr/umlv/java/wallj/board/BoardConverter.java
@@ -14,6 +14,7 @@ public final class BoardConverter {
14 } 14 }
15 15
16 /** 16 /**
17 * Converts a list of Blocks to a Board
17 * @param blocks the list of blocks to convert in a board 18 * @param blocks the list of blocks to convert in a board
18 * @return the converted board 19 * @return the converted board
19 */ 20 */
@@ -29,6 +30,7 @@ public final class BoardConverter {
29 } 30 }
30 31
31 /** 32 /**
33 * Converts a Board to a list of Blocks
32 * @param board the board to convert into a list of blocks 34 * @param board the board to convert into a list of blocks
33 * @return the list of blocks converted 35 * @return the list of blocks converted
34 */ 36 */
diff --git a/src/main/java/fr/umlv/java/wallj/context/Game.java b/src/main/java/fr/umlv/java/wallj/context/Game.java
index b78bae4..7d09b26 100644
--- a/src/main/java/fr/umlv/java/wallj/context/Game.java
+++ b/src/main/java/fr/umlv/java/wallj/context/Game.java
@@ -39,7 +39,7 @@ public final class Game implements Updateable {
39 /** 39 /**
40 * @return a boolean on the condition of having a next Board in our game. 40 * @return a boolean on the condition of having a next Board in our game.
41 */ 41 */
42 public boolean hasNextBoard() { 42 private boolean hasNextBoard() {
43 return indexBoard + 1 < boards.size(); 43 return indexBoard + 1 < boards.size();
44 } 44 }
45 45
@@ -61,21 +61,20 @@ public final class Game implements Updateable {
61 return currentStage; 61 return currentStage;
62 } 62 }
63 63
64 /**
65 * @return the status of the game
66 */
64 public boolean isOver() { 67 public boolean isOver() {
65 return over; 68 return over;
66 } 69 }
67 70
68 public void setOver() { 71 private void nextStage() {
69 over = true;
70 }
71
72 public void nextStage() {
73 if (hasNextBoard()) { 72 if (hasNextBoard()) {
74 currentStage = new Stage(nextBoard()); 73 currentStage = new Stage(nextBoard());
75 } 74 }
76 } 75 }
77 76
78 public void retryStage() { 77 private void retryStage() {
79 currentStage = new Stage(currentStage.getBoard()); 78 currentStage = new Stage(currentStage.getBoard());
80 } 79 }
81 80
@@ -84,12 +83,12 @@ public final class Game implements Updateable {
84 nextStage(); 83 nextStage();
85 return; 84 return;
86 } 85 }
87 setOver(); 86 over = true;
88 } 87 }
89 88
90 private void handleEvents(Context context) { 89 private void handleEvents(Context context) {
91 if (Events.findFirst(context.getEvents(), QuitGameOrder.class).isPresent()) { 90 if (Events.findFirst(context.getEvents(), QuitGameOrder.class).isPresent()) {
92 context.getGame().setOver(); 91 over = true;
93 return; 92 return;
94 } 93 }
95 if (Events.findFirst(context.getEvents(), ConfirmOrder.class).isPresent()) { 94 if (Events.findFirst(context.getEvents(), ConfirmOrder.class).isPresent()) {
diff --git a/src/main/java/fr/umlv/java/wallj/context/GraphicsContext.java b/src/main/java/fr/umlv/java/wallj/context/GraphicsContext.java
index 2c1c72a..2eaa3b4 100644
--- a/src/main/java/fr/umlv/java/wallj/context/GraphicsContext.java
+++ b/src/main/java/fr/umlv/java/wallj/context/GraphicsContext.java
@@ -5,12 +5,10 @@ import fr.umlv.zen5.ScreenInfo;
5import org.jbox2d.common.Vec2; 5import org.jbox2d.common.Vec2;
6 6
7import java.awt.*; 7import java.awt.*;
8import java.awt.geom.Ellipse2D;
9import java.awt.geom.Rectangle2D;
10import java.util.Objects; 8import java.util.Objects;
11 9
12/** 10/**
13 * A context of the current graphic status of the application. 11 * The context of the application containing graphics information and services at one tick
14 * 12 *
15 * @author Adam NAILI 13 * @author Adam NAILI
16 */ 14 */
@@ -20,7 +18,7 @@ public final class GraphicsContext {
20 18
21 /** 19 /**
22 * @param graphics2D the current drawable canvas 20 * @param graphics2D the current drawable canvas
23 * @param screenInfo the informations about the screen 21 * @param screenInfo the information about the screen
24 */ 22 */
25 public GraphicsContext(Graphics2D graphics2D, ScreenInfo screenInfo) { 23 public GraphicsContext(Graphics2D graphics2D, ScreenInfo screenInfo) {
26 this.graphics2D = Objects.requireNonNull(graphics2D); 24 this.graphics2D = Objects.requireNonNull(graphics2D);
diff --git a/src/main/java/fr/umlv/java/wallj/event/ConfirmOrder.java b/src/main/java/fr/umlv/java/wallj/event/ConfirmOrder.java
index 0f5fbd6..7a546dd 100644
--- a/src/main/java/fr/umlv/java/wallj/event/ConfirmOrder.java
+++ b/src/main/java/fr/umlv/java/wallj/event/ConfirmOrder.java
@@ -1,7 +1,7 @@
1package fr.umlv.java.wallj.event; 1package fr.umlv.java.wallj.event;
2 2
3/** 3/**
4 * Event coming from a confirmation action from the user 4 * Signals that the user is confirming thanks to inputs
5 * 5 *
6 * @author Adam NAILI 6 * @author Adam NAILI
7 */ 7 */