Changed the competitors list view to eight individual list view.
Added eight individual image view to support future player icon implementation. #story[1055]
@@ -15,11 +15,13 @@ import javafx.collections.ObservableList;
|
|||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
import javafx.scene.control.ListView;
|
import javafx.scene.image.Image;
|
||||||
|
import javafx.scene.image.ImageView;
|
||||||
import javafx.scene.layout.AnchorPane;
|
import javafx.scene.layout.AnchorPane;
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.Pane;
|
||||||
import javafx.scene.text.Text;
|
import javafx.scene.text.Text;
|
||||||
|
import seng302.client.ClientState;
|
||||||
import seng302.client.ClientStateQueryingRunnable;
|
import seng302.client.ClientStateQueryingRunnable;
|
||||||
import seng302.gameServer.GameStages;
|
import seng302.gameServer.GameStages;
|
||||||
import seng302.gameServer.GameState;
|
import seng302.gameServer.GameState;
|
||||||
@@ -30,12 +32,28 @@ import seng302.gameServer.GameState;
|
|||||||
*/
|
*/
|
||||||
public class LobbyController implements Initializable, Observer{
|
public class LobbyController implements Initializable, Observer{
|
||||||
|
|
||||||
@FXML
|
// @FXML
|
||||||
private ListView competitorsListView;
|
// private ListView competitorsListView;
|
||||||
@FXML
|
@FXML
|
||||||
private GridPane lobbyScreen;
|
private GridPane lobbyScreen;
|
||||||
@FXML
|
@FXML
|
||||||
private Text lobbyIpText;
|
private Text lobbyIpText;
|
||||||
|
@FXML
|
||||||
|
private ImageView firstImageView;
|
||||||
|
@FXML
|
||||||
|
private ImageView secondImageView;
|
||||||
|
@FXML
|
||||||
|
private ImageView thirdImageView;
|
||||||
|
@FXML
|
||||||
|
private ImageView fourthImageView;
|
||||||
|
@FXML
|
||||||
|
private ImageView fifthImageView;
|
||||||
|
@FXML
|
||||||
|
private ImageView sixthImageView;
|
||||||
|
@FXML
|
||||||
|
private ImageView seventhImageView;
|
||||||
|
@FXML
|
||||||
|
private ImageView eighthImageView;
|
||||||
|
|
||||||
private static ObservableList competitors;
|
private static ObservableList competitors;
|
||||||
private ClientStateQueryingRunnable clientStateQueryingRunnable;
|
private ClientStateQueryingRunnable clientStateQueryingRunnable;
|
||||||
@@ -57,9 +75,14 @@ public class LobbyController implements Initializable, Observer{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL location, ResourceBundle resources) {
|
public void initialize(URL location, ResourceBundle resources) {
|
||||||
|
if (ClientState.isHost())
|
||||||
lobbyIpText.setText("Lobby Host IP: " + getLocalHostIp());
|
lobbyIpText.setText("Lobby Host IP: " + getLocalHostIp());
|
||||||
|
else
|
||||||
|
lobbyIpText.setText("Connected to IP: ");
|
||||||
|
initialiseImageView();
|
||||||
|
|
||||||
competitors = FXCollections.observableArrayList();
|
competitors = FXCollections.observableArrayList();
|
||||||
competitorsListView.setItems(competitors);
|
// competitorsListView.setItems(competitors);
|
||||||
|
|
||||||
// set up client state query thread, so that when it receives the race-started packet
|
// set up client state query thread, so that when it receives the race-started packet
|
||||||
// it can switch to the race view
|
// it can switch to the race view
|
||||||
@@ -81,6 +104,25 @@ public class LobbyController implements Initializable, Observer{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initialiseImageView() {
|
||||||
|
Image image1 = new Image(getClass().getResourceAsStream("/ParrotGif/alistair.gif"));
|
||||||
|
firstImageView.setImage(image1);
|
||||||
|
Image image2 = new Image(getClass().getResourceAsStream("/ParrotGif/calum.gif"));
|
||||||
|
secondImageView.setImage(image2);
|
||||||
|
Image image3 = new Image(getClass().getResourceAsStream("/ParrotGif/haoming.gif"));
|
||||||
|
thirdImageView.setImage(image3);
|
||||||
|
Image image4 = new Image(getClass().getResourceAsStream("/ParrotGif/kusal.gif"));
|
||||||
|
fourthImageView.setImage(image4);
|
||||||
|
Image image5 = new Image(getClass().getResourceAsStream("/ParrotGif/michael.gif"));
|
||||||
|
fifthImageView.setImage(image5);
|
||||||
|
Image image6 = new Image(getClass().getResourceAsStream("/ParrotGif/peter.gif"));
|
||||||
|
sixthImageView.setImage(image6);
|
||||||
|
Image image7 = new Image(getClass().getResourceAsStream("/ParrotGif/ryan.gif"));
|
||||||
|
seventhImageView.setImage(image7);
|
||||||
|
Image image8 = new Image(getClass().getResourceAsStream("/ParrotGif/will.gif"));
|
||||||
|
eighthImageView.setImage(image8);
|
||||||
|
}
|
||||||
|
|
||||||
private String getLocalHostIp() {
|
private String getLocalHostIp() {
|
||||||
String ipAddress = null;
|
String ipAddress = null;
|
||||||
try {
|
try {
|
||||||
@@ -117,6 +159,7 @@ public class LobbyController implements Initializable, Observer{
|
|||||||
setContentPane("/views/StartScreenView.fxml");
|
setContentPane("/views/StartScreenView.fxml");
|
||||||
GameState.setCurrentStage(GameStages.CANCELLED);
|
GameState.setCurrentStage(GameStages.CANCELLED);
|
||||||
// TODO: 20/07/17 wmu16 - Implement some way of terminating the game
|
// TODO: 20/07/17 wmu16 - Implement some way of terminating the game
|
||||||
|
ClientState.setHost(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ public class StartScreenController {
|
|||||||
ClientToServerThread clientToServerThread = new ClientToServerThread("localhost", 4950);
|
ClientToServerThread clientToServerThread = new ClientToServerThread("localhost", 4950);
|
||||||
controller.setClientToServerThread(clientToServerThread);
|
controller.setClientToServerThread(clientToServerThread);
|
||||||
clientToServerThread.start();
|
clientToServerThread.start();
|
||||||
|
ClientState.setHost(true);
|
||||||
// new GameServerThread("Fuck you");
|
// new GameServerThread("Fuck you");
|
||||||
// get the lobby controller so that we can pass the game server thread to it
|
// get the lobby controller so that we can pass the game server thread to it
|
||||||
setContentPane("/views/LobbyView.fxml");
|
setContentPane("/views/LobbyView.fxml");
|
||||||
@@ -92,6 +93,7 @@ public class StartScreenController {
|
|||||||
ClientToServerThread clientToServerThread = new ClientToServerThread(ipAddress, port);
|
ClientToServerThread clientToServerThread = new ClientToServerThread(ipAddress, port);
|
||||||
controller.setClientToServerThread(clientToServerThread);
|
controller.setClientToServerThread(clientToServerThread);
|
||||||
clientToServerThread.start();
|
clientToServerThread.start();
|
||||||
|
ClientState.setHost(false);
|
||||||
ClientState.setConnectedToHost(true);
|
ClientState.setConnectedToHost(true);
|
||||||
setContentPane("/views/LobbyView.fxml");
|
setContentPane("/views/LobbyView.fxml");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
|
After Width: | Height: | Size: 50 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 59 KiB |
@@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.scene.image.*?>
|
||||||
<?import javafx.geometry.*?>
|
<?import javafx.geometry.*?>
|
||||||
<?import java.lang.*?>
|
<?import java.lang.*?>
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.*?>
|
||||||
@@ -13,14 +14,14 @@
|
|||||||
<?import javafx.scene.layout.RowConstraints?>
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
<GridPane fx:id="lobbyScreen" nodeOrientation="LEFT_TO_RIGHT" prefHeight="533.0" prefWidth="802.0" style="-fx-background-color: #2C2c36;" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.controllers.LobbyController">
|
<GridPane fx:id="lobbyScreen" nodeOrientation="LEFT_TO_RIGHT" prefHeight="960.0" prefWidth="1530.0" style="-fx-background-color: #2C2c36;" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.controllers.LobbyController">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints maxHeight="171.0" minHeight="0.0" prefHeight="31.0" vgrow="SOMETIMES" />
|
<RowConstraints maxHeight="171.0" minHeight="0.0" prefHeight="31.0" vgrow="SOMETIMES" />
|
||||||
<RowConstraints maxHeight="399.0" minHeight="10.0" prefHeight="394.0" vgrow="SOMETIMES" />
|
<RowConstraints maxHeight="462.0" minHeight="10.0" prefHeight="462.0" vgrow="SOMETIMES" />
|
||||||
<RowConstraints maxHeight="63.0" minHeight="10.0" prefHeight="26.0" vgrow="SOMETIMES" />
|
<RowConstraints maxHeight="100.0" minHeight="0.0" prefHeight="0.0" vgrow="SOMETIMES" />
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<Text fx:id="lobbyIpText" fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text="Lobby: IP" GridPane.columnSpan="2147483647" GridPane.halignment="CENTER">
|
<Text fx:id="lobbyIpText" fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text="Lobby: IP" GridPane.columnSpan="2147483647" GridPane.halignment="CENTER">
|
||||||
@@ -28,7 +29,7 @@
|
|||||||
<Font size="29.0" />
|
<Font size="29.0" />
|
||||||
</font>
|
</font>
|
||||||
</Text>
|
</Text>
|
||||||
<GridPane GridPane.rowIndex="2">
|
<GridPane prefHeight="166.0" prefWidth="1530.0" GridPane.rowIndex="2">
|
||||||
<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" />
|
||||||
@@ -41,27 +42,96 @@
|
|||||||
<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="1" GridPane.halignment="CENTER" />
|
||||||
</children>
|
</children>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
<AnchorPane focusTraversable="true" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1">
|
<GridPane GridPane.rowIndex="1">
|
||||||
<children>
|
|
||||||
<GridPane layoutX="335.0" layoutY="146.0" prefHeight="399.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="261.0" minWidth="0.0" prefWidth="2.0" />
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="-Infinity" />
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="261.0" minWidth="0.0" prefWidth="2.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 maxHeight="125.0" minHeight="0.0" prefHeight="0.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
<RowConstraints maxHeight="266.0" minHeight="10.0" prefHeight="266.0" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<AnchorPane focusTraversable="true" prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="1">
|
<ListView prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1">
|
||||||
<children>
|
<GridPane.margin>
|
||||||
<ListView fx:id="competitorsListView" focusTraversable="false" layoutX="154.0" layoutY="59.0" prefHeight="266.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
<Insets bottom="10.0" left="40.0" right="40.0" top="10.0" />
|
||||||
</children>
|
</GridPane.margin>
|
||||||
</AnchorPane>
|
</ListView>
|
||||||
|
<ListView prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="2">
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="10.0" left="40.0" right="40.0" top="10.0" />
|
||||||
|
</GridPane.margin>
|
||||||
|
</ListView>
|
||||||
|
<ListView prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="3">
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="10.0" left="40.0" right="40.0" top="10.0" />
|
||||||
|
</GridPane.margin></ListView>
|
||||||
|
<ListView prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="4">
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="10.0" left="40.0" right="40.0" top="10.0" />
|
||||||
|
</GridPane.margin>
|
||||||
|
</ListView>
|
||||||
|
<ListView prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="4" GridPane.rowIndex="1">
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="10.0" left="40.0" right="40.0" top="10.0" />
|
||||||
|
</GridPane.margin></ListView>
|
||||||
|
<ListView prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="1">
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="10.0" left="40.0" right="40.0" top="10.0" />
|
||||||
|
</GridPane.margin></ListView>
|
||||||
|
<ListView prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="2" GridPane.rowIndex="1">
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="10.0" left="40.0" right="40.0" top="10.0" />
|
||||||
|
</GridPane.margin></ListView>
|
||||||
|
<ListView prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="3" GridPane.rowIndex="1">
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="10.0" left="40.0" right="40.0" top="10.0" />
|
||||||
|
</GridPane.margin></ListView>
|
||||||
|
<ImageView fx:id="firstImageView" fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.valignment="BOTTOM">
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="10.0" />
|
||||||
|
</GridPane.margin>
|
||||||
|
</ImageView>
|
||||||
|
<ImageView fx:id="secondImageView" fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="2" GridPane.halignment="CENTER" GridPane.valignment="BOTTOM">
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="10.0" />
|
||||||
|
</GridPane.margin>
|
||||||
|
</ImageView>
|
||||||
|
<ImageView fx:id="thirdImageView" fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="3" GridPane.halignment="CENTER" GridPane.valignment="BOTTOM">
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="10.0" />
|
||||||
|
</GridPane.margin>
|
||||||
|
</ImageView>
|
||||||
|
<ImageView fx:id="fourthImageView" fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="4" GridPane.halignment="CENTER" GridPane.valignment="BOTTOM">
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="10.0" />
|
||||||
|
</GridPane.margin>
|
||||||
|
</ImageView>
|
||||||
|
<ImageView fx:id="fifthImageView" fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="BOTTOM">
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="10.0" />
|
||||||
|
</GridPane.margin>
|
||||||
|
</ImageView>
|
||||||
|
<ImageView fx:id="sixthImageView" fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="2" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="BOTTOM">
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="10.0" />
|
||||||
|
</GridPane.margin>
|
||||||
|
</ImageView>
|
||||||
|
<ImageView fx:id="seventhImageView" fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="3" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="BOTTOM">
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="10.0" />
|
||||||
|
</GridPane.margin>
|
||||||
|
</ImageView>
|
||||||
|
<ImageView fx:id="eighthImageView" fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="4" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="BOTTOM">
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="10.0" />
|
||||||
|
</GridPane.margin>
|
||||||
|
</ImageView>
|
||||||
</children>
|
</children>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
</children></AnchorPane>
|
|
||||||
</children>
|
</children>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
|
|||||||