mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Updated lobby controller to pass the player ID through, and the lobby view to have a customize button.
tags: #story[1142]
This commit is contained in:
@@ -72,7 +72,6 @@ public class GameClient {
|
|||||||
|
|
||||||
socketThread.addStreamObserver(this::parsePackets);
|
socketThread.addStreamObserver(this::parsePackets);
|
||||||
LobbyController lobbyController = loadLobby();
|
LobbyController lobbyController = loadLobby();
|
||||||
lobbyController.setPlayerListSource(clientLobbyList);
|
|
||||||
lobbyController.disableReadyButton();
|
lobbyController.disableReadyButton();
|
||||||
lobbyController.setTitle("Connected to host - IP : " + ipAddress + " Port : " + portNumber);
|
lobbyController.setTitle("Connected to host - IP : " + ipAddress + " Port : " + portNumber);
|
||||||
lobbyController.addCloseListener((exitCause) -> this.loadStartScreen());
|
lobbyController.addCloseListener((exitCause) -> this.loadStartScreen());
|
||||||
@@ -93,7 +92,6 @@ public class GameClient {
|
|||||||
}
|
}
|
||||||
socketThread.addStreamObserver(this::parsePackets);
|
socketThread.addStreamObserver(this::parsePackets);
|
||||||
LobbyController lobbyController = loadLobby();
|
LobbyController lobbyController = loadLobby();
|
||||||
lobbyController.setPlayerListSource(clientLobbyList);
|
|
||||||
lobbyController.setTitle("Hosting Lobby - IP : " + ipAddress + " Port : " + portNumber);
|
lobbyController.setTitle("Hosting Lobby - IP : " + ipAddress + " Port : " + portNumber);
|
||||||
lobbyController.addCloseListener(exitCause -> {
|
lobbyController.addCloseListener(exitCause -> {
|
||||||
if (exitCause == CloseStatus.READY) {
|
if (exitCause == CloseStatus.READY) {
|
||||||
@@ -133,7 +131,11 @@ public class GameClient {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return fxmlLoader.getController();
|
LobbyController lobbyController = fxmlLoader.getController();
|
||||||
|
lobbyController.setPlayerListSource(clientLobbyList);
|
||||||
|
lobbyController.setPlayerID(socketThread.getClientId());
|
||||||
|
|
||||||
|
return lobbyController;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadRaceView() {
|
private void loadRaceView() {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import javafx.scene.image.ImageView;
|
|||||||
import javafx.scene.text.Text;
|
import javafx.scene.text.Text;
|
||||||
import seng302.gameServer.GameStages;
|
import seng302.gameServer.GameStages;
|
||||||
import seng302.gameServer.GameState;
|
import seng302.gameServer.GameState;
|
||||||
|
import seng302.visualiser.GameView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class describing the actions of the lobby screen
|
* A class describing the actions of the lobby screen
|
||||||
@@ -72,6 +73,7 @@ public class LobbyController {
|
|||||||
private List<TextArea> listViews = new ArrayList<>();
|
private List<TextArea> listViews = new ArrayList<>();
|
||||||
|
|
||||||
private int MAX_NUM_PLAYERS = 8;
|
private int MAX_NUM_PLAYERS = 8;
|
||||||
|
private Integer playerID;
|
||||||
|
|
||||||
private List<LobbyCloseListener> lobbyListeners = new ArrayList<>();
|
private List<LobbyCloseListener> lobbyListeners = new ArrayList<>();
|
||||||
private ObservableList<String> players;
|
private ObservableList<String> players;
|
||||||
@@ -98,6 +100,9 @@ public class LobbyController {
|
|||||||
//Update players if one added.
|
//Update players if one added.
|
||||||
for (int i = 0; i < players.size(); i++) {
|
for (int i = 0; i < players.size(); i++) {
|
||||||
listViews.get(i).setText(players.get(i));
|
listViews.get(i).setText(players.get(i));
|
||||||
|
if (playerID == (i + 1)) {
|
||||||
|
listViews.get(i).setText(listViews.get(i).getText() + " (YOU)");
|
||||||
|
}
|
||||||
imageViews.get(i).setVisible(true);
|
imageViews.get(i).setVisible(true);
|
||||||
}
|
}
|
||||||
//Update empty text fields if player left.
|
//Update empty text fields if player left.
|
||||||
@@ -122,6 +127,11 @@ public class LobbyController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void customize() {
|
||||||
|
System.out.println(playerID);
|
||||||
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void leaveLobbyButtonPressed() {
|
public void leaveLobbyButtonPressed() {
|
||||||
// TODO: 10/07/17 wmu16 - Finish function!
|
// TODO: 10/07/17 wmu16 - Finish function!
|
||||||
@@ -154,6 +164,10 @@ public class LobbyController {
|
|||||||
Platform.runLater(this::updatePlayers);
|
Platform.runLater(this::updatePlayers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setPlayerID(Integer id) {
|
||||||
|
playerID = id;
|
||||||
|
}
|
||||||
|
|
||||||
public void disableReadyButton () {
|
public void disableReadyButton () {
|
||||||
readyButton.setDisable(true);
|
readyButton.setDisable(true);
|
||||||
readyButton.setVisible(false);
|
readyButton.setVisible(false);
|
||||||
|
|||||||
@@ -36,13 +36,15 @@
|
|||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<Button fx:id="readyButton" focusTraversable="false" mnemonicParsing="false" onAction="#readyButtonPressed" prefWidth="101.0" text="Ready" GridPane.halignment="CENTER" />
|
<Button fx:id="readyButton" focusTraversable="false" mnemonicParsing="false" onAction="#readyButtonPressed" prefWidth="101.0" text="Ready" GridPane.halignment="CENTER" />
|
||||||
<Button focusTraversable="false" mnemonicParsing="false" onAction="#leaveLobbyButtonPressed" text="Leave Lobby" GridPane.columnIndex="1" GridPane.halignment="CENTER" />
|
<Button focusTraversable="false" mnemonicParsing="false" onAction="#leaveLobbyButtonPressed" text="Leave Lobby" GridPane.columnIndex="2" GridPane.halignment="CENTER" />
|
||||||
|
<Button focusTraversable="false" mnemonicParsing="false" onAction="#customize" text="Customization" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.valignment="CENTER" />
|
||||||
</children>
|
</children>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
<GridPane GridPane.rowIndex="1">
|
<GridPane GridPane.rowIndex="1">
|
||||||
|
|||||||
Reference in New Issue
Block a user