mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cb4e47f71a | |||
| 5688e10e6f | |||
| 5cbd729214 | |||
| 705669ad07 | |||
| 71f6b9accb | |||
| caf04e1e99 | |||
| b9cb6fa5b4 | |||
| ba768deabc |
@@ -80,14 +80,12 @@ public class App extends Application {
|
|||||||
ViewManager.getInstance().initialiseSplashScreen(primaryStage);
|
ViewManager.getInstance().initialiseSplashScreen(primaryStage);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void runDiscoveryServer() throws Exception {
|
private static void runDiscoveryServer(){
|
||||||
while (true){
|
try{
|
||||||
try {
|
new DiscoveryServer();
|
||||||
new DiscoveryServer();
|
}
|
||||||
}
|
catch (Exception e){
|
||||||
catch (Exception ignored){
|
runDiscoveryServer();
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,13 +11,11 @@ import seng302.discoveryServer.util.ServerRepoStreamParser;
|
|||||||
import seng302.discoveryServer.util.ServerTable;
|
import seng302.discoveryServer.util.ServerTable;
|
||||||
import seng302.visualiser.ServerListener;
|
import seng302.visualiser.ServerListener;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.ServerSocket;
|
import java.net.ServerSocket;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.Timer;
|
|
||||||
|
|
||||||
public class DiscoveryServer {
|
public class DiscoveryServer {
|
||||||
public static final String ANSI_GREEN = "\u001B[32m";
|
public static final String ANSI_GREEN = "\u001B[32m";
|
||||||
@@ -29,7 +27,6 @@ public class DiscoveryServer {
|
|||||||
|
|
||||||
private ServerTable serverTable;
|
private ServerTable serverTable;
|
||||||
public static final Integer PORT_NUMBER = 9969;
|
public static final Integer PORT_NUMBER = 9969;
|
||||||
private ServerSocket serverSocket;
|
|
||||||
|
|
||||||
private final Logger logger = LoggerFactory.getLogger(DiscoveryServer.class);
|
private final Logger logger = LoggerFactory.getLogger(DiscoveryServer.class);
|
||||||
|
|
||||||
@@ -59,6 +56,8 @@ public class DiscoveryServer {
|
|||||||
displayHeader();
|
displayHeader();
|
||||||
serverTable = new ServerTable();
|
serverTable = new ServerTable();
|
||||||
|
|
||||||
|
ServerSocket serverSocket;
|
||||||
|
|
||||||
try{
|
try{
|
||||||
serverSocket = new ServerSocket(PORT_NUMBER);
|
serverSocket = new ServerSocket(PORT_NUMBER);
|
||||||
}
|
}
|
||||||
@@ -70,17 +69,12 @@ public class DiscoveryServer {
|
|||||||
|
|
||||||
logger.info("Started successfully - Now accepting connections");
|
logger.info("Started successfully - Now accepting connections");
|
||||||
|
|
||||||
try{
|
while (true){
|
||||||
while (true){
|
Socket clientSocket = serverSocket.accept();
|
||||||
Socket clientSocket = serverSocket.accept();
|
|
||||||
|
|
||||||
parseRequest(clientSocket);
|
parseRequest(clientSocket);
|
||||||
|
|
||||||
clientSocket.close();
|
clientSocket.close();
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e){
|
|
||||||
close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,18 +147,6 @@ public class DiscoveryServer {
|
|||||||
tries++;
|
tries++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (serverToJoin != null && serverToJoin.isMaxPlayersReached()){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return serverToJoin;
|
return serverToJoin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close(){
|
|
||||||
try {
|
|
||||||
serverSocket.close();
|
|
||||||
} catch (IOException ignored) {
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ public class MainServerThread implements Runnable, ClientConnectionDelegate {
|
|||||||
private boolean terminated;
|
private boolean terminated;
|
||||||
|
|
||||||
private Thread thread;
|
private Thread thread;
|
||||||
private boolean hasStarted = false;
|
|
||||||
|
|
||||||
private ServerSocket serverSocket = null;
|
private ServerSocket serverSocket = null;
|
||||||
private ArrayList<ServerToClientThread> serverToClientThreads = new ArrayList<>();
|
private ArrayList<ServerToClientThread> serverToClientThreads = new ArrayList<>();
|
||||||
@@ -99,8 +98,6 @@ public class MainServerThread implements Runnable, ClientConnectionDelegate {
|
|||||||
new HeartbeatThread(this);
|
new HeartbeatThread(this);
|
||||||
new ServerListenThread(serverSocket, this);
|
new ServerListenThread(serverSocket, this);
|
||||||
|
|
||||||
hasStarted = true;
|
|
||||||
|
|
||||||
//You should handle interrupts in some way, so that the thread won't keep on forever if you exit the app.
|
//You should handle interrupts in some way, so that the thread won't keep on forever if you exit the app.
|
||||||
while (!terminated) {
|
while (!terminated) {
|
||||||
if (GameState.getPlayerHasLeftFlag()) {
|
if (GameState.getPlayerHasLeftFlag()) {
|
||||||
@@ -149,10 +146,8 @@ public class MainServerThread implements Runnable, ClientConnectionDelegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
synchronized (this){
|
for (ServerToClientThread serverToClientThread : serverToClientThreads) {
|
||||||
for (ServerToClientThread serverToClientThread : serverToClientThreads) {
|
serverToClientThread.terminate();
|
||||||
serverToClientThread.terminate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
serverSocket.close();
|
serverSocket.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@@ -455,8 +450,4 @@ public class MainServerThread implements Runnable, ClientConnectionDelegate {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasStarted() {
|
|
||||||
return hasStarted;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import java.util.TimerTask;
|
|||||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.zip.CRC32;
|
import java.util.zip.CRC32;
|
||||||
import java.util.zip.Checksum;
|
import java.util.zip.Checksum;
|
||||||
import javafx.application.Platform;
|
|
||||||
import javafx.util.Pair;
|
import javafx.util.Pair;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -43,8 +42,6 @@ import seng302.visualiser.controllers.ViewManager;
|
|||||||
*/
|
*/
|
||||||
public class ClientToServerThread implements Runnable {
|
public class ClientToServerThread implements Runnable {
|
||||||
|
|
||||||
private boolean isStarted = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Functional interface for receiving packets from client socket.
|
* Functional interface for receiving packets from client socket.
|
||||||
*/
|
*/
|
||||||
@@ -91,7 +88,6 @@ public class ClientToServerThread implements Runnable {
|
|||||||
|
|
||||||
private ByteArrayOutputStream crcBuffer;
|
private ByteArrayOutputStream crcBuffer;
|
||||||
private boolean socketOpen = true;
|
private boolean socketOpen = true;
|
||||||
private boolean ignoreDC = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for ClientToServerThread which takes in ipAddress and portNumber and attempts to
|
* Constructor for ClientToServerThread which takes in ipAddress and portNumber and attempts to
|
||||||
@@ -121,8 +117,6 @@ public class ClientToServerThread implements Runnable {
|
|||||||
* variable is false.
|
* variable is false.
|
||||||
*/
|
*/
|
||||||
public void run() {
|
public void run() {
|
||||||
isStarted = true;
|
|
||||||
|
|
||||||
int sync1;
|
int sync1;
|
||||||
int sync2;
|
int sync2;
|
||||||
// TODO: 14/07/17 wmu16 - Work out how to fix this while loop
|
// TODO: 14/07/17 wmu16 - Work out how to fix this while loop
|
||||||
@@ -173,12 +167,8 @@ public class ClientToServerThread implements Runnable {
|
|||||||
notifyDisconnectListeners("Connection to server was terminated");
|
notifyDisconnectListeners("Connection to server was terminated");
|
||||||
closeSocket();
|
closeSocket();
|
||||||
|
|
||||||
Platform.runLater(() -> {
|
ViewManager.getInstance().goToStartView();
|
||||||
if (ignoreDC) {
|
ViewManager.getInstance().showErrorSnackBar("Server rejected connection.");
|
||||||
ViewManager.getInstance().showErrorSnackBar("Server rejected connection.");
|
|
||||||
ViewManager.getInstance().goToStartView();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendCustomizationRequest(CustomizeRequestType reqType, byte[] payload) {
|
public void sendCustomizationRequest(CustomizeRequestType reqType, byte[] payload) {
|
||||||
@@ -193,7 +183,7 @@ public class ClientToServerThread implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void notifyDisconnectListeners (String message) {
|
private void notifyDisconnectListeners (String message) {
|
||||||
if (socketOpen && !ignoreDC) {
|
if (socketOpen) {
|
||||||
for (DisconnectedFromHostListener listener : disconnectionListeners) {
|
for (DisconnectedFromHostListener listener : disconnectionListeners) {
|
||||||
listener.notifyDisconnection(message);
|
listener.notifyDisconnection(message);
|
||||||
}
|
}
|
||||||
@@ -204,6 +194,12 @@ public class ClientToServerThread implements Runnable {
|
|||||||
if (connectionErrorListener != null){
|
if (connectionErrorListener != null){
|
||||||
connectionErrorListener.notifyConnectionError(message);
|
connectionErrorListener.notifyConnectionError(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.socket.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.error("Couldn't close socket");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -394,9 +390,9 @@ public class ClientToServerThread implements Runnable {
|
|||||||
}
|
}
|
||||||
if (currentByte == -1) {
|
if (currentByte == -1) {
|
||||||
notifyDisconnectListeners("Cannot read from server.");
|
notifyDisconnectListeners("Cannot read from server.");
|
||||||
|
closeSocket();
|
||||||
logger.warn("InputStream reach end of stream", 1);
|
logger.warn("InputStream reach end of stream", 1);
|
||||||
handleConnectionError("Could not connect to server. Server is no longer available.");
|
handleConnectionError("Could not connect to server. Server is no longer available.");
|
||||||
closeSocket();
|
|
||||||
}
|
}
|
||||||
return currentByte;
|
return currentByte;
|
||||||
}
|
}
|
||||||
@@ -439,12 +435,4 @@ public class ClientToServerThread implements Runnable {
|
|||||||
).getBuffer()
|
).getBuffer()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasStarted() {
|
|
||||||
return isStarted;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ignoreDC() {
|
|
||||||
ignoreDC = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,12 @@ import seng302.visualiser.controllers.RaceViewController;
|
|||||||
import seng302.visualiser.controllers.ViewManager;
|
import seng302.visualiser.controllers.ViewManager;
|
||||||
import seng302.visualiser.controllers.dialogs.PopupDialogController;
|
import seng302.visualiser.controllers.dialogs.PopupDialogController;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.ZoneOffset;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is a client side instance of a yacht racing game in JavaFX. The game is instantiated
|
* This class is a client side instance of a yacht racing game in JavaFX. The game is instantiated
|
||||||
* with a JavaFX Pane to insert itself into.
|
* with a JavaFX Pane to insert itself into.
|
||||||
@@ -113,7 +119,7 @@ public class GameClient {
|
|||||||
|
|
||||||
getServerThread().setConnectionErrorListener((eMessage) -> {
|
getServerThread().setConnectionErrorListener((eMessage) -> {
|
||||||
ViewManager.getInstance().showErrorSnackBar(eMessage);
|
ViewManager.getInstance().showErrorSnackBar(eMessage);
|
||||||
//destroyClientToServerThread();
|
destroyClientToServerThread();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.lobbyController = ViewManager.getInstance().goToLobby(true);
|
this.lobbyController = ViewManager.getInstance().goToLobby(true);
|
||||||
@@ -141,45 +147,18 @@ public class GameClient {
|
|||||||
|
|
||||||
server = new MainServerThread();
|
server = new MainServerThread();
|
||||||
|
|
||||||
while (!server.hasStarted()){
|
|
||||||
try {
|
|
||||||
Thread.sleep(10);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
startClientToServerThread(ipAddress, 4942);
|
startClientToServerThread(ipAddress, 4942);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
showConnectionError("Cannot connect to server as host");
|
showConnectionError("Cannot connect to server as host");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for C2S thread
|
|
||||||
while (!socketThread.hasStarted()){
|
|
||||||
try {
|
|
||||||
Thread.sleep(10);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
socketThread.sendXML(race, serverName, numLegs, maxPlayers, tokensEnabled);
|
socketThread.sendXML(race, serverName, numLegs, maxPlayers, tokensEnabled);
|
||||||
|
while (regattaData == null){
|
||||||
int triesLeft = 15;
|
|
||||||
|
|
||||||
while (regattaData == null && triesLeft > 0){
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
triesLeft--;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (triesLeft <= 0){
|
|
||||||
showConnectionError("Could not launch server");
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.lobbyController = ViewManager.getInstance().goToLobby(false);
|
this.lobbyController = ViewManager.getInstance().goToLobby(false);
|
||||||
@@ -204,11 +183,7 @@ public class GameClient {
|
|||||||
controller.setContent(message);
|
controller.setContent(message);
|
||||||
controller.setOptionButtonText("GO HOME");
|
controller.setOptionButtonText("GO HOME");
|
||||||
controller
|
controller
|
||||||
.setOptionButtonEventHandler(event -> {
|
.setOptionButtonEventHandler(event -> ViewManager.getInstance().goToStartView());
|
||||||
System.out.println("inShowConnectionError");
|
|
||||||
ViewManager.getInstance().goToStartView();
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package seng302.visualiser;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -23,11 +24,7 @@ import javafx.scene.transform.Scale;
|
|||||||
import javafx.scene.transform.Translate;
|
import javafx.scene.transform.Translate;
|
||||||
import org.fxyz3d.scene.Skybox;
|
import org.fxyz3d.scene.Skybox;
|
||||||
import seng302.gameServer.messages.RoundingSide;
|
import seng302.gameServer.messages.RoundingSide;
|
||||||
import seng302.model.ClientYacht;
|
import seng302.model.*;
|
||||||
import seng302.model.GameKeyBind;
|
|
||||||
import seng302.model.KeyAction;
|
|
||||||
import seng302.model.Limit;
|
|
||||||
import seng302.model.ScaledPoint;
|
|
||||||
import seng302.model.mark.CompoundMark;
|
import seng302.model.mark.CompoundMark;
|
||||||
import seng302.model.mark.Corner;
|
import seng302.model.mark.Corner;
|
||||||
import seng302.model.mark.Mark;
|
import seng302.model.mark.Mark;
|
||||||
@@ -54,7 +51,7 @@ public class GameView3D extends GameView{
|
|||||||
|
|
||||||
private final double FOV = 60;
|
private final double FOV = 60;
|
||||||
private final double DEFAULT_CAMERA_X = 0;
|
private final double DEFAULT_CAMERA_X = 0;
|
||||||
private final double DEFAULT_CAMERA_Y = 160;
|
private final double DEFAULT_CAMERA_Y = 100;
|
||||||
|
|
||||||
private Group root3D;
|
private Group root3D;
|
||||||
private SubScene view;
|
private SubScene view;
|
||||||
@@ -167,7 +164,6 @@ public class GameView3D extends GameView{
|
|||||||
}
|
}
|
||||||
|
|
||||||
createMarkArrows();
|
createMarkArrows();
|
||||||
course.get(0).getMarks().forEach((mark -> markerObjects.get(mark).showNextExitArrow()));
|
|
||||||
|
|
||||||
//Scale race to markers if there is no border.
|
//Scale race to markers if there is no border.
|
||||||
if (borderPoints == null) {
|
if (borderPoints == null) {
|
||||||
@@ -509,7 +505,7 @@ public class GameView3D extends GameView{
|
|||||||
|
|
||||||
private void updateMarkArrows (ClientYacht yacht, int legNumber) {
|
private void updateMarkArrows (ClientYacht yacht, int legNumber) {
|
||||||
CompoundMark compoundMark;
|
CompoundMark compoundMark;
|
||||||
if (legNumber - 1 >= 0 && legNumber-1 < course.size()) {
|
if (legNumber - 1 >= 0) {
|
||||||
Sounds.playMarkRoundingSound();
|
Sounds.playMarkRoundingSound();
|
||||||
compoundMark = course.get(legNumber-1);
|
compoundMark = course.get(legNumber-1);
|
||||||
for (Mark mark : compoundMark.getMarks()) {
|
for (Mark mark : compoundMark.getMarks()) {
|
||||||
@@ -517,7 +513,7 @@ public class GameView3D extends GameView{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
CompoundMark nextMark = null;
|
CompoundMark nextMark = null;
|
||||||
if (legNumber < course.size()) {
|
if (legNumber < course.size() - 1) {
|
||||||
Sounds.playMarkRoundingSound();
|
Sounds.playMarkRoundingSound();
|
||||||
nextMark = course.get(legNumber);
|
nextMark = course.get(legNumber);
|
||||||
for (Mark mark : nextMark.getMarks()) {
|
for (Mark mark : nextMark.getMarks()) {
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ public class IsometricCamera extends PerspectiveCamera implements RaceCamera {
|
|||||||
private final Double MAX_Y = 170.0;
|
private final Double MAX_Y = 170.0;
|
||||||
|
|
||||||
private final Double PAN_LIMIT = 160.0;
|
private final Double PAN_LIMIT = 160.0;
|
||||||
private final Double NEAR_ZOOM_LIMIT = -30.0;
|
private final Double NEAR_ZOOM_LIMIT = -50.0;
|
||||||
private final Double FAR_ZOOM_LIMIT = -180.0;
|
private final Double FAR_ZOOM_LIMIT = -160.0;
|
||||||
|
|
||||||
private Double horizontalPan;
|
private Double horizontalPan;
|
||||||
private Double verticalPan;
|
private Double verticalPan;
|
||||||
@@ -29,8 +29,7 @@ public class IsometricCamera extends PerspectiveCamera implements RaceCamera {
|
|||||||
super(true);
|
super(true);
|
||||||
transforms = this.getTransforms();
|
transforms = this.getTransforms();
|
||||||
|
|
||||||
// zoomFactor = (FAR_ZOOM_LIMIT + NEAR_ZOOM_LIMIT) / 2.0;
|
zoomFactor = (FAR_ZOOM_LIMIT + NEAR_ZOOM_LIMIT) / 2.0;
|
||||||
zoomFactor = FAR_ZOOM_LIMIT;
|
|
||||||
horizontalPan = cameraStartX;
|
horizontalPan = cameraStartX;
|
||||||
verticalPan = cameraStartY;
|
verticalPan = cameraStartY;
|
||||||
|
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ import seng302.visualiser.fxObjects.assets_3D.BoatObject;
|
|||||||
|
|
||||||
public class TopDownCamera extends PerspectiveCamera implements RaceCamera {
|
public class TopDownCamera extends PerspectiveCamera implements RaceCamera {
|
||||||
|
|
||||||
private final Double PAN_LIMIT = 40d;
|
private final Double PAN_LIMIT = 30.0;
|
||||||
private final Double NEAR_ZOOM_LIMIT = -35d;
|
private final Double NEAR_ZOOM_LIMIT = -30.0;
|
||||||
private final Double FAR_ZOOM_LIMIT = -145d;
|
private final Double FAR_ZOOM_LIMIT = -130.0;
|
||||||
private final Double ZOOM_STEP = 2.5;
|
private final Double ZOOM_STEP = 2.5;
|
||||||
|
|
||||||
private ObservableList<Transform> transforms;
|
private ObservableList<Transform> transforms;
|
||||||
|
|||||||
@@ -2,17 +2,33 @@ 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 java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.collections.ListChangeListener;
|
import javafx.collections.ListChangeListener;
|
||||||
|
import javafx.event.EventHandler;
|
||||||
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.input.MouseEvent;
|
||||||
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;
|
||||||
@@ -27,13 +43,10 @@ import seng302.utilities.Sounds;
|
|||||||
import seng302.visualiser.MapPreview;
|
import seng302.visualiser.MapPreview;
|
||||||
import seng302.visualiser.controllers.cells.PlayerCell;
|
import seng302.visualiser.controllers.cells.PlayerCell;
|
||||||
import seng302.visualiser.controllers.dialogs.BoatCustomizeController;
|
import seng302.visualiser.controllers.dialogs.BoatCustomizeController;
|
||||||
|
import seng302.visualiser.controllers.dialogs.PopupDialogController;
|
||||||
import java.io.IOException;
|
import seng302.visualiser.controllers.dialogs.TokenInfoDialogController;
|
||||||
import java.net.URL;
|
import seng302.visualiser.fxObjects.assets_3D.ModelFactory;
|
||||||
import java.util.ArrayList;
|
import seng302.visualiser.fxObjects.assets_3D.ModelType;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.ResourceBundle;
|
|
||||||
|
|
||||||
public class LobbyController implements Initializable {
|
public class LobbyController implements Initializable {
|
||||||
|
|
||||||
@@ -57,10 +70,13 @@ 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;
|
||||||
private JFXDialog customizationDialog;
|
private JFXDialog customizationDialog;
|
||||||
|
private JFXDialog tokenInfoDialog;
|
||||||
public Color playersColor;
|
public Color playersColor;
|
||||||
private Map<Integer, ClientYacht> playerBoats;
|
private Map<Integer, ClientYacht> playerBoats;
|
||||||
private Double mapWidth = INITIAL_MAP_WIDTH, mapHeight = INITIAL_MAP_HEIGHT;
|
private Double mapWidth = INITIAL_MAP_WIDTH, mapHeight = INITIAL_MAP_HEIGHT;
|
||||||
@@ -128,6 +144,107 @@ public class LobbyController implements Initializable {
|
|||||||
beginRaceButton.setOnMouseEntered(e -> Sounds.playHoverSound());
|
beginRaceButton.setOnMouseEntered(e -> Sounds.playHoverSound());
|
||||||
|
|
||||||
initMapPreview();
|
initMapPreview();
|
||||||
|
initTokenPreviews();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialises the tokens in the side panel
|
||||||
|
*/
|
||||||
|
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();
|
||||||
|
|
||||||
|
HashMap<Pane, Group> tokenPanes = new HashMap<>();
|
||||||
|
tokenPanes.put(speedTokenPane, speedToken);
|
||||||
|
tokenPanes.put(handlingTokenPane, handlingToken);
|
||||||
|
tokenPanes.put(windWalkerTokenPane, windWalkerToken);
|
||||||
|
tokenPanes.put(bumperTokenPane, bumperToken);
|
||||||
|
tokenPanes.put(randomTokenPane, randomToken);
|
||||||
|
|
||||||
|
Scale hoverScale = new Scale(1.2, 1.2, 1.2);
|
||||||
|
|
||||||
|
tokenPanes.entrySet().forEach((entry) -> {
|
||||||
|
Pane thisPane = entry.getKey();
|
||||||
|
Group thisToken = entry.getValue();
|
||||||
|
|
||||||
|
thisToken.getTransforms().addAll(
|
||||||
|
new Translate(40, 50, 0),
|
||||||
|
new Scale(13, 13, 13));
|
||||||
|
|
||||||
|
thisPane.setOnMouseEntered(event -> {
|
||||||
|
thisToken.getTransforms().add(hoverScale);
|
||||||
|
});
|
||||||
|
thisPane.setOnMouseExited(event -> {
|
||||||
|
thisToken.getTransforms().remove(hoverScale);
|
||||||
|
});
|
||||||
|
thisPane.setOnMouseReleased(event -> {
|
||||||
|
tokenInfoDialog = makeTokenDialog(thisPane);
|
||||||
|
tokenInfoDialog.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
thisPane.getChildren().add(thisToken);
|
||||||
|
});
|
||||||
|
|
||||||
|
//Hacky rotations for wind and random to level it in the plane
|
||||||
|
windWalkerToken.getTransforms().addAll(
|
||||||
|
new Rotate(-70, new Point3D(1, 0, 0)),
|
||||||
|
new Translate(0, 2,0)
|
||||||
|
);
|
||||||
|
randomToken.getTransforms().addAll(
|
||||||
|
new Rotate(-90, new Point3D(1, 0, 0)),
|
||||||
|
new Translate(0, 0,1)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private JFXDialog makeTokenDialog(Pane inducingPane) {
|
||||||
|
String header = "...";
|
||||||
|
String body = "Nothing to see here";
|
||||||
|
ModelType modelType = ModelType.RANDOM_PICKUP;
|
||||||
|
|
||||||
|
if (inducingPane == speedTokenPane) {
|
||||||
|
header = "Speed Boost";
|
||||||
|
body = "Increases your max velocity";
|
||||||
|
modelType = ModelType.VELOCITY_PICKUP;
|
||||||
|
} else if (inducingPane == handlingTokenPane) {
|
||||||
|
header = "Handling Boost";
|
||||||
|
body = "Increases your turing rate";
|
||||||
|
modelType = ModelType.HANDLING_PICKUP;
|
||||||
|
} else if (inducingPane == windWalkerTokenPane) {
|
||||||
|
header = "Wind Walker";
|
||||||
|
body = "The wind now rotates with you, giving you your optimal speed in all directions";
|
||||||
|
modelType = ModelType.WIND_WALKER_PICKUP;
|
||||||
|
} else if (inducingPane == bumperTokenPane) {
|
||||||
|
header = "Bumper";
|
||||||
|
body = "While this is active, upon hitting another boat, you will power it down for a short time";
|
||||||
|
modelType = ModelType.BUMPER_PICKUP;
|
||||||
|
} else if (inducingPane == randomTokenPane) {
|
||||||
|
header = "Random";
|
||||||
|
body = "A 50% chance of becoming any other token and a 50% chance of slowing your boat for a time";
|
||||||
|
modelType = ModelType.RANDOM_PICKUP;
|
||||||
|
}
|
||||||
|
|
||||||
|
FXMLLoader dialog = new FXMLLoader(
|
||||||
|
getClass().getResource("/views/dialogs/TokenInfoDialog.fxml"));
|
||||||
|
|
||||||
|
JFXDialog tokenInfoDialog = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
tokenInfoDialog = new JFXDialog(serverListMainStackPane, dialog.load(),
|
||||||
|
JFXDialog.DialogTransition.CENTER);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
TokenInfoDialogController controller = dialog.getController();
|
||||||
|
controller.setParentController(this);
|
||||||
|
controller.setHeader(header);
|
||||||
|
controller.setContent(body);
|
||||||
|
controller.setToken(modelType);
|
||||||
|
return tokenInfoDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
private JFXDialog createCustomizeDialog() {
|
private JFXDialog createCustomizeDialog() {
|
||||||
@@ -225,7 +342,7 @@ public class LobbyController implements Initializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void leaveLobby() {
|
private void leaveLobby() {
|
||||||
System.out.println("LEFT LOBBY");
|
|
||||||
ViewManager.getInstance().getGameClient().stopGame();
|
ViewManager.getInstance().getGameClient().stopGame();
|
||||||
ViewManager.getInstance().goToStartView();
|
ViewManager.getInstance().goToStartView();
|
||||||
}
|
}
|
||||||
@@ -252,6 +369,10 @@ public class LobbyController implements Initializable {
|
|||||||
customizationDialog.close();
|
customizationDialog.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void closeTokenInfoDialog() {
|
||||||
|
tokenInfoDialog.close();
|
||||||
|
}
|
||||||
|
|
||||||
public void setRoomCode(String roomCode) {
|
public void setRoomCode(String roomCode) {
|
||||||
roomLabel.setText("Room: " + roomCode);
|
roomLabel.setText("Room: " + roomCode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -197,9 +197,7 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void showFinishDialog(ArrayList<ClientYacht> finishedBoats) {
|
public void showFinishDialog(ArrayList<ClientYacht> finishedBoats) {
|
||||||
System.out.println("called");
|
|
||||||
raceState.setRaceStarted(false);
|
raceState.setRaceStarted(false);
|
||||||
ViewManager.getInstance().getGameClient().getServerThread().ignoreDC();
|
|
||||||
createFinishDialog(finishedBoats);
|
createFinishDialog(finishedBoats);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ public class ViewManager {
|
|||||||
Stage stage = new Stage();
|
Stage stage = new Stage();
|
||||||
initialStartView(stage);
|
initialStartView(stage);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
logger.warn("Could not go to start view");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.jfoenix.controls.JFXButton;
|
|||||||
import com.jfoenix.controls.JFXListView;
|
import com.jfoenix.controls.JFXListView;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
@@ -25,10 +26,7 @@ public class FinishDialogController implements Initializable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL location, ResourceBundle resources) {
|
public void initialize(URL location, ResourceBundle resources) {
|
||||||
playAgain.setOnAction(event -> {
|
playAgain.setOnAction(event -> ViewManager.getInstance().goToStartView());
|
||||||
System.out.println("CALLED HERE");
|
|
||||||
ViewManager.getInstance().goToStartView();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFinishedBoats(ArrayList<ClientYacht> finishedBoats) {
|
public void setFinishedBoats(ArrayList<ClientYacht> finishedBoats) {
|
||||||
|
|||||||
@@ -119,12 +119,6 @@ public class ServerCreationController implements Initializable {
|
|||||||
.runAsHost("localhost", 4941, serverName.getText(), (int) maxPlayersSlider
|
.runAsHost("localhost", 4941, serverName.getText(), (int) maxPlayersSlider
|
||||||
.getValue(), mapMaker.getCurrentRacePath(), (int) legsSlider.getValue(), pickupsCheckBox.isSelected());
|
.getValue(), mapMaker.getCurrentRacePath(), (int) legsSlider.getValue(), pickupsCheckBox.isSelected());
|
||||||
|
|
||||||
if (serverDescription == null){
|
|
||||||
ViewManager.getInstance().getGameClient().getServerThread().closeSocket();
|
|
||||||
ViewManager.getInstance().getGameClient().stopGame();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ViewManager.getInstance().setProperty("serverName", serverDescription.getName());
|
ViewManager.getInstance().setProperty("serverName", serverDescription.getName());
|
||||||
ViewManager.getInstance().setProperty("mapName", serverDescription.getMapName());
|
ViewManager.getInstance().setProperty("mapName", serverDescription.getMapName());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package seng302.visualiser.controllers.dialogs;
|
||||||
|
|
||||||
|
import com.jfoenix.controls.JFXButton;
|
||||||
|
import com.jfoenix.controls.JFXTextArea;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
import javafx.event.EventHandler;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.fxml.Initializable;
|
||||||
|
import javafx.geometry.Point3D;
|
||||||
|
import javafx.scene.Group;
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.TextArea;
|
||||||
|
import javafx.scene.input.MouseEvent;
|
||||||
|
import javafx.scene.layout.Pane;
|
||||||
|
import javafx.scene.transform.Rotate;
|
||||||
|
import javafx.scene.transform.Scale;
|
||||||
|
import javafx.scene.transform.Translate;
|
||||||
|
import seng302.utilities.Sounds;
|
||||||
|
import seng302.visualiser.controllers.LobbyController;
|
||||||
|
import seng302.visualiser.fxObjects.assets_3D.ModelFactory;
|
||||||
|
import seng302.visualiser.fxObjects.assets_3D.ModelType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by wmu16 on 28/09/17.
|
||||||
|
*/
|
||||||
|
public class TokenInfoDialogController implements Initializable {
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private Label headerLabel;
|
||||||
|
@FXML
|
||||||
|
private TextArea contentText;
|
||||||
|
@FXML
|
||||||
|
private Pane tokenPane;
|
||||||
|
@FXML
|
||||||
|
private Button optionButton;
|
||||||
|
|
||||||
|
private LobbyController lobbyController;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize(URL location, ResourceBundle resources) {
|
||||||
|
optionButton.setOnMouseReleased(event -> {
|
||||||
|
Sounds.playButtonClick();
|
||||||
|
lobbyController.closeTokenInfoDialog();
|
||||||
|
});
|
||||||
|
|
||||||
|
contentText.setEditable(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setContent(String content) {
|
||||||
|
contentText.setText(content);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeader(String header) {
|
||||||
|
this.headerLabel.setText(header);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setToken(ModelType token) {
|
||||||
|
tokenPane.getChildren().clear();
|
||||||
|
|
||||||
|
Group tokenObject = ModelFactory.importModel(token).getAssets();
|
||||||
|
|
||||||
|
tokenObject.getTransforms().addAll(
|
||||||
|
new Translate(138 / 2, 138 / 2, 0),
|
||||||
|
new Scale(20, 20, 20));
|
||||||
|
|
||||||
|
if (token == ModelType.WIND_WALKER_PICKUP) {
|
||||||
|
tokenObject.getTransforms().addAll(
|
||||||
|
new Rotate(-70, new Point3D(1, 0, 0)),
|
||||||
|
new Translate(0, 2, 0)
|
||||||
|
);
|
||||||
|
} else if (token == ModelType.RANDOM_PICKUP) {
|
||||||
|
tokenObject.getTransforms().addAll(
|
||||||
|
new Rotate(-90, new Point3D(1, 0, 0)),
|
||||||
|
new Translate(0, 0, 1)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
tokenPane.getChildren().add(tokenObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentController(LobbyController lobbyController) {
|
||||||
|
this.lobbyController = lobbyController;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -13,7 +13,8 @@ public enum BoatMeshType {
|
|||||||
PIRATE_SHIP("pirateship_hull.stl", "pirateship_mast.stl", -0.5415, "pirateship_mainsail.stl",
|
PIRATE_SHIP("pirateship_hull.stl", "pirateship_mast.stl", -0.5415, "pirateship_mainsail.stl",
|
||||||
-0.5415, "pirateship_frontsail.stl", true, 1.2, 1.6, 1.2),
|
-0.5415, "pirateship_frontsail.stl", true, 1.2, 1.6, 1.2),
|
||||||
DUCKY("ducky_hull.stl", "ducky_mast.stl", -2.18539, "ducky_sail.stl", -2.18539, "ducky_eyes.stl", false, 1.2, 1.1, 1.4),
|
DUCKY("ducky_hull.stl", "ducky_mast.stl", -2.18539, "ducky_sail.stl", -2.18539, "ducky_eyes.stl", false, 1.2, 1.1, 1.4),
|
||||||
PARROT("parrot_hull.stl", null, 0, "parrot_sail.stl", 0, "parrot_features.stl", true, 1, 1, 1);
|
PARROT("parrot_hull.stl", null, 0, "parrot_sail.stl", 0, "parrot_features.stl", true, 1, 1, 1),
|
||||||
|
WAKA("waka_hull.stl", "waka_mast.stl", 0, "waka_sail.stl", 0, null, true, 1.7, 0.5, 1.5);
|
||||||
|
|
||||||
final String hullFile, mastFile, sailFile, jibFile;
|
final String hullFile, mastFile, sailFile, jibFile;
|
||||||
final double mastOffset, sailOffset;
|
final double mastOffset, sailOffset;
|
||||||
@@ -21,7 +22,7 @@ public enum BoatMeshType {
|
|||||||
public final double accelerationMultiplier;
|
public final double accelerationMultiplier;
|
||||||
public final double turnStep;
|
public final double turnStep;
|
||||||
final boolean fixedSail;
|
final boolean fixedSail;
|
||||||
final static BoatMeshType[] boatTypes = new BoatMeshType[]{DINGHY, CATAMARAN, PIRATE_SHIP, DUCKY, PARROT};
|
final static BoatMeshType[] boatTypes = new BoatMeshType[]{DINGHY, CATAMARAN, PIRATE_SHIP, DUCKY, PARROT, WAKA};
|
||||||
|
|
||||||
BoatMeshType(String hullFile, String mastFile, double mastOffset, String sailFile,
|
BoatMeshType(String hullFile, String mastFile, double mastOffset, String sailFile,
|
||||||
double sailOffset, String jibFile, boolean fixedSail, double maxSpeedMultiplier, double accelerationMultiplier, double turnStep) {
|
double sailOffset, String jibFile, boolean fixedSail, double maxSpeedMultiplier, double accelerationMultiplier, double turnStep) {
|
||||||
|
|||||||
@@ -80,30 +80,6 @@ public class ModelFactory {
|
|||||||
return bo;
|
return bo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BoatModel boatRotatingView(BoatMeshType boatType, Color primaryColour) {
|
|
||||||
Group boatAssets = getUnmodifiedBoatModel(boatType, primaryColour);
|
|
||||||
boatAssets.getTransforms().addAll(
|
|
||||||
new Scale(40, 40, 40),
|
|
||||||
new Rotate(90, new Point3D(0,0,1)),
|
|
||||||
new Rotate(90, new Point3D(0, 1, 0))
|
|
||||||
);
|
|
||||||
|
|
||||||
final Rotate animationRotate = new Rotate(0, new Point3D(1,1,1));
|
|
||||||
boatAssets.getTransforms().add(animationRotate);
|
|
||||||
|
|
||||||
return new BoatModel(boatAssets, new AnimationTimer() {
|
|
||||||
|
|
||||||
private double rotation = 0;
|
|
||||||
private Rotate rotate = animationRotate;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handle(long now) {
|
|
||||||
rotation += 0.5;
|
|
||||||
rotate.setAngle(rotation);
|
|
||||||
}
|
|
||||||
}, boatType);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BoatModel boatGameView(BoatMeshType boatType, Color primaryColour) {
|
public static BoatModel boatGameView(BoatMeshType boatType, Color primaryColour) {
|
||||||
Group boatAssets = getUnmodifiedBoatModel(boatType, primaryColour);
|
Group boatAssets = getUnmodifiedBoatModel(boatType, primaryColour);
|
||||||
boatAssets.getTransforms().setAll(
|
boatAssets.getTransforms().setAll(
|
||||||
|
|||||||
@@ -65,4 +65,12 @@
|
|||||||
/*-fx-background-repeat: no-repeat;*/
|
/*-fx-background-repeat: no-repeat;*/
|
||||||
/*-fx-background-size: cover;*/
|
/*-fx-background-size: cover;*/
|
||||||
-fx-background-color: dodgerblue;
|
-fx-background-color: dodgerblue;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tokenView {
|
||||||
|
-fx-cursor: hand;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tokenGridView StackPane {
|
||||||
|
-fx-background-color: white;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
.text-area {
|
||||||
|
-fx-background-insets: 0;
|
||||||
|
-fx-background-color: transparent, white, transparent, white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-area .content {
|
||||||
|
-fx-background-color: transparent, white, transparent, white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-area:focused .content {
|
||||||
|
-fx-background-color: transparent, white, transparent, white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-area:focused {
|
||||||
|
-fx-highlight-fill: #7ecfff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-area .content {
|
||||||
|
-fx-padding: 10px;
|
||||||
|
-fx-text-fill: gray;
|
||||||
|
-fx-highlight-fill: #7ecfff;
|
||||||
|
}
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
<Corner CompoundMarkID="1" Rounding="PS"/>
|
<Corner CompoundMarkID="1" Rounding="PS"/>
|
||||||
<Corner CompoundMarkID="2" Rounding="S"/>
|
<Corner CompoundMarkID="2" Rounding="S"/>
|
||||||
<Corner CompoundMarkID="3" Rounding="S"/>
|
<Corner CompoundMarkID="3" Rounding="S"/>
|
||||||
<Corner CompoundMarkID="4" Rounding="PS"/>
|
<Corner CompoundMarkID="4" Rounding="SP"/>
|
||||||
</OpeningSegment>
|
</OpeningSegment>
|
||||||
|
|
||||||
<RepeatingSegment>
|
<RepeatingSegment>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -1,5 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import java.net.*?>
|
||||||
|
<?import javafx.scene.*?>
|
||||||
|
<?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 +21,7 @@
|
|||||||
<?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,29 +80,148 @@
|
|||||||
</GridPane>
|
</GridPane>
|
||||||
<GridPane GridPane.rowIndex="1">
|
<GridPane GridPane.rowIndex="1">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="SOMETIMES" />
|
<ColumnConstraints hgrow="NEVER" maxWidth="-Infinity" minWidth="-Infinity"
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="400.0" minWidth="400.0" prefWidth="400.0" />
|
prefWidth="115.0"/>
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES" maxWidth="1.7976931348623157E308"
|
||||||
|
minWidth="337.0" prefWidth="430.0"/>
|
||||||
|
<ColumnConstraints hgrow="NEVER" maxWidth="350.0" minWidth="350.0"
|
||||||
|
prefWidth="350.0"/>
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<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" maxWidth="328.0" minWidth="328.0" prefWidth="328.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>
|
||||||
|
<padding>
|
||||||
|
<Insets right="5.0" />
|
||||||
|
</padding>
|
||||||
</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>
|
||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets bottom="15.0" left="15.0" right="7.0" top="15.0" />
|
<Insets bottom="15.0" left="7.0" right="7.0" top="15.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
|
<GridPane prefHeight="370.0" prefWidth="189.0" styleClass="tokenGridView"
|
||||||
|
vgap="5.0">
|
||||||
|
<children>
|
||||||
|
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Tokens"
|
||||||
|
GridPane.halignment="CENTER">
|
||||||
|
<font>
|
||||||
|
<Font name="System Bold" size="18.0"/>
|
||||||
|
</font>
|
||||||
|
</Text>
|
||||||
|
<StackPane prefHeight="150.0" prefWidth="200.0"
|
||||||
|
GridPane.rowIndex="1">
|
||||||
|
<children>
|
||||||
|
<Label alignment="BOTTOM_CENTER" text="Speed"
|
||||||
|
StackPane.alignment="BOTTOM_CENTER">
|
||||||
|
<font>
|
||||||
|
<Font size="12.0"/>
|
||||||
|
</font>
|
||||||
|
<padding>
|
||||||
|
<Insets bottom="5.0"/>
|
||||||
|
</padding>
|
||||||
|
</Label>
|
||||||
|
<Pane fx:id="speedTokenPane" prefHeight="999.0"
|
||||||
|
prefWidth="200.0" styleClass="tokenView"/>
|
||||||
|
</children>
|
||||||
|
</StackPane>
|
||||||
|
<StackPane prefHeight="150.0" prefWidth="200.0"
|
||||||
|
GridPane.rowIndex="2">
|
||||||
|
<children>
|
||||||
|
<Label alignment="BOTTOM_CENTER" text="Handling"
|
||||||
|
StackPane.alignment="BOTTOM_CENTER">
|
||||||
|
<font>
|
||||||
|
<Font size="12.0"/>
|
||||||
|
</font>
|
||||||
|
<padding>
|
||||||
|
<Insets bottom="5.0"/>
|
||||||
|
</padding>
|
||||||
|
</Label>
|
||||||
|
<Pane fx:id="handlingTokenPane" prefHeight="999.0"
|
||||||
|
prefWidth="200.0" styleClass="tokenView"/>
|
||||||
|
</children>
|
||||||
|
</StackPane>
|
||||||
|
<StackPane prefHeight="150.0" prefWidth="200.0"
|
||||||
|
GridPane.rowIndex="3">
|
||||||
|
<children>
|
||||||
|
<Label alignment="BOTTOM_CENTER" text="Wind Walker"
|
||||||
|
StackPane.alignment="BOTTOM_CENTER">
|
||||||
|
<font>
|
||||||
|
<Font size="12.0"/>
|
||||||
|
</font>
|
||||||
|
<padding>
|
||||||
|
<Insets bottom="5.0"/>
|
||||||
|
</padding>
|
||||||
|
</Label>
|
||||||
|
<Pane fx:id="windWalkerTokenPane" prefHeight="999.0"
|
||||||
|
prefWidth="200.0" styleClass="tokenView"/>
|
||||||
|
</children>
|
||||||
|
</StackPane>
|
||||||
|
<StackPane prefHeight="150.0" prefWidth="200.0"
|
||||||
|
GridPane.rowIndex="4">
|
||||||
|
<children>
|
||||||
|
<Label alignment="BOTTOM_CENTER" text="Bumper"
|
||||||
|
StackPane.alignment="BOTTOM_CENTER">
|
||||||
|
<font>
|
||||||
|
<Font size="12.0"/>
|
||||||
|
</font>
|
||||||
|
<padding>
|
||||||
|
<Insets bottom="5.0"/>
|
||||||
|
</padding>
|
||||||
|
</Label>
|
||||||
|
<Pane fx:id="bumperTokenPane" prefHeight="999.0"
|
||||||
|
prefWidth="200.0" styleClass="tokenView"/>
|
||||||
|
</children>
|
||||||
|
</StackPane>
|
||||||
|
<StackPane prefHeight="150.0" prefWidth="200.0"
|
||||||
|
GridPane.rowIndex="5">
|
||||||
|
<children>
|
||||||
|
<Label alignment="BOTTOM_CENTER" text="Random"
|
||||||
|
StackPane.alignment="BOTTOM_CENTER">
|
||||||
|
<font>
|
||||||
|
<Font size="12.0"/>
|
||||||
|
</font>
|
||||||
|
<padding>
|
||||||
|
<Insets bottom="5.0"/>
|
||||||
|
</padding>
|
||||||
|
</Label>
|
||||||
|
<Pane fx:id="randomTokenPane" prefHeight="999.0"
|
||||||
|
prefWidth="60.0" styleClass="tokenView"/>
|
||||||
|
</children>
|
||||||
|
</StackPane>
|
||||||
|
</children>
|
||||||
|
<columnConstraints>
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES" maxWidth="80.0" minWidth="80.0"
|
||||||
|
prefWidth="80.0"/>
|
||||||
|
</columnConstraints>
|
||||||
|
<padding>
|
||||||
|
<Insets bottom="15.0" left="15.0" right="7.0" top="15.0"/>
|
||||||
|
</padding>
|
||||||
|
<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>
|
||||||
|
</GridPane>
|
||||||
</children>
|
</children>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
</children>
|
</children>
|
||||||
@@ -106,10 +233,10 @@
|
|||||||
<RowConstraints maxHeight="1.7976931348623157E308" minHeight="400.0" prefHeight="400.0" vgrow="SOMETIMES" />
|
<RowConstraints maxHeight="1.7976931348623157E308" minHeight="400.0" prefHeight="400.0" vgrow="SOMETIMES" />
|
||||||
<RowConstraints maxHeight="80.0" minHeight="80.0" prefHeight="80.0" vgrow="SOMETIMES" />
|
<RowConstraints maxHeight="80.0" minHeight="80.0" prefHeight="80.0" vgrow="SOMETIMES" />
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<stylesheets>
|
|
||||||
<String fx:value="/css/Master.css" />
|
|
||||||
<String fx:value="/css/LobbyView.css" />
|
|
||||||
</stylesheets>
|
|
||||||
</GridPane>
|
</GridPane>
|
||||||
</children>
|
</children>
|
||||||
|
<stylesheets>
|
||||||
|
<URL value="@../css/Master.css"/>
|
||||||
|
<URL value="@../css/LobbyView.css"/>
|
||||||
|
</stylesheets>
|
||||||
</StackPane>
|
</StackPane>
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import java.lang.*?>
|
||||||
|
<?import javafx.geometry.*?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
<?import java.lang.String?>
|
<?import java.lang.String?>
|
||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
@@ -8,33 +12,30 @@
|
|||||||
<?import javafx.scene.layout.Pane?>
|
<?import javafx.scene.layout.Pane?>
|
||||||
<?import javafx.scene.layout.RowConstraints?>
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
<?import javafx.scene.layout.VBox?>
|
<?import javafx.scene.layout.VBox?>
|
||||||
<VBox fx:id="playerCellVBox" maxHeight="-Infinity" maxWidth="1.7976931348623157E308"
|
|
||||||
minHeight="-Infinity" minWidth="-Infinity" prefHeight="80.0"
|
<VBox fx:id="playerCellVBox" maxHeight="-Infinity" maxWidth="340.0" minHeight="-Infinity" minWidth="340.0" prefHeight="80.0" prefWidth="340.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
|
||||||
xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1">
|
|
||||||
<stylesheets>
|
<stylesheets>
|
||||||
<String fx:value="/css/Master.css"/>
|
<String fx:value="/css/Master.css" />
|
||||||
<String fx:value="/css/cells/PlayerCell.css"/>
|
<String fx:value="/css/cells/PlayerCell.css" />
|
||||||
</stylesheets>
|
</stylesheets>
|
||||||
<children>
|
<children>
|
||||||
<GridPane fx:id="playerListCell" maxHeight="-Infinity" maxWidth="1.7976931348623157E308"
|
<GridPane fx:id="playerListCell" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" prefHeight="70.0">
|
||||||
minHeight="-Infinity" prefHeight="70.0">
|
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="80.0" minWidth="80.0" prefWidth="80.0"/>
|
<ColumnConstraints hgrow="SOMETIMES" maxWidth="80.0" minWidth="80.0" prefWidth="80.0" />
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="290.0" minWidth="290.0"
|
<ColumnConstraints hgrow="SOMETIMES" maxWidth="260.0" minWidth="260.0" prefWidth="260.0" />
|
||||||
prefWidth="290.0"/>
|
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints maxHeight="80.0" minHeight="80.0" prefHeight="80.0" vgrow="SOMETIMES"/>
|
<RowConstraints maxHeight="80.0" minHeight="80.0" prefHeight="80.0" vgrow="SOMETIMES" />
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<Label fx:id="playerName" text="Party parrots in space" GridPane.columnIndex="1">
|
<Label fx:id="playerName" text="Party parrots in space" GridPane.columnIndex="1">
|
||||||
<padding>
|
<padding>
|
||||||
<Insets left="20.0" />
|
<Insets left="20.0" />
|
||||||
</padding></Label>
|
</padding></Label>
|
||||||
<Pane fx:id="boatPane" prefHeight="200.0" prefWidth="200.0"/>
|
<Pane fx:id="boatPane" prefHeight="200.0" prefWidth="200.0" />
|
||||||
</children>
|
</children>
|
||||||
<VBox.margin>
|
<VBox.margin>
|
||||||
<Insets right="40.0"/>
|
<Insets right="40.0" />
|
||||||
</VBox.margin>
|
</VBox.margin>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
</children>
|
</children>
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import com.jfoenix.controls.*?>
|
||||||
|
<?import java.lang.*?>
|
||||||
|
<?import java.net.*?>
|
||||||
|
<?import javafx.geometry.*?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
<?import com.jfoenix.controls.JFXButton?>
|
<?import com.jfoenix.controls.JFXButton?>
|
||||||
<?import com.jfoenix.controls.JFXDialogLayout?>
|
<?import com.jfoenix.controls.JFXDialogLayout?>
|
||||||
<?import java.net.URL?>
|
<?import java.net.URL?>
|
||||||
@@ -9,6 +14,7 @@
|
|||||||
<?import javafx.scene.layout.ColumnConstraints?>
|
<?import javafx.scene.layout.ColumnConstraints?>
|
||||||
<?import javafx.scene.layout.GridPane?>
|
<?import javafx.scene.layout.GridPane?>
|
||||||
<?import javafx.scene.layout.RowConstraints?>
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
|
|
||||||
<JFXDialogLayout maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity"
|
<JFXDialogLayout maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity"
|
||||||
minWidth="-Infinity" prefWidth="550.0" xmlns="http://javafx.com/javafx/8"
|
minWidth="-Infinity" prefWidth="550.0" xmlns="http://javafx.com/javafx/8"
|
||||||
xmlns:fx="http://javafx.com/fxml/1"
|
xmlns:fx="http://javafx.com/fxml/1"
|
||||||
|
|||||||
Reference in New Issue
Block a user