Merging game lobby with game state broadcast. Merge conflicts resolved.

Port numbers updated to 4942.
This commit is contained in:
Kusal Ekanayake
2017-07-24 15:26:51 +12:00
parent 1daac842f2
commit 526c12127f
6 changed files with 8 additions and 6 deletions
@@ -220,6 +220,7 @@ public class LobbyController implements Initializable, Observer{
@FXML @FXML
public void readyButtonPressed() { public void readyButtonPressed() {
setContentPane("/views/RaceView.fxml");
GameState.setCurrentStage(GameStages.RACING); GameState.setCurrentStage(GameStages.RACING);
} }
@@ -96,12 +96,12 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
startingBoats = new ArrayList<>(ClientPacketParser.getBoats().values()); startingBoats = new ArrayList<>(ClientPacketParser.getBoats().values());
includedCanvasController.setup(this); includedCanvasController.setup(this);
// includedCanvasController.initializeCanvas(); includedCanvasController.initializeCanvas();
initializeUpdateTimer(); initializeUpdateTimer();
initialiseFPSCheckBox(); initialiseFPSCheckBox();
initialiseAnnotationSlider(); initialiseAnnotationSlider();
initialiseBoatSelectionComboBox(); initialiseBoatSelectionComboBox();
// includedCanvasController.timer.start(); includedCanvasController.timer.start();
selectAnnotationBtn.setOnAction(event -> loadSelectAnnotationView()); selectAnnotationBtn.setOnAction(event -> loadSelectAnnotationView());
} }
@@ -75,7 +75,8 @@ public class StartScreenController {
new MainServerThread(); new MainServerThread();
ClientState.setHost(true); ClientState.setHost(true);
// host will connect and handshake to itself after setting up the server // host will connect and handshake to itself after setting up the server
ClientToServerThread clientToServerThread = new ClientToServerThread(ClientState.getHostIp(), 4950); // TODO: 24/07/17 wmu16 - Make port number some static global type constant?
ClientToServerThread clientToServerThread = new ClientToServerThread(ClientState.getHostIp(), 4942);
ClientState.setConnectedToHost(true); ClientState.setConnectedToHost(true);
controller.setClientToServerThread(clientToServerThread); controller.setClientToServerThread(clientToServerThread);
setContentPane("/views/LobbyView.fxml"); setContentPane("/views/LobbyView.fxml");
@@ -18,7 +18,7 @@ import java.util.*;
public class GameServerThread implements Runnable, Observer, ClientConnectionDelegate{ public class GameServerThread implements Runnable, Observer, ClientConnectionDelegate{
private static final Integer MAX_NUM_PLAYERS = 10; private static final Integer MAX_NUM_PLAYERS = 10;
public static final int PORT_NUMBER = 4950; public static final int PORT_NUMBER = 4942;
private Boolean hosting = true; private Boolean hosting = true;
@@ -17,7 +17,7 @@ import java.util.concurrent.PriorityBlockingQueue;
*/ */
public class MainServerThread implements Runnable, PacketBufferDelegate, ClientConnectionDelegate{ public class MainServerThread implements Runnable, PacketBufferDelegate, ClientConnectionDelegate{
private static final int PORT = 4950; private static final int PORT = 4942;
private static final Integer MAX_NUM_PLAYERS = 3; private static final Integer MAX_NUM_PLAYERS = 3;
private static final int LOG_LEVEL = 1; private static final int LOG_LEVEL = 1;
@@ -47,7 +47,7 @@
<Font size="21.0" /> <Font size="21.0" />
</font> </font>
</Text> </Text>
<TextField fx:id="portTextField" alignment="CENTER" maxWidth="75.0" prefHeight="25.0" prefWidth="55.0" promptText="Port" text="4950" GridPane.halignment="RIGHT" GridPane.rowIndex="4"> <TextField fx:id="portTextField" alignment="CENTER" maxWidth="75.0" prefHeight="25.0" prefWidth="55.0" promptText="Port" text="4942" GridPane.halignment="RIGHT" GridPane.rowIndex="4">
<opaqueInsets> <opaqueInsets>
<Insets /> <Insets />
</opaqueInsets> </opaqueInsets>