Updated: LoginFXMLController
This commit is contained in:
@@ -6,6 +6,7 @@ import it.polimi.ingsw.gc14.Network.TCP.Client.TCPClient;
|
||||
import javafx.application.Platform;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.paint.Color;
|
||||
|
||||
import java.net.Inet4Address;
|
||||
import java.net.InetAddress;
|
||||
@@ -90,15 +91,17 @@ public class LoginFXMLController {
|
||||
RMIClient client = new RMIClient(controller, ip, 1099, interfaccia);
|
||||
if (client.connect(nome, numPlayers)) {
|
||||
controller.setClient(client);
|
||||
Platform.runLater(() ->{ labelErrore.setTextFill(Color.GREEN); labelErrore.setText("Connected successfully! Waiting other players");});
|
||||
} else {
|
||||
Platform.runLater(() -> labelErrore.setText("Connessione RMI fallita."));
|
||||
Platform.runLater(() ->{ labelErrore.setTextFill(Color.RED); labelErrore.setText("Connection RMI failed.");});
|
||||
}
|
||||
} else {
|
||||
TCPClient client = new TCPClient(controller, ip, 8080, 8081);
|
||||
if (client.connect(nome, numPlayers)) {
|
||||
controller.setClient(client);
|
||||
Platform.runLater(() ->{ labelErrore.setTextFill(Color.GREEN); labelErrore.setText("Connected successfully! Waiting other players");});
|
||||
} else {
|
||||
Platform.runLater(() -> labelErrore.setText("Connessione TCP fallita."));
|
||||
Platform.runLater(() ->{ labelErrore.setTextFill(Color.RED); labelErrore.setText("Connection TCP failed.");});
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
|
||||
Reference in New Issue
Block a user