Merge remote-tracking branch 'origin/NewUI_merge' into story1266_3d_model_factory

# Conflicts:
#	src/main/java/seng302/visualiser/GameView3D.java
This commit is contained in:
Calum
2017-09-14 12:06:19 +12:00
33 changed files with 410 additions and 612 deletions
@@ -9,12 +9,12 @@ import java.util.Map;
import java.util.Random;
import java.util.Set;
import javafx.scene.paint.Color;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import seng302.gameServer.messages.*;
import seng302.model.*;
import seng302.gameServer.messages.BoatAction;
import seng302.gameServer.messages.BoatStatus;
import seng302.gameServer.messages.ChatterMessage;
@@ -38,10 +38,6 @@ import seng302.model.token.TokenType;
import seng302.utilities.GeoUtility;
import seng302.utilities.XMLParser;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.util.*;
/**
* A Static class to hold information about the current state of the game (model)
* Also contains logic for updating itself on regular time intervals on its own thread
@@ -77,6 +73,7 @@ public class GameState implements Runnable {
private static Double speedMultiplier = 1d;
private static Boolean customizationFlag; // dirty flag to tell if a player has customized their boat.
private static Boolean playerHasLeftFlag;
private static String hostIpAddress;
private static List<Player> players;
@@ -106,6 +103,7 @@ public class GameState implements Runnable {
players = new ArrayList<>();
GameState.hostIpAddress = hostIpAddress;
customizationFlag = false;
playerHasLeftFlag = false;
speedMultiplier = 1.0;
currentStage = GameStages.LOBBYING;
isRaceStarted = false;
@@ -839,8 +837,16 @@ public class GameState implements Runnable {
customizationFlag = false;
}
public static void setPlayerHasLeftFlag(Boolean flag) {
playerHasLeftFlag = flag;
}
public static Boolean getPlayerHasLeftFlag() {
return playerHasLeftFlag;
}
public static Integer getNumberOfPlayers(){
Integer numPlayers = 0;
Integer numPlayers = 1;
for(Player p : getPlayers()){
if(p.getSocket().isConnected()){
@@ -1,5 +1,15 @@
package seng302.gameServer;
import java.io.IOException;
import java.io.StringReader;
import java.net.ServerSocket;
import java.util.ArrayList;
import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
@@ -16,17 +26,6 @@ import seng302.utilities.GeoUtility;
import seng302.utilities.XMLGenerator;
import seng302.utilities.XMLParser;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.io.StringReader;
import java.net.ServerSocket;
import java.util.ArrayList;
import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;
/**
* A class describing the overall server, which creates and collects server threads for each client
* Created by wmu16 on 13/07/17.
@@ -115,6 +114,20 @@ public class MainServerThread implements Runnable, ClientConnectionDelegate {
//You should handle interrupts in some way, so that the thread won't keep on forever if you exit the app.
while (!terminated) {
if (GameState.getPlayerHasLeftFlag()) {
for (ServerToClientThread stc : serverToClientThreads) {
if (!stc.isSocketOpen()) {
GameState.getYachts().remove(stc.getSourceId());
sendSetupMessages();
try {
stc.getSocket().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
GameState.setPlayerHasLeftFlag(false);
}
try {
Thread.sleep(1000 / CLIENT_UPDATES_PER_SECOND);
} catch (InterruptedException e) {
@@ -183,21 +196,21 @@ public class MainServerThread implements Runnable, ClientConnectionDelegate {
if (Math.floorMod(random.nextInt(), 2) == 0){
direction += random.nextInt(4);
windSpeed += random.nextInt(20) + 50;
windSpeed += random.nextInt(20) + 459;
}
else{
direction -= random.nextInt(4);
windSpeed -= random.nextInt(20) + 50;
windSpeed -= random.nextInt(20) + 459;
}
direction = Math.floorMod(direction, 360);
if (windSpeed > MAX_WIND_SPEED){
windSpeed -= random.nextInt(1000);
windSpeed -= random.nextInt(500);
}
if (windSpeed <= MIN_WIND_SPEED){
windSpeed += random.nextInt(1000);
windSpeed += random.nextInt(500);
}
GameState.setWindSpeed(Double.valueOf(windSpeed));
@@ -95,6 +95,10 @@ public class ServerToClientThread implements Runnable {
thread.start();
}
public Integer getSourceId() {
return sourceId;
}
private void setUpPlayer(){
BufferedReader fn;
String fName = "";
@@ -219,9 +223,11 @@ public class ServerToClientThread implements Runnable {
}
} catch (Exception e) {
closeSocket();
GameState.setPlayerHasLeftFlag(true);
return;
}
}
GameState.setPlayerHasLeftFlag(true);
logger.warn("Closed serverToClientThread" + thread, 1);
}
@@ -253,6 +259,10 @@ public class ServerToClientThread implements Runnable {
}
}
public Boolean isSocketOpen() {
return !socket.isClosed();
}
private int readByte() throws Exception {
int currentByte = -1;
try {
+5 -1
View File
@@ -253,7 +253,7 @@ public class ClientYacht extends Observable {
public void updateLocation(double lat, double lng, double heading, double velocity) {
setLocation(lat, lng);
this.heading = heading;
// this.currentVelocity = velocity;
this.currentVelocity = velocity;
updateVelocityProperty(velocity);
for (YachtLocationListener yll : locationListeners) {
yll.notifyLocation(this, lat, lng, heading, sailIn, velocity);
@@ -284,4 +284,8 @@ public class ClientYacht extends Observable {
listener.notifyRounding(this, legNumber);
}
}
public Double getCurrentVelocity() {
return currentVelocity;
}
}
+5 -4
View File
@@ -26,7 +26,9 @@ public class Sounds {
}
}
public static void setMutes() {
static void setMutes() {
if (soundPlayer != null) {
soundPlayer.setMute(soundEffectsMuted);
}
@@ -49,14 +51,14 @@ public class Sounds {
toggleMuteMusic();
}
public static void toggleMuteMusic() {
static void toggleMuteMusic() {
musicMuted = !musicMuted;
if (musicPlayer != null) {
musicPlayer.setMute(musicMuted);
}
}
public static void toggleMuteEffects() {
static void toggleMuteEffects() {
soundEffectsMuted = !soundEffectsMuted;
if (soundPlayer != null) {
soundPlayer.setMute(soundEffectsMuted);
@@ -188,5 +190,4 @@ public class Sounds {
}
}
}
@@ -44,7 +44,6 @@ import seng302.utilities.XMLGenerator;
import seng302.utilities.XMLParser;
import seng302.visualiser.controllers.FinishScreenViewController;
import seng302.visualiser.controllers.LobbyController;
import seng302.visualiser.controllers.LobbyController_old;
import seng302.visualiser.controllers.RaceViewController;
import seng302.visualiser.controllers.ViewManager;
@@ -201,23 +200,6 @@ public class GameClient {
socketThread.addStreamObserver(this::parsePackets);
}
/**
* Loads a view of the lobby into the clients pane
*
* @return the lobby controller.
*/
private LobbyController_old loadLobby() {
FXMLLoader fxmlLoader = new FXMLLoader(
GameClient.class.getResource("/views/LobbyView.fxml"));
try {
holderPane.getChildren().clear();
holderPane.getChildren().add(fxmlLoader.load());
} catch (IOException e) {
e.printStackTrace();
}
return fxmlLoader.getController();
}
private void loadRaceView() {
FXMLLoader fxmlLoader = loadFXMLToHolder("/views/RaceView.fxml");
holderPane.getScene().setOnKeyPressed(this::keyPressed);
@@ -1,76 +0,0 @@
package seng302.visualiser.controllers;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.ColorPicker;
import javafx.scene.control.TextField;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import seng302.gameServer.messages.CustomizeRequestType;
import seng302.utilities.Sounds;
import seng302.visualiser.ClientToServerThread;
public class CustomizationController_old {
@FXML
private TextField nameField;
@FXML
private ColorPicker boatColorPicker;
@FXML
private Button customizeSubmit;
private LobbyController_old lc;
private ClientToServerThread socketThread;
private Stage windowStage;
public void initialize() {
}
public void setServerThread(ClientToServerThread ctsThread) {
this.socketThread = ctsThread;
}
@FXML
public void submitCustomization() {
Sounds.playButtonClick();
// System.out.println("Attempting to send");
socketThread.sendCustomizationRequest(CustomizeRequestType.NAME, nameField.getText().getBytes());
// TODO: 16/08/17 ajm412: Turn colors into byte array.
Color color = boatColorPicker.getValue();
short red = (short) (color.getRed() * 255);
short green = (short) (color.getGreen() * 255);
short blue = (short) (color.getBlue() * 255);
byte[] colorArray = new byte[3];
colorArray[0] = (byte) red;
colorArray[1] = (byte) green;
colorArray[2] = (byte) blue;
socketThread.sendCustomizationRequest(CustomizeRequestType.COLOR, colorArray);
lc.setPlayersColor(color);
windowStage.close();
}
public void setLobbyController(LobbyController_old lc) {
this.lc = lc;
}
public void setStage(Stage stage) {
this.windowStage = stage;
}
public void setPlayerName(String name) {
this.nameField.setText(name);
}
public void setPlayerColor(Color playerColor) {
this.boatColorPicker.setValue(playerColor);
}
}
@@ -31,6 +31,7 @@ import seng302.model.stream.xml.parser.RaceXMLData;
import seng302.utilities.Sounds;
import seng302.visualiser.GameView;
import seng302.visualiser.controllers.cells.PlayerCell;
import seng302.visualiser.controllers.dialogs.BoatCustomizeController;
public class LobbyController implements Initializable {
@@ -51,7 +52,6 @@ public class LobbyController implements Initializable {
private Pane serverMap;
//---------FXML END---------//
private List<LobbyController_old.LobbyCloseListener> lobbyListeners = new ArrayList<>();
private RaceState raceState;
private JFXDialog customizationDialog;
public Color playersColor;
@@ -93,8 +93,8 @@ public class LobbyController implements Initializable {
Integer playerId = ViewManager.getInstance().getGameClient().getServerThread().getClientId();
String name = ViewManager.getInstance().getGameClient().getPlayerNames().get(playerId - 1);
Color playerColor = Colors.getColor( playerId - 1);
customizationDialog = ViewManager.getInstance().loadCustomizationDialog(serverListMainStackPane, this, playerColor, name);
playersColor = Colors.getColor(playerId - 1);
customizationDialog = createCustomizeDialog();
customizeButton.setOnMouseReleased(event -> {
Sounds.playButtonClick();
@@ -109,6 +109,32 @@ public class LobbyController implements Initializable {
initMapPreview();
}
private JFXDialog createCustomizeDialog() {
// TODO: 12/09/17 ajm412: Why is this here? is there no better way we can do this? Ideally inside the LobbyController.
FXMLLoader dialog = new FXMLLoader(
getClass().getResource("/views/dialogs/BoatCustomizeDialog.fxml"));
JFXDialog customizationDialog = null;
try {
customizationDialog = new JFXDialog(serverListMainStackPane, dialog.load(),
JFXDialog.DialogTransition.CENTER);
} catch (IOException e) {
e.printStackTrace();
}
BoatCustomizeController controller = dialog.getController();
controller.setParentController(this);
controller.setPlayerColor(this.playersColor);
return customizationDialog;
}
/**
*
*/
private void refreshMapView(){
RaceXMLData raceData = ViewManager.getInstance().getGameClient().getCourseData();
List<Limit> border = raceData.getCourseLimit();
@@ -122,12 +148,8 @@ public class LobbyController implements Initializable {
gameView.updateCourse(marks, corners);
}
private void getPlayerColors() {
}
/**
*
* Initializes a top down preview of the race course map.
*/
private void initMapPreview() {
gameView = new GameView();
@@ -163,7 +185,7 @@ public class LobbyController implements Initializable {
}
/**
*
* Refreshes the list of players and their boats, as a series of VBox PlayerCell objects.
*/
private void refreshPlayerList() {
playerListVBox.getChildren().clear();
@@ -192,17 +214,12 @@ public class LobbyController implements Initializable {
}
}
/**
*
*/
private void leaveLobby() {
ViewManager.getInstance().getGameClient().stopGame();
ViewManager.getInstance().goToStartView();
}
/**
*
*/
public void disableReadyButton() {
this.beginRaceButton.setDisable(true);
this.beginRaceButton.setText("Waiting for host...");
@@ -1,249 +0,0 @@
package seng302.visualiser.controllers;
import com.sun.media.jfxmedia.logging.Logger;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javafx.application.Platform;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import seng302.gameServer.GameStages;
import seng302.gameServer.GameState;
import seng302.model.Colors;
import seng302.model.RaceState;
import seng302.visualiser.ClientToServerThread;
/**
* A class describing the actions of the lobby screen
* Created by wmu16 on 10/07/17.
*/
public class LobbyController_old {
public enum CloseStatus {
LEAVE,
READY
}
@FunctionalInterface
public interface LobbyCloseListener {
void notify(CloseStatus exitCause);
}
@FXML
private Text lobbyIpText;
@FXML
private Button readyButton;
@FXML
private Button customizeButton;
@FXML
private TextArea playerOneTxt;
@FXML
private TextArea playerTwoTxt;
@FXML
private TextArea playerThreeTxt;
@FXML
private TextArea playerFourTxt;
@FXML
private TextArea playerFiveTxt;
@FXML
private TextArea playerSixTxt;
@FXML
private TextArea playerSevenTxt;
@FXML
private TextArea playerEightTxt;
@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;
@FXML
private Text timeUntilStart;
@FXML
private Text courseNameText;
private List<ImageView> imageViews = new ArrayList<>();
private List<TextArea> listViews = new ArrayList<>();
private RaceState raceState;
private ClientToServerThread socketThread;
private Stage customizeStage;
private Color playersColor;
private int MAX_NUM_PLAYERS = 8;
private Integer playerID;
private List<LobbyCloseListener> lobbyListeners = new ArrayList<>();
private ObservableList<String> players;
/**
* Add all FXObjects to lists and initialize images.
*/
public void initialize() {
Collections.addAll(listViews,
playerOneTxt, playerTwoTxt, playerThreeTxt, playerFourTxt, playerFiveTxt, playerSixTxt,
playerSevenTxt, playerEightTxt
);
Collections.addAll(imageViews,
firstImageView, secondImageView, thirdImageView, fourthImageView,
fifthImageView, sixthImageView, seventhImageView, eighthImageView
);
initialiseImageView();
timeUntilStart.setText("Waiting For Host...");
}
/**
* Updates player names.
*/
private void updatePlayers() {
//Update players if one added.
for (int i = 0; i < players.size(); 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);
}
//Update empty text fields if player left.
for (int i = MAX_NUM_PLAYERS-1; i >= players.size(); i--) {
listViews.get(i).setText("");
imageViews.get(i).setVisible(false);
}
}
/**
* Sets all images and hides them till players join.
*/
private void initialiseImageView() {
for (ImageView viewer : imageViews) {
viewer.setImage(
new Image(
RaceViewController.class.getResourceAsStream(
"/pics/sail.png")
)
);
viewer.setVisible(false);
}
}
@FXML
public void customize() {
Parent root;
try {
FXMLLoader fxmlLoader = new FXMLLoader(LobbyController_old.class.getResource("/views/customizeView.fxml"));
root = fxmlLoader.load();
root.getStylesheets().add("/css/master.css");
customizeStage = new Stage();
customizeStage.setTitle("Customize Boat");
customizeStage.setScene(new Scene(root, 700, 450));
CustomizationController_old cc = fxmlLoader.getController();
cc.setServerThread(this.socketThread);
cc.setPlayerName(this.players.get(playerID - 1));
if (this.playersColor == null) {
this.playersColor = Colors.getColor(playerID - 1);
}
cc.setPlayerColor(this.playersColor);
cc.setStage(customizeStage); // pass the stage through so it can be closed later.
cc.setLobbyController(this);
customizeStage.show();
} catch (IOException e) {
Logger.logMsg(4, "Failed to load Customization View from resources.");
}
}
public void setSocketThread(ClientToServerThread thread) {
this.socketThread = thread;
}
@FXML
public void leaveLobbyButtonPressed() {
// TODO: 10/07/17 wmu16 - Finish function!
GameState.setCurrentStage(GameStages.CANCELLED);
// TODO: 20/07/17 wmu16 - Implement some way of terminating the game
for (LobbyCloseListener readyListener : lobbyListeners)
readyListener.notify(CloseStatus.LEAVE);
}
@FXML
public void readyButtonPressed() {
GameState.setCurrentStage(GameStages.PRE_RACE);
// Do countdown logic here
for (LobbyCloseListener readyListener : lobbyListeners)
readyListener.notify(CloseStatus.READY);
customizeButton.setDisable(true);
}
public void setTitle (String title) {
lobbyIpText.setText(title);
}
public void setCourseName(String courseName){
courseNameText.setText(courseName);
}
public void addCloseListener(LobbyCloseListener listener) {
lobbyListeners.add(listener);
}
public void setPlayerListSource (ObservableList<String> players) {
this.players = players;
players.addListener((ListChangeListener<? super String>) (lcl) ->
Platform.runLater(this::updatePlayers)
);
Platform.runLater(this::updatePlayers);
}
public void setPlayerID(Integer id) {
playerID = id;
}
public void updateRaceState(RaceState raceState){
this.raceState = raceState;
/*if (this.customizeStage != null) {
this.customizeStage.close();
}*/ // TODO: 17/08/17 ajm412: close the customization window if the host starts the game while customizing
if (!customizeButton.isDisabled()) {
customizeButton.setDisable(true);
}
timeUntilStart.setText("Starting in: " + raceState.getRaceTimeStr());
}
public void disableReadyButton () {
readyButton.setDisable(true);
readyButton.setVisible(false);
}
//TODO here newui
public void setPlayersColor(Color playerColor) {
this.playersColor = playerColor;
}
}
@@ -11,6 +11,8 @@ import java.util.concurrent.TimeUnit;
import javafx.animation.Timeline;
import javafx.application.Platform;
import javafx.beans.property.ReadOnlyBooleanProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
@@ -103,6 +105,8 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
private Label windDirectionLabel;
@FXML
private Label windSpeedLabel;
@FXML
private Label positionLabel, boatSpeedLabel, boatHeadingLabel;
//Race Data
private Map<Integer, ClientYacht> participants;
@@ -119,6 +123,7 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
private ImportantAnnotationsState importantAnnotations;
private Polyline windArrow = new WindArrow(Color.LIGHTGRAY);
private ObservableList<ClientYacht> selectionComboBoxList = FXCollections.observableArrayList();
private ClientYacht player;
public void initialize() {
Sounds.stopMusic();
@@ -171,6 +176,19 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
rvAnchorPane.setOnMouseClicked((event) ->
rvAnchorPane.requestFocus()
);
//Makes the chat history non transparent when clicked on
chatInput.focusedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue,
Boolean newValue) {
if (newValue) {
chatHistory.increaseOpacity();
} else {
chatHistory.decreaseOpacity();
}
}
});
}
public void loadRace (
@@ -181,6 +199,7 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
this.courseData = raceData;
this.markers = raceData.getCompoundMarks();
this.raceState = raceState;
this.player = player;
raceState.getPlayerPositions().addListener((ListChangeListener<ClientYacht>) c -> {
while (c.next()) {
@@ -410,6 +429,9 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
Platform.runLater(() -> updatePosition());
Platform.runLater(() -> updateBoatSpeed());
Platform.runLater(() -> updateBoatHeading());
Platform.runLater(() -> updateRaceTime());
}
}, 0, 1000);
@@ -473,6 +495,52 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
}
}
/**
* Updates player position with ordinal number up to 23rd position.
*/
private void updatePosition() {
if (player.getPosition() == null) {
positionLabel.setText("Position:\n-");
} else {
switch (player.getPosition()) {
case 1:
positionLabel.setText("Position:\n1st");
break;
case 2:
positionLabel.setText("Position:\n2nd");
break;
case 3:
positionLabel.setText("Position:\n3rd");
break;
case 21:
positionLabel.setText("Position:\n21st");
break;
case 22:
positionLabel.setText("Position:\n22nd");
break;
case 23:
positionLabel.setText("Position:\n23rd");
break;
default:
positionLabel.setText("Position:\n" + player.getPosition() + "th");
}
}
}
/**
* Updates boat speed value displayed on race view.
*/
private void updateBoatSpeed() {
boatSpeedLabel.setText("Boat Speed:\n" + String.valueOf(player.getCurrentVelocity()));
}
/**
* Updates boat heading value displayed on race view.
*/
private void updateBoatHeading() {
boatHeadingLabel.setText(String.format("Boat Heading:\n%.1f°", player.getHeading()));
}
/**
* Updates the order of the yachts as from the StreamParser and sets them in the yacht order
* section
@@ -703,8 +771,7 @@ public class RaceViewController extends Thread implements ImportantAnnotationDel
}
public boolean isChatInputFocused() {
// return chatInput.focusedProperty().getValue();
return false;
return chatInput.focusedProperty().getValue();
}
public String readChatInput() {
@@ -18,7 +18,6 @@ import javafx.geometry.Pos;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.input.KeyCode;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import org.slf4j.Logger;
@@ -57,10 +56,14 @@ public class ServerListController implements Initializable, ServerListenerDelega
private Label noServersFound;
private Logger logger = LoggerFactory.getLogger(ServerListController.class);
// TODO: 12/09/17 ajm412: break this method down, its way too long.
@Override
public void initialize(URL location, ResourceBundle resources) {
serverListVBox.minWidthProperty().bind(serverListScrollPane.widthProperty());
// Set Event Bindings
connectButton.setOnMouseEntered(event -> Sounds.playHoverSound());
serverListHostButton.setOnMouseEntered(event -> Sounds.playHoverSound());
connectButton.setOnMouseReleased(event -> {
attemptToDirectConnect();
Sounds.playButtonClick();
@@ -103,8 +106,8 @@ public class ServerListController implements Initializable, ServerListenerDelega
noServersFound.setText("No Servers Found");
noServersFound.setStyle(
"-fx-font-size: 30px;"
+ "-fx-padding:50px;"
+ "-fx-text-fill: -fx-pp-dark-text-color;"
+ "-fx-padding:50px;"
+ "-fx-text-fill: -fx-pp-dark-text-color;"
);
serverListVBox.getChildren().add(noServersFound);
@@ -126,7 +129,7 @@ public class ServerListController implements Initializable, ServerListenerDelega
}
/**
*
* Validates the connection and attempts to connect to a given hostname and port number.
*/
private void attemptToDirectConnect() {
if (validateDirectConnection(serverHostName.getText(), serverPortNumber.getText())) {
@@ -135,10 +138,10 @@ public class ServerListController implements Initializable, ServerListenerDelega
}
/**
*
* @param hostName
* @param portNumber
* @return
* Checks if the hostName and portNumber are valid values to connect to.
* @param hostName host name to check.
* @param portNumber port number to check
* @return boolean value if host and port number are valid values
*/
private Boolean validateDirectConnection(String hostName, String portNumber) {
Boolean hostNameValid = ValidationTools.validateTextField(serverHostName);
@@ -148,7 +151,7 @@ public class ServerListController implements Initializable, ServerListenerDelega
}
/**
*
* Connects the user to a lobby via the Direct Connect form.
*/
private void DirectConnect() {
Sounds.playButtonClick();
@@ -156,8 +159,8 @@ public class ServerListController implements Initializable, ServerListenerDelega
}
/**
*
* @param servers
* Refreshes the list of available servers.
* @param servers A list of ServerDescription objects showing available servers.
*/
private void refreshServers(List<ServerDescription> servers) {
serverListVBox.getChildren().clear();
@@ -184,11 +187,6 @@ public class ServerListController implements Initializable, ServerListenerDelega
}
}
public void playButtonHoverSound(MouseEvent mouseEvent) {
Sounds.playHoverSound();
}
@Override
public void serverRemoved(List<ServerDescription> servers) {
Platform.runLater(() -> refreshServers(servers));
@@ -5,15 +5,11 @@ import java.io.IOException;
import java.net.URL;
import java.util.List;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.effect.DropShadow;
import javafx.scene.input.MouseEvent;
import javafx.scene.paint.Color;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import seng302.gameServer.ServerDescription;
@@ -34,20 +30,21 @@ public class StartScreenController implements Initializable{
private List<ServerDescription> servers;
private GameClient gameClient;
/**
*
*/
private void setInitialDropShadow() {
DropShadow dropShadow = new DropShadow();
dropShadow.setRadius(10.0);
dropShadow.setOffsetX(3.0);
dropShadow.setOffsetY(4.0);
dropShadow.setColor(Color.color(0, 0, 0, 0.5));
headText.setEffect(dropShadow);
public void initialize(URL location, ResourceBundle resources) {
startBtn.setOnMousePressed(event -> {
startBtn.setText("LOADING...");
Sounds.playButtonClick();
});
startBtn.setOnMouseReleased(event -> goToServerBrowser());
startBtn.setOnMouseEntered(event -> Sounds.playHoverSound());
preloadServerListView();
}
/**
*
* Preloads the server list view to reduce load time between start screen and server list screen.
*/
private void preloadServerListView(){
try {
@@ -60,7 +57,7 @@ public class StartScreenController implements Initializable{
}
/**
*
* Changes the view to the Server Browser.
*/
private void goToServerBrowser() {
try {
@@ -70,40 +67,4 @@ public class StartScreenController implements Initializable{
}
}
public void initialize(URL location, ResourceBundle resources) {
startBtn.setOnMousePressed(event -> {
startBtn.setText("LOADING...");
Sounds.playButtonClick();
});
startBtn.setOnMouseReleased(event -> goToServerBrowser());
setInitialDropShadow();
preloadServerListView();
}
public void toggleMusic(ActionEvent actionEvent) {
Sounds.toggleMuteMusic();
Sounds.playButtonClick();
if (Sounds.isMusicMuted()) {
// muteMusicButton.setText("UnMute Music");
} else {
// muteMusicButton.setText("Mute Music");
}
}
public void toggleSounds(ActionEvent actionEvent) {
Sounds.toggleMuteEffects();
Sounds.playButtonClick();
if (Sounds.isSoundEffectsMuted()) {
// muteSoundsButton.setText("UnMute Sounds");
} else {
// muteSoundsButton.setText("Mute Sounds");
}
}
public void playButtonHoverSound(MouseEvent mouseEvent) {
Sounds.playHoverSound();
}
}
@@ -2,7 +2,6 @@ package seng302.visualiser.controllers;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXDecorator;
import com.jfoenix.controls.JFXDialog;
import com.jfoenix.svg.SVGGlyph;
import java.io.IOException;
import java.util.HashMap;
@@ -16,7 +15,6 @@ import javafx.scene.Scene;
import javafx.scene.SceneAntialiasing;
import javafx.scene.image.Image;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import org.slf4j.Logger;
@@ -25,7 +23,6 @@ import seng302.gameServer.ServerAdvertiser;
import seng302.utilities.BonjourInstallChecker;
import seng302.utilities.Sounds;
import seng302.visualiser.GameClient;
import seng302.visualiser.controllers.dialogs.BoatCustomizeController;
public class ViewManager {
@@ -106,6 +103,12 @@ public class ViewManager {
});
}
/**
* Sets the decorator when a new one is created (and ideally the old one destroyed)
* Also allows injection of buttons into the decorator for custom functions.
*
* @param newDecorator The new JFXDecorator to handle the game window.
*/
private void setDecorator(JFXDecorator newDecorator) {
decorator = newDecorator;
@@ -153,6 +156,9 @@ public class ViewManager {
}
/**
* Determines if a PC has compatibility with the bonjour protocol for server detection.
*/
private void checkCompatibility() {
if (BonjourInstallChecker.isBonjourSupported()) {
BonjourInstallChecker.openInstallUrl();
@@ -210,6 +216,11 @@ public class ViewManager {
return playerList;
}
/**
* Change the view to the Lobby Screen
* @param disableReadyButton Boolean value so that clients can't try start a game.
* @return A LobbyController object for the Lobby Screen.
*/
public LobbyController goToLobby(Boolean disableReadyButton) {
FXMLLoader loader = loadFxml("/views/LobbyView.fxml");
@@ -227,6 +238,11 @@ public class ViewManager {
return loader.getController();
}
/**
* Sets up the view for the race. Creating a new decorator and destroying the old one.
* @return A RaceViewController for the race view screen.
*/
public RaceViewController loadRaceView() {
FXMLLoader loader = loadFxml("/views/RaceView.fxml");
@@ -277,29 +293,4 @@ public class ViewManager {
return loader.getController();
}
public JFXDialog loadCustomizationDialog(StackPane parent, LobbyController lobbyController,
Color playerColor, String name) {
FXMLLoader dialog = loadFxml("/views/dialogs/BoatCustomizeDialog.fxml");
JFXDialog customizationDialog = null;
try {
customizationDialog = new JFXDialog(parent, dialog.load(),
JFXDialog.DialogTransition.CENTER);
} catch (IOException e) {
e.printStackTrace();
}
BoatCustomizeController controller = dialog.getController();
controller.setParentController(lobbyController);
controller.setPlayerColor(playerColor);
controller.setPlayerName(name);
controller.setServerThread(gameClient.getServerThread());
controller.setPlayerColor(lobbyController.playersColor);
return customizationDialog;
}
}
@@ -3,11 +3,9 @@ package seng302.visualiser.controllers.cells;
import javafx.fxml.FXML;
import javafx.scene.Group;
import javafx.scene.control.Label;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import seng302.utilities.Sounds;
import seng302.visualiser.fxObjects.assets_3D.BoatMeshType;
import seng302.visualiser.fxObjects.assets_3D.BoatModel;
import seng302.visualiser.fxObjects.assets_3D.ModelFactory;
@@ -34,12 +32,13 @@ public class PlayerCell {
}
public void initialize() {
// Set Player Name
playerName.setText(name);
// Add Rotating Boat to Player Cell with players color on it.
Group group = new Group();
boatPane.getChildren().add(group);
BoatModel bo = ModelFactory.boatIconView(BoatMeshType.DINGHY, this.boatColor);
group.getChildren().add(bo.getAssets());
}
public Integer getPlayerId() {
@@ -53,8 +52,4 @@ public class PlayerCell {
public Color getBoatColor() {
return boatColor;
}
public void playButtonHoverSound(MouseEvent mouseEvent) {
Sounds.playHoverSound();
}
}
}
@@ -1,27 +1,15 @@
package seng302.visualiser.controllers.cells;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXDecorator;
import com.sun.org.apache.bcel.internal.classfile.Unknown;
import java.io.IOException;
import java.net.InetAddress;
import java.net.URL;
import java.net.UnknownHostException;
import java.util.ResourceBundle;
import com.jfoenix.controls.JFXTextField;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.control.Label;
import javafx.scene.effect.DropShadow;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.GridPane;
import javafx.scene.paint.Color;
import javafx.scene.layout.VBox;
import seng302.gameServer.ServerDescription;
import seng302.utilities.Sounds;
import seng302.visualiser.GameClient;
import seng302.visualiser.controllers.ViewManager;
public class ServerCell implements Initializable {
@@ -29,6 +17,8 @@ public class ServerCell implements Initializable {
//--------FXML BEGIN--------//
//Layout
@FXML
private VBox serverCellVBox;
@FXML
private GridPane serverListCell;
//Server Information
@FXML
@@ -66,21 +56,21 @@ public class ServerCell implements Initializable {
serverPlayerCount.setText(currPlayerCount);
mapName.setText(mapNameString);
serverCellVBox.setOnMouseEntered(event -> Sounds.playHoverSound());
serverConnButton.setOnMouseReleased(event -> {
Sounds.playButtonClick();
joinServer();
});
}
/**
*
* Attempts to connect to the chosen server using the button on the serverCell.
*/
private void joinServer() {
System.out.println("Connecting to " + serverName.getText());
ViewManager.getInstance().getGameClient().runAsClient(hostName, portNumber);
}
public void playButtonHoverSound(MouseEvent mouseEvent) {
Sounds.playHoverSound();
}
}
@@ -4,18 +4,17 @@ import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXColorPicker;
import com.jfoenix.controls.JFXTextField;
import com.jfoenix.validation.RequiredFieldValidator;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import seng302.gameServer.messages.CustomizeRequestType;
import seng302.utilities.Sounds;
import seng302.visualiser.ClientToServerThread;
import java.net.URL;
import java.util.ResourceBundle;
import seng302.visualiser.controllers.LobbyController;
import seng302.visualiser.controllers.ViewManager;
import seng302.visualiser.validators.FieldLengthValidator;
import seng302.visualiser.validators.ValidationTools;
@@ -44,6 +43,8 @@ public class BoatCustomizeController implements Initializable{
submitCustomization();
});
socketThread = ViewManager.getInstance().getGameClient().getServerThread();
RequiredFieldValidator playerNameReqValidator = new RequiredFieldValidator();
playerNameReqValidator.setMessage("Player name required.");
@@ -56,7 +57,7 @@ public class BoatCustomizeController implements Initializable{
}
/**
*
* Attempts to submit a valid customization packet for boat name and boat color.
*/
private void submitCustomization() {
@@ -88,10 +89,6 @@ public class BoatCustomizeController implements Initializable{
this.colorPicker.setValue(playerColor);
}
public void setServerThread(ClientToServerThread ctsThread) {
this.socketThread = ctsThread;
}
public void setParentController(LobbyController lobbyController){
this.lobbyController = lobbyController;
}
@@ -4,6 +4,9 @@ import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXSlider;
import com.jfoenix.controls.JFXTextField;
import com.jfoenix.validation.RequiredFieldValidator;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
@@ -12,9 +15,6 @@ import seng302.gameServer.ServerDescription;
import seng302.utilities.Sounds;
import seng302.visualiser.controllers.ViewManager;
import seng302.visualiser.validators.FieldLengthValidator;
import java.net.URL;
import java.util.ResourceBundle;
import seng302.visualiser.validators.ValidationTools;
public class ServerCreationController implements Initializable {
@@ -48,10 +48,11 @@ public class ServerCreationController implements Initializable {
Sounds.playButtonClick();
validateServerSettings();
});
}
/**
*
* Validates that a server has a valid name and creates the server.
*/
private void validateServerSettings() {
submitBtn.setText("CREATING...");
@@ -63,7 +64,7 @@ public class ServerCreationController implements Initializable {
}
/**
*
* Creates a server with a given set of details.
*/
private void createServer() {
ServerDescription serverDescription = ViewManager.getInstance().getGameClient()
@@ -75,7 +76,7 @@ public class ServerCreationController implements Initializable {
}
/**
*
* Updates a label as the user slides along the max players slider.
*/
private void updateMaxPlayerLabel() {
maxPlayersSlider.setValue(Math.floor(maxPlayersSlider.getValue()));
@@ -24,10 +24,10 @@ public class ChatHistory extends ScrollPane {
this.setMaxWidth(Double.MAX_VALUE);
this.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
this.setHbarPolicy(ScrollBarPolicy.NEVER);
this.lookup(".scroll-pane").setStyle("-fx-background: rgba(255, 255, 255, 0.1); -fx-background-color: rgba(255, 255, 255, 0.1);");
this.lookup(".scroll-pane").setStyle("-fx-background: rgba(135, 206, 235, 0.0); -fx-background-color: rgba(135, 206, 235, 0.0);");
this.textFlow.setStyle(
"-fx-background: rgba(255, 255, 255, 0.1); -fx-background-color: rgba(255, 255, 255, 0.1); -fx-padding: 10px"
"-fx-background: rgba(135, 206, 235, 0.0); -fx-background-color: rgba(135, 206, 235, 0.0); -fx-padding: 10px"
);
//This makes the window auto scroll.
textFlow.getChildren().addListener((ListChangeListener<Node>) c ->
@@ -71,6 +71,19 @@ public class ChatHistory extends ScrollPane {
}
public void increaseOpacity() {
this.lookup(".scroll-pane").setStyle("-fx-background: rgba(255, 255, 255, 0.2); -fx-background-color: rgba(255, 255, 255, 0.2);");
this.textFlow.setStyle(
"-fx-background: rgba(255, 255, 255, 0.2); -fx-background-color: rgba(255, 255, 255, 0.2); -fx-padding: 10px"
);
}
public void decreaseOpacity() {
this.lookup(".scroll-pane").setStyle("-fx-background: rgba(135, 206, 235, 0.0); -fx-background-color: rgba(135, 206, 235, 0.0);");
this.textFlow.setStyle(
"-fx-background: rgba(135, 206, 235, 0.0); -fx-background-color: rgba(135, 206, 235, 0.0); -fx-padding: 10px"
);
}
}
Binary file not shown.
+1
View File
@@ -13,6 +13,7 @@
-fx-pp-dropshadow-light: dropshadow(gaussian, rgba(0, 0, 0, 0.1), 10.0, 0.2, 3, 4);
-fx-pp-dropshadow-dark: dropshadow(gaussian, rgba(0, 0, 0, 0.3), 10.0, 0.2, 5, 6);
-fx-pp-dropshadow-headers: dropshadow(gaussian, rgba(0, 0, 0, 0.5), 10.0, 0.2, 3, 4);
}
/*GridPane .jfx-button {*/
+22 -5
View File
@@ -1,13 +1,15 @@
@font-face {
src: url("DJB-Get-Digital.ttf");
src: url("digital-7-mono.ttf");
}
#timerGrid{
-fx-background-color: rgba(255, 255, 255, 0.6);
-fx-effect: -fx-pp-dropshadow-light;
}
.timer Label {
-fx-font-family: "DJB Get Digital" !important;
GridPane .timer * {
-fx-font-family: "Digital-7 Mono" !important;
-fx-font-size: 30;
}
#timerLabel{
@@ -19,11 +21,26 @@
}
#chatGridPane {
-fx-background-color: rgba(255, 255, 255, 0.6);
-fx-background-color: transparent;
}
#chatHistoryHolder {
-fx-background-color: rgba(255, 255, 255, 0.6);
-fx-effect: -fx-pp-dropshadow-light;
}
#chatInputHolder {
-fx-background-color: rgba(255, 255, 255, 0.6);
-fx-effect: -fx-pp-dropshadow-light;
}
#windGridPane {
-fx-background-color: rgba(255, 255, 255, 0.6);
-fx-effect: -fx-pp-dropshadow-light;
}
#windHolder {
-fx-background-color: rgba(255, 255, 255, 0.5);
}
#chatSend {
@@ -44,5 +61,5 @@
}
#windImageView {
-fx-image: url("/images/wind.png");
-fx-image: url("/images/wind-180.png");
}
@@ -22,4 +22,5 @@
-fx-background-color: transparent;
-fx-font-size: 80px;
-fx-text-fill: -fx-pp-light-text-color;
-fx-effect: -fx-pp-dropshadow-headers;
}
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 49 KiB

+94 -30
View File
@@ -14,8 +14,11 @@
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.text.Font?>
<AnchorPane fx:id="rvAnchorPane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="1200.0" style="-fx-background-color: skyblue;" xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.visualiser.controllers.RaceViewController">
<AnchorPane fx:id="rvAnchorPane" maxHeight="1.7976931348623157E308"
maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0"
prefWidth="1200.0" style="-fx-background-color: skyblue;" xmlns="http://javafx.com/javafx/8"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="seng302.visualiser.controllers.RaceViewController">
<children>
<StackPane fx:id="contentAnchorPane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="800.0" prefWidth="1200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
@@ -29,13 +32,15 @@
<rowConstraints>
<RowConstraints maxHeight="70.0" minHeight="70.0" prefHeight="70.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="1.7976931348623157E308" vgrow="SOMETIMES" />
<RowConstraints maxHeight="200.0" minHeight="200.0" prefHeight="200.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="250.0" minHeight="250.0" prefHeight="250.0"
valignment="BOTTOM" vgrow="SOMETIMES"/>
</rowConstraints>
<children>
<GridPane id="timerGrid" fx:id="timerGrid" prefWidth="192.0" styleClass=".timer">
<GridPane id="timerGrid" fx:id="timerGrid" prefWidth="192.0" styleClass="timer">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="50.0" minWidth="50.0" prefWidth="50.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="130.0" minWidth="130.0" prefWidth="130.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="135.0" minWidth="135.0"
prefWidth="135.0"/>
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
@@ -76,15 +81,17 @@
</GridPane>
<GridPane fx:id="chatGridPane" GridPane.columnIndex="2" GridPane.rowIndex="2">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="1.7976931348623157E308" minWidth="300.0" prefWidth="300.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="-Infinity" minWidth="100.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="390.0" minWidth="390.0"
prefWidth="390.0"/>
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="1.7976931348623157E308" vgrow="SOMETIMES" />
<RowConstraints maxHeight="50.0" minHeight="50.0" prefHeight="50.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="60.0" minHeight="60.0" prefHeight="60.0"
vgrow="SOMETIMES"/>
</rowConstraints>
<children>
<Pane fx:id="chatHistoryHolder" prefHeight="200.0" prefWidth="200.0" GridPane.columnSpan="2" GridPane.hgrow="ALWAYS" GridPane.vgrow="ALWAYS">
<Pane fx:id="chatHistoryHolder" prefHeight="200.0" prefWidth="200.0"
GridPane.hgrow="ALWAYS" GridPane.valignment="BOTTOM" GridPane.vgrow="ALWAYS">
<GridPane.margin>
<Insets />
</GridPane.margin>
@@ -92,44 +99,101 @@
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
</Pane>
<JFXButton fx:id="chatSend" alignment="CENTER" buttonType="RAISED" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="40.0" text="SEND" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="CENTER">
<GridPane fx:id="chatInputHolder" GridPane.rowIndex="1">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"/>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="-Infinity" minWidth="90.0"
prefWidth="90.0"/>
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="50.0" minHeight="50.0" prefHeight="50.0"
valignment="CENTER" vgrow="SOMETIMES"/>
</rowConstraints>
<children>
<JFXButton fx:id="chatSend" alignment="CENTER" buttonType="RAISED"
maxHeight="-Infinity" maxWidth="1.7976931348623157E308"
minHeight="-Infinity" minWidth="-Infinity" prefHeight="35.0"
text="SEND" GridPane.columnIndex="1">
<GridPane.margin>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
</GridPane.margin>
</JFXButton>
<JFXTextField fx:id="chatInput" maxHeight="35.0" minHeight="-Infinity"
prefHeight="35.0">
<GridPane.margin>
<Insets bottom="10.0" left="20.0" right="10.0"/>
</GridPane.margin>
<padding>
<Insets right="15.0"/>
</padding>
</JFXTextField>
</children>
<GridPane.margin>
<Insets left="10.0" right="10.0" />
<Insets top="10.0"/>
</GridPane.margin>
</JFXButton>
<JFXTextField fx:id="chatInput" maxHeight="35.0" minHeight="-Infinity" prefHeight="35.0" GridPane.rowIndex="1">
<GridPane.margin>
<Insets left="10.0" />
</GridPane.margin>
</JFXTextField>
</GridPane>
</children>
<GridPane.margin>
<Insets bottom="10.0" right="10.0"/>
</GridPane.margin>
</GridPane>
<GridPane GridPane.halignment="CENTER" GridPane.rowIndex="2" GridPane.valignment="BOTTOM">
<GridPane fx:id="windGridPane" maxHeight="-Infinity" maxWidth="-Infinity"
prefHeight="150.0" prefWidth="240.0" GridPane.halignment="CENTER"
GridPane.rowIndex="2" GridPane.valignment="BOTTOM">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="110.0" minWidth="110.0" prefWidth="110.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="132.0" minWidth="10.0" prefWidth="132.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="100.0" minHeight="100.0" prefHeight="100.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="90.0" minHeight="90.0" prefHeight="90.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="120.0" minHeight="120.0" prefHeight="120.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<ImageView fx:id="windImageView" fitHeight="92.0" fitWidth="109.0" pickOnBounds="true" preserveRatio="true" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="CENTER" />
<Label fx:id="windDirectionLabel" text="180.0°" GridPane.halignment="LEFT" GridPane.rowIndex="2" GridPane.valignment="CENTER">
<GridPane.margin>
<Insets left="5.0" />
</GridPane.margin></Label>
<Label fx:id="windSpeedLabel" text="0.0 Knots" GridPane.halignment="RIGHT" GridPane.rowIndex="2" GridPane.valignment="CENTER">
<GridPane.margin>
<Insets right="5.0" />
</GridPane.margin></Label>
<Label fx:id="positionLabel" text="Position:" GridPane.columnIndex="1" GridPane.halignment="LEFT" GridPane.rowSpan="2" GridPane.valignment="TOP">
<padding>
<Insets bottom="5.0" left="10.0" right="5.0" top="5.0" />
</padding>
</Label>
<Label fx:id="boatSpeedLabel" text="Boat Speed:" GridPane.columnIndex="1" GridPane.halignment="LEFT" GridPane.rowSpan="2" GridPane.valignment="CENTER">
<opaqueInsets>
<Insets />
</opaqueInsets>
<padding>
<Insets bottom="5.0" left="10.0" right="5.0" top="5.0" />
</padding></Label>
<Label fx:id="boatHeadingLabel" text="Boat Heading:" GridPane.columnIndex="1" GridPane.halignment="LEFT" GridPane.rowSpan="2" GridPane.valignment="BOTTOM">
<padding>
<Insets bottom="5.0" left="10.0" right="5.0" top="5.0" />
</padding>
</Label>
<GridPane fx:id="windHolder" GridPane.rowSpan="2">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="120.0" minHeight="120.0" prefHeight="120.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<ImageView fx:id="windImageView" fitHeight="92.0" fitWidth="109.0" pickOnBounds="true" preserveRatio="true" GridPane.halignment="CENTER" GridPane.rowSpan="2" GridPane.valignment="CENTER" />
<Label fx:id="windSpeedLabel" text="0.0 Knots" GridPane.halignment="RIGHT" GridPane.rowIndex="1" GridPane.valignment="CENTER">
<GridPane.margin>
<Insets right="5.0" />
</GridPane.margin>
</Label>
<Label fx:id="windDirectionLabel" text="180.0°" GridPane.halignment="LEFT" GridPane.rowIndex="1" GridPane.valignment="CENTER">
<GridPane.margin>
<Insets left="5.0" />
</GridPane.margin>
</Label>
</children>
</GridPane>
</children>
<opaqueInsets>
<Insets />
</opaqueInsets>
<GridPane.margin>
<Insets bottom="10.0" left="10.0" />
<Insets bottom="10.0" left="10.0" top="40.0" />
</GridPane.margin>
</GridPane>
</children>
+5 -2
View File
@@ -18,7 +18,10 @@
<children>
<GridPane fx:id="connectGridPane" GridPane.rowIndex="2">
<children>
<JFXButton fx:id="connectButton" buttonType="RAISED" onMouseEntered="#playButtonHoverSound" prefHeight="45.0" prefWidth="220.0" ripplerFill="#3493e3" text="CONNECT" textFill="WHITE" GridPane.columnIndex="5" GridPane.halignment="RIGHT" GridPane.valignment="CENTER">
<JFXButton fx:id="connectButton" buttonType="RAISED" prefHeight="45.0"
prefWidth="220.0" ripplerFill="#3493e3" text="CONNECT" textFill="WHITE"
GridPane.columnIndex="5" GridPane.halignment="RIGHT"
GridPane.valignment="CENTER">
<GridPane.margin>
<Insets right="50.0" />
</GridPane.margin>
@@ -74,7 +77,7 @@
</padding>
</Label>
<JFXButton id="hostButton" fx:id="serverListHostButton" buttonType="RAISED"
onMouseEntered="#playButtonHoverSound" prefHeight="45.0" prefWidth="220.0"
prefHeight="45.0" prefWidth="220.0"
text="HOST" GridPane.columnIndex="1" GridPane.halignment="RIGHT"
GridPane.valignment="CENTER">
<GridPane.margin>
@@ -26,7 +26,8 @@
<Insets bottom="150.0" />
</StackPane.margin>
</Label>
<JFXButton fx:id="startBtn" buttonType="RAISED" onMouseEntered="#playButtonHoverSound" prefHeight="80.0" prefWidth="337.0" text="START">
<JFXButton fx:id="startBtn" buttonType="RAISED" prefHeight="80.0" prefWidth="337.0"
text="START">
<font>
<Font size="20.0" />
</font>
@@ -9,7 +9,9 @@
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<VBox fx:id="serverCellVBox" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" onMouseEntered="#playButtonHoverSound" prefHeight="95.0" prefWidth="900.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<VBox fx:id="serverCellVBox" maxHeight="-Infinity" maxWidth="1.7976931348623157E308"
minHeight="-Infinity" minWidth="-Infinity" prefHeight="95.0" prefWidth="900.0"
xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<stylesheets>
<String fx:value="/css/Master.css"/>
<String fx:value="/css/cells/ServerCell.css" />
@@ -1,46 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ColorPicker?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.text.Text?>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity"
prefHeight="400.0" prefWidth="600.0" style="-fx-background-color: #2C2c36;"
xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="seng302.visualiser.controllers.CustomizationController_old">
<columnConstraints>
<ColumnConstraints fillWidth="false" halignment="CENTER" hgrow="SOMETIMES"
maxWidth="1.7976931348623157E308" minWidth="1.0" percentWidth="10.0" prefWidth="1.0"/>
<ColumnConstraints fillWidth="false" halignment="CENTER" hgrow="SOMETIMES" maxWidth="299.0"
minWidth="10.0" percentWidth="30.0" prefWidth="299.0"/>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="299.0" minWidth="10.0" percentWidth="50.0"
prefWidth="154.0"/>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="123.0" minWidth="0.0" percentWidth="10.0"
prefWidth="122.0"/>
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" percentHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" percentHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
</rowConstraints>
<children>
<TextField fx:id="nameField" maxWidth="200.0" minWidth="200.0" prefWidth="200.0"
GridPane.columnIndex="2" GridPane.halignment="CENTER" GridPane.rowIndex="1"
GridPane.valignment="CENTER"/>
<ColorPicker fx:id="boatColorPicker" prefWidth="200.0" style="-fx-background-color: eeeeee;"
GridPane.columnIndex="2" GridPane.halignment="CENTER" GridPane.rowIndex="2"
GridPane.valignment="CENTER"/>
<Text fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text="Player Name"
GridPane.columnIndex="1" GridPane.rowIndex="1"/>
<Text fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text="Boat Color"
GridPane.columnIndex="1" GridPane.rowIndex="2"/>
<Button fx:id="customizeSubmit" mnemonicParsing="false" onAction="#submitCustomization"
text="Submit" GridPane.columnIndex="2" GridPane.halignment="CENTER" GridPane.rowIndex="3"
GridPane.valignment="CENTER"/>
</children>
</GridPane>