mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Initial commit for The Token info panel in the lobby controller
- Having some mad issues with front end formatting with JFX. - Icons are put in boxes #story[1293]
This commit is contained in:
@@ -2,17 +2,25 @@ package seng302.visualiser.controllers;
|
|||||||
|
|
||||||
import com.jfoenix.controls.JFXButton;
|
import com.jfoenix.controls.JFXButton;
|
||||||
import com.jfoenix.controls.JFXDialog;
|
import com.jfoenix.controls.JFXDialog;
|
||||||
|
import com.jfoenix.controls.JFXTextArea;
|
||||||
|
import java.util.Arrays;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.collections.ListChangeListener;
|
import javafx.collections.ListChangeListener;
|
||||||
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.geometry.Point3D;
|
||||||
|
import javafx.scene.Group;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.ScrollPane;
|
import javafx.scene.control.ScrollPane;
|
||||||
import javafx.scene.layout.AnchorPane;
|
import javafx.scene.layout.AnchorPane;
|
||||||
|
import javafx.scene.layout.Pane;
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
|
import javafx.scene.transform.Rotate;
|
||||||
|
import javafx.scene.transform.Scale;
|
||||||
|
import javafx.scene.transform.Translate;
|
||||||
import seng302.discoveryServer.DiscoveryServerClient;
|
import seng302.discoveryServer.DiscoveryServerClient;
|
||||||
import seng302.gameServer.GameStages;
|
import seng302.gameServer.GameStages;
|
||||||
import seng302.gameServer.GameState;
|
import seng302.gameServer.GameState;
|
||||||
@@ -34,6 +42,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
import seng302.visualiser.fxObjects.assets_3D.ModelFactory;
|
||||||
|
import seng302.visualiser.fxObjects.assets_3D.ModelType;
|
||||||
|
|
||||||
public class LobbyController implements Initializable {
|
public class LobbyController implements Initializable {
|
||||||
|
|
||||||
@@ -57,6 +67,8 @@ public class LobbyController implements Initializable {
|
|||||||
private AnchorPane serverMap;
|
private AnchorPane serverMap;
|
||||||
@FXML
|
@FXML
|
||||||
private Label roomLabel;
|
private Label roomLabel;
|
||||||
|
@FXML
|
||||||
|
private Pane speedTokenPane, handlingTokenPane, windWalkerTokenPane, bumperTokenPane, randomTokenPane;
|
||||||
//---------FXML END---------//
|
//---------FXML END---------//
|
||||||
|
|
||||||
private RaceState raceState;
|
private RaceState raceState;
|
||||||
@@ -128,6 +140,35 @@ public class LobbyController implements Initializable {
|
|||||||
beginRaceButton.setOnMouseEntered(e -> Sounds.playHoverSound());
|
beginRaceButton.setOnMouseEntered(e -> Sounds.playHoverSound());
|
||||||
|
|
||||||
initMapPreview();
|
initMapPreview();
|
||||||
|
|
||||||
|
initTokenPreviews();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initTokenPreviews() {
|
||||||
|
Group speedToken = ModelFactory.importModel(ModelType.VELOCITY_PICKUP).getAssets();
|
||||||
|
Group handlingToken = ModelFactory.importModel(ModelType.HANDLING_PICKUP).getAssets();
|
||||||
|
Group windWalkerToken = ModelFactory.importModel(ModelType.WIND_WALKER_PICKUP).getAssets();
|
||||||
|
Group bumperToken = ModelFactory.importModel(ModelType.BUMPER_PICKUP).getAssets();
|
||||||
|
Group randomToken = ModelFactory.importModel(ModelType.RANDOM_PICKUP).getAssets();
|
||||||
|
List<Group> tokensPreviews = new ArrayList<>(
|
||||||
|
Arrays.asList(speedToken, handlingToken, windWalkerToken, bumperToken, randomToken));
|
||||||
|
|
||||||
|
tokensPreviews.forEach((tokenPreview) -> {
|
||||||
|
tokenPreview.getTransforms().addAll(
|
||||||
|
new Translate(30, 30, 0),
|
||||||
|
new Scale(15, 15, 15));
|
||||||
|
});
|
||||||
|
|
||||||
|
//Hacky rotations for wind and random to level it in the plane
|
||||||
|
windWalkerToken.getTransforms().add(new Rotate(-70, new Point3D(1, 0, 0)));
|
||||||
|
randomToken.getTransforms().add(new Rotate(-90, new Point3D(1, 0, 0)));
|
||||||
|
|
||||||
|
speedTokenPane.getChildren().add(speedToken);
|
||||||
|
handlingTokenPane.getChildren().add(handlingToken);
|
||||||
|
windWalkerTokenPane.getChildren().add(windWalkerToken);
|
||||||
|
bumperTokenPane.getChildren().add(bumperToken);
|
||||||
|
randomTokenPane.getChildren().add(randomToken);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private JFXDialog createCustomizeDialog() {
|
private JFXDialog createCustomizeDialog() {
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import com.jfoenix.controls.*?>
|
||||||
|
<?import java.lang.*?>
|
||||||
|
<?import javafx.geometry.*?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
<?import javafx.scene.text.*?>
|
||||||
<?import com.jfoenix.controls.JFXButton?>
|
<?import com.jfoenix.controls.JFXButton?>
|
||||||
<?import java.lang.String?>
|
<?import java.lang.String?>
|
||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
@@ -13,7 +19,10 @@
|
|||||||
<?import javafx.scene.layout.VBox?>
|
<?import javafx.scene.layout.VBox?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
<StackPane fx:id="serverListMainStackPane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.visualiser.controllers.LobbyController">
|
<StackPane fx:id="serverListMainStackPane" maxHeight="1.7976931348623157E308"
|
||||||
|
maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity"
|
||||||
|
xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
|
||||||
|
fx:controller="seng302.visualiser.controllers.LobbyController">
|
||||||
<children>
|
<children>
|
||||||
<GridPane fx:id="serverListMainGridPane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308">
|
<GridPane fx:id="serverListMainGridPane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308">
|
||||||
<children>
|
<children>
|
||||||
@@ -72,6 +81,7 @@
|
|||||||
</GridPane>
|
</GridPane>
|
||||||
<GridPane GridPane.rowIndex="1">
|
<GridPane GridPane.rowIndex="1">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"/>
|
||||||
<ColumnConstraints hgrow="SOMETIMES" />
|
<ColumnConstraints hgrow="SOMETIMES" />
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="400.0" minWidth="400.0" prefWidth="400.0" />
|
<ColumnConstraints hgrow="SOMETIMES" maxWidth="400.0" minWidth="400.0" prefWidth="400.0" />
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
@@ -79,15 +89,19 @@
|
|||||||
<RowConstraints vgrow="SOMETIMES" />
|
<RowConstraints vgrow="SOMETIMES" />
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<ScrollPane fx:id="playerListScrollPane" hbarPolicy="NEVER" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
|
<ScrollPane fx:id="playerListScrollPane" hbarPolicy="NEVER"
|
||||||
|
GridPane.columnIndex="2" GridPane.halignment="CENTER"
|
||||||
|
GridPane.valignment="CENTER">
|
||||||
<content>
|
<content>
|
||||||
<VBox fx:id="playerListVBox" prefHeight="200.0" prefWidth="100.0" />
|
<VBox fx:id="playerListVBox" alignment="TOP_RIGHT"
|
||||||
|
prefHeight="200.0" prefWidth="100.0"/>
|
||||||
</content>
|
</content>
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets bottom="15.0" left="7.0" right="15.0" top="15.0" />
|
<Insets bottom="15.0" left="7.0" right="15.0" top="15.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
</ScrollPane>
|
</ScrollPane>
|
||||||
<AnchorPane fx:id="serverMap" style="-fx-background-color: skyblue;">
|
<AnchorPane fx:id="serverMap" style="-fx-background-color: skyblue;"
|
||||||
|
GridPane.columnIndex="1">
|
||||||
<opaqueInsets>
|
<opaqueInsets>
|
||||||
<Insets />
|
<Insets />
|
||||||
</opaqueInsets>
|
</opaqueInsets>
|
||||||
@@ -95,6 +109,62 @@
|
|||||||
<Insets bottom="15.0" left="15.0" right="7.0" top="15.0" />
|
<Insets bottom="15.0" left="15.0" right="7.0" top="15.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
|
<AnchorPane>
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0"/>
|
||||||
|
</GridPane.margin>
|
||||||
|
<children>
|
||||||
|
<GridPane prefHeight="370.0" prefWidth="259.0"
|
||||||
|
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
|
||||||
|
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
|
<columnConstraints>
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES" maxWidth="123.0"
|
||||||
|
minWidth="-Infinity" prefWidth="60.0"/>
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES" maxWidth="175.0"
|
||||||
|
minWidth="-Infinity" prefWidth="170.0"/>
|
||||||
|
</columnConstraints>
|
||||||
|
<rowConstraints>
|
||||||
|
<RowConstraints maxHeight="116.0" minHeight="0.0"
|
||||||
|
prefHeight="40.0" vgrow="NEVER"/>
|
||||||
|
<RowConstraints maxHeight="285.0" minHeight="-Infinity"
|
||||||
|
prefHeight="60.0" vgrow="SOMETIMES"/>
|
||||||
|
<RowConstraints maxHeight="285.0" minHeight="-Infinity"
|
||||||
|
prefHeight="60.0" vgrow="SOMETIMES"/>
|
||||||
|
<RowConstraints maxHeight="141.0" minHeight="-Infinity"
|
||||||
|
prefHeight="60.0" vgrow="SOMETIMES"/>
|
||||||
|
<RowConstraints maxHeight="285.0" minHeight="-Infinity"
|
||||||
|
prefHeight="60.0" vgrow="SOMETIMES"/>
|
||||||
|
<RowConstraints maxHeight="285.0" minHeight="-Infinity"
|
||||||
|
prefHeight="60.0" vgrow="SOMETIMES"/>
|
||||||
|
</rowConstraints>
|
||||||
|
<children>
|
||||||
|
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Tokens"
|
||||||
|
GridPane.columnSpan="2147483647"
|
||||||
|
GridPane.halignment="CENTER"/>
|
||||||
|
<Pane fx:id="speedTokenPane" prefHeight="200.0"
|
||||||
|
prefWidth="200.0" GridPane.rowIndex="1"/>
|
||||||
|
<Pane fx:id="handlingTokenPane" prefHeight="200.0"
|
||||||
|
prefWidth="200.0" GridPane.rowIndex="2"/>
|
||||||
|
<Pane fx:id="windWalkerTokenPane" prefHeight="200.0"
|
||||||
|
prefWidth="200.0" GridPane.rowIndex="3"/>
|
||||||
|
<Pane fx:id="randomTokenPane" prefHeight="200.0"
|
||||||
|
prefWidth="200.0" GridPane.rowIndex="5"/>
|
||||||
|
<Pane fx:id="bumperTokenPane" prefHeight="200.0"
|
||||||
|
prefWidth="200.0" GridPane.rowIndex="4"/>
|
||||||
|
<Label text="Speed" GridPane.columnIndex="1"
|
||||||
|
GridPane.rowIndex="1"/>
|
||||||
|
<Label text="Handling" GridPane.columnIndex="1"
|
||||||
|
GridPane.rowIndex="2"/>
|
||||||
|
<Label text="Wind Walker" GridPane.columnIndex="1"
|
||||||
|
GridPane.rowIndex="3"/>
|
||||||
|
<Label text="Bumper" GridPane.columnIndex="1"
|
||||||
|
GridPane.rowIndex="4"/>
|
||||||
|
<Label text="Random" GridPane.columnIndex="1"
|
||||||
|
GridPane.rowIndex="5"/>
|
||||||
|
</children>
|
||||||
|
</GridPane>
|
||||||
|
</children>
|
||||||
|
</AnchorPane>
|
||||||
</children>
|
</children>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
</children>
|
</children>
|
||||||
|
|||||||
Reference in New Issue
Block a user