Singleplayer functions flawless Multiplayer first round

This commit is contained in:
2021-03-23 10:34:34 +01:00
parent 76a0ff52fa
commit e96708b64e
4 changed files with 23 additions and 26 deletions

View File

@@ -16,11 +16,18 @@ public class TicTacToe_Client {
public TicTacToe_Client() {
renderEngine = Engine.waitForEngine();
client = new Client("server", 2589, clientName);
client = new Client("81.169.149.143", 2589, clientName);
client.handshake();
isPlayerOne = client.isPlayerOne();
isAllowedToMove = isPlayerOne;
this.setWindowTitle(isPlayerOne);
//this.setWindowTitle(isPlayerOne);
Platform.runLater(new Runnable() {
@Override
public void run() {
renderEngine.updateTitle(clientName);
}
});
client.sendToServer("ready");
}
@@ -56,6 +63,7 @@ public class TicTacToe_Client {
break;
case "userInput":
client.printLog("Waiting for userInput", true, LogType.Log);
while (!renderEngine.isMouseClicked()) {
try {
Thread.sleep(100);
@@ -94,6 +102,7 @@ public class TicTacToe_Client {
e.printStackTrace();
}
client.resetBoard();
isAllowedToMove = isPlayerOne;
}
private void onInvalidInput(){

View File

@@ -50,6 +50,7 @@ public class Client {
}
} catch (IOException e) {
e.printStackTrace();
System.exit(0);
}
}