Implemented GUI side of resetting the board
This commit is contained in:
@@ -82,6 +82,11 @@ public class TicTacToe_Client {
|
||||
}
|
||||
//this.drawWinningLine(winCoordinates);
|
||||
//client.exitProcess();
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
client.resetBoard();
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -152,6 +152,10 @@ public class Client {
|
||||
}
|
||||
}
|
||||
|
||||
public void printLog(String message, boolean success){
|
||||
clientLogger.printLog(message, success, LogType.Log);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ public class Engine extends Application {
|
||||
private boolean mouseClicked = false;
|
||||
private Point coordinates = new Point();
|
||||
private Stage primaryStage;
|
||||
private MouseEvent mouseEvent;
|
||||
|
||||
public Engine() {
|
||||
setEngine(this);
|
||||
@@ -91,6 +90,9 @@ public class Engine extends Application {
|
||||
System.err.println("Wrong length of gameState string");
|
||||
return;
|
||||
}
|
||||
if (gameState.equals("---------")){
|
||||
grid.getChildren().clear();
|
||||
}
|
||||
for (int i = 0; i < gameState.length(); i++) {
|
||||
int column = i / 3;
|
||||
int row = i % 3;
|
||||
|
||||
@@ -208,8 +208,6 @@ public class SinglePlayerServer {
|
||||
|
||||
case "exit":
|
||||
try {
|
||||
outstreams.get(client).writeInt(200);
|
||||
outstreams.get(client).flush();
|
||||
outstreams.get(client).close();
|
||||
instreams.get(client).close();
|
||||
client.close();
|
||||
@@ -220,14 +218,8 @@ public class SinglePlayerServer {
|
||||
break;
|
||||
|
||||
case "reset":
|
||||
try {
|
||||
outstreams.get(client).writeInt(200);
|
||||
outstreams.get(client).flush();
|
||||
ticTacToe_server.resetGameState();
|
||||
this.gameFlow("gameState", client);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
this.sendGameState(client);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user