mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Compare commits
2 Commits
sprint_6.0
...
sprint_6.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 2fcff65dd6 | |||
| 4c730ea890 |
@@ -68,7 +68,7 @@ public class App extends Application {
|
|||||||
@Override
|
@Override
|
||||||
public void start(Stage primaryStage) throws Exception {
|
public void start(Stage primaryStage) throws Exception {
|
||||||
Parent root = FXMLLoader.load(getClass().getResource("/views/StartScreenView.fxml"));
|
Parent root = FXMLLoader.load(getClass().getResource("/views/StartScreenView.fxml"));
|
||||||
primaryStage.setTitle("RaceVision");
|
primaryStage.setTitle("Party Parrots at Sea");
|
||||||
Scene scene = new Scene(root, 1530, 960);
|
Scene scene = new Scene(root, 1530, 960);
|
||||||
scene.getStylesheets().add(getClass().getResource("/css/master.css").toString());
|
scene.getStylesheets().add(getClass().getResource("/css/master.css").toString());
|
||||||
primaryStage.setScene(scene);
|
primaryStage.setScene(scene);
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ public class GameClient {
|
|||||||
startClientToServerThread(ipAddress, portNumber);
|
startClientToServerThread(ipAddress, portNumber);
|
||||||
socketThread.addDisconnectionListener((cause) -> {
|
socketThread.addDisconnectionListener((cause) -> {
|
||||||
showConnectionError(cause);
|
showConnectionError(cause);
|
||||||
|
tearDownConnection();
|
||||||
Platform.runLater(this::loadStartScreen);
|
Platform.runLater(this::loadStartScreen);
|
||||||
});
|
});
|
||||||
socketThread.addStreamObserver(this::parsePackets);
|
socketThread.addStreamObserver(this::parsePackets);
|
||||||
@@ -91,7 +92,10 @@ public class GameClient {
|
|||||||
lobbyController.setCourseName("");
|
lobbyController.setCourseName("");
|
||||||
}
|
}
|
||||||
|
|
||||||
lobbyController.addCloseListener((exitCause) -> this.loadStartScreen());
|
lobbyController.addCloseListener((exitCause) -> {
|
||||||
|
this.tearDownConnection();
|
||||||
|
this.loadStartScreen();
|
||||||
|
});
|
||||||
this.lobbyController = lobbyController;
|
this.lobbyController = lobbyController;
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
showConnectionError("Unable to find server");
|
showConnectionError("Unable to find server");
|
||||||
@@ -109,6 +113,7 @@ public class GameClient {
|
|||||||
try {
|
try {
|
||||||
startClientToServerThread(ipAddress, portNumber);
|
startClientToServerThread(ipAddress, portNumber);
|
||||||
socketThread.addDisconnectionListener((cause) -> {
|
socketThread.addDisconnectionListener((cause) -> {
|
||||||
|
this.tearDownConnection();
|
||||||
Platform.runLater(this::loadStartScreen);
|
Platform.runLater(this::loadStartScreen);
|
||||||
});
|
});
|
||||||
LobbyController lobbyController = loadLobby();
|
LobbyController lobbyController = loadLobby();
|
||||||
@@ -129,8 +134,7 @@ public class GameClient {
|
|||||||
lobbyController.disableReadyButton();
|
lobbyController.disableReadyButton();
|
||||||
server.startGame();
|
server.startGame();
|
||||||
} else if (exitCause == CloseStatus.LEAVE) {
|
} else if (exitCause == CloseStatus.LEAVE) {
|
||||||
server.terminate();
|
tearDownConnection();
|
||||||
server = null;
|
|
||||||
loadStartScreen();
|
loadStartScreen();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -141,12 +145,20 @@ public class GameClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadStartScreen() {
|
private void tearDownConnection() {
|
||||||
socketThread.setSocketToClose();
|
socketThread.setSocketToClose();
|
||||||
if (server != null) {
|
if (server != null) {
|
||||||
server.terminate();
|
server.terminate();
|
||||||
server = null;
|
server = null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadStartScreen() {
|
||||||
|
// socketThread.setSocketToClose();
|
||||||
|
// if (server != null) {
|
||||||
|
// server.terminate();
|
||||||
|
// server = null;
|
||||||
|
// }
|
||||||
FXMLLoader fxmlLoader = new FXMLLoader(
|
FXMLLoader fxmlLoader = new FXMLLoader(
|
||||||
getClass().getResource("/views/StartScreenView.fxml"));
|
getClass().getResource("/views/StartScreenView.fxml"));
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -20,7 +20,9 @@
|
|||||||
<children>
|
<children>
|
||||||
<GridPane fx:id="startScreen2" layoutX="365.0" layoutY="285.0" nodeOrientation="LEFT_TO_RIGHT" prefWidth="800.0" style="-fx-background-color: #2C2c36;">
|
<GridPane fx:id="startScreen2" layoutX="365.0" layoutY="285.0" nodeOrientation="LEFT_TO_RIGHT" prefWidth="800.0" style="-fx-background-color: #2C2c36;">
|
||||||
<children>
|
<children>
|
||||||
<Label alignment="CENTER" text="Welcome to Race Vision" textFill="WHITE" GridPane.columnSpan="2147483647" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="BOTTOM">
|
<Label alignment="CENTER" text="Party Parrots at Sea" textFill="WHITE"
|
||||||
|
GridPane.columnSpan="2147483647" GridPane.halignment="CENTER" GridPane.rowIndex="1"
|
||||||
|
GridPane.valignment="BOTTOM">
|
||||||
<font>
|
<font>
|
||||||
<Font size="40.0" />
|
<Font size="40.0" />
|
||||||
</font>
|
</font>
|
||||||
|
|||||||
Reference in New Issue
Block a user