Merge remote-tracking branch 'remotes/origin/master' into story77
# Conflicts: # racevisionGame/src/main/java/mock/app/Event.java # racevisionGame/src/main/java/visualiser/Controllers/HostController.java # racevisionGame/src/main/java/visualiser/Controllers/LobbyController.java # racevisionGame/src/main/java/visualiser/Controllers/MainController.java # racevisionGame/src/main/resources/visualiser/scenes/main.fxml # settings/keyBindings.xml
This commit is contained in:
@@ -18,3 +18,4 @@
|
|||||||
Erika Savell <[email protected]>
|
Erika Savell <[email protected]>
|
||||||
Connor Taylor-Brown <[email protected]> <[email protected]>
|
Connor Taylor-Brown <[email protected]> <[email protected]>
|
||||||
Fraser Cope <[email protected]>
|
Fraser Cope <[email protected]>
|
||||||
|
Jessica Syder <[email protected]> Jessica Syder <[email protected]>
|
||||||
@@ -2,14 +2,16 @@ package mock.app;
|
|||||||
|
|
||||||
import mock.dataInput.PolarParser;
|
import mock.dataInput.PolarParser;
|
||||||
import mock.exceptions.EventConstructionException;
|
import mock.exceptions.EventConstructionException;
|
||||||
import mock.model.*;
|
import mock.model.MockRace;
|
||||||
|
import mock.model.Polars;
|
||||||
|
import mock.model.RaceLogic;
|
||||||
|
import mock.model.SourceIdAllocator;
|
||||||
import mock.model.commandFactory.CompositeCommand;
|
import mock.model.commandFactory.CompositeCommand;
|
||||||
import network.Messages.Enums.RaceStatusEnum;
|
import network.Messages.Enums.RaceStatusEnum;
|
||||||
import network.Messages.HostGame;
|
import network.Messages.HostGame;
|
||||||
import mock.model.wind.RandomWindGenerator;
|
import mock.model.wind.RandomWindGenerator;
|
||||||
import mock.model.wind.ShiftingWindGenerator;
|
import mock.model.wind.ShiftingWindGenerator;
|
||||||
import mock.model.wind.WindGenerator;
|
import mock.model.wind.WindGenerator;
|
||||||
import mock.xml.RaceXMLCreator;
|
|
||||||
import network.Messages.LatestMessages;
|
import network.Messages.LatestMessages;
|
||||||
import shared.dataInput.*;
|
import shared.dataInput.*;
|
||||||
import shared.enums.XMLFileType;
|
import shared.enums.XMLFileType;
|
||||||
@@ -19,21 +21,13 @@ import shared.exceptions.InvalidRegattaDataException;
|
|||||||
import shared.exceptions.XMLReaderException;
|
import shared.exceptions.XMLReaderException;
|
||||||
import shared.model.Bearing;
|
import shared.model.Bearing;
|
||||||
import shared.model.Constants;
|
import shared.model.Constants;
|
||||||
import shared.xml.XMLUtilities;
|
|
||||||
|
|
||||||
import javax.xml.bind.JAXBException;
|
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.Inet4Address;
|
import java.net.Inet4Address;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -21,10 +21,9 @@ import java.util.logging.Logger;
|
|||||||
* Created by connortaylorbrown on 2/08/17.
|
* Created by connortaylorbrown on 2/08/17.
|
||||||
*/
|
*/
|
||||||
public class RaceServer {
|
public class RaceServer {
|
||||||
private static RaceServer server;//this is for updating xml files as I cannot find an elegant way to do this and since it is near the end of the sprint we shouldn't be doing large scale refactors
|
|
||||||
|
|
||||||
private MockRace race;
|
private MockRace race;
|
||||||
private LatestMessages latestMessages;
|
private LatestMessages latestMessages;
|
||||||
|
private static RaceServer server;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,6 +53,12 @@ public class RaceServer {
|
|||||||
this.latestMessages = latestMessages;
|
this.latestMessages = latestMessages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void staticUpdateXML() {
|
||||||
|
if (server != null) {
|
||||||
|
server.updateXMLFiles();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses the race to create a snapshot, and places it in latestMessages.
|
* Parses the race to create a snapshot, and places it in latestMessages.
|
||||||
*/
|
*/
|
||||||
@@ -75,13 +80,6 @@ public class RaceServer {
|
|||||||
updateXMLFiles();
|
updateXMLFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void staticUpdateXML(){
|
|
||||||
if (server != null){
|
|
||||||
server.updateXMLFiles();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the race/boat/regatta data sources have changed, and if they have, update their xml representations.
|
* Checks if the race/boat/regatta data sources have changed, and if they have, update their xml representations.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,34 +1,22 @@
|
|||||||
package mock.xml;
|
package mock.xml;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import shared.dataInput.RaceXMLReader;
|
import shared.dataInput.RaceXMLReader;
|
||||||
import shared.enums.XMLFileType;
|
import shared.enums.XMLFileType;
|
||||||
import shared.exceptions.InvalidRaceDataException;
|
import shared.exceptions.InvalidRaceDataException;
|
||||||
import shared.exceptions.XMLReaderException;
|
import shared.exceptions.XMLReaderException;
|
||||||
import shared.model.*;
|
import shared.model.CompoundMark;
|
||||||
import shared.xml.Race.*;
|
import shared.model.Constants;
|
||||||
|
import shared.model.GPSCoordinate;
|
||||||
|
import shared.xml.Race.XMLCompoundMark;
|
||||||
|
import shared.xml.Race.XMLLimit;
|
||||||
|
import shared.xml.Race.XMLMark;
|
||||||
|
import shared.xml.Race.XMLRace;
|
||||||
import shared.xml.XMLUtilities;
|
import shared.xml.XMLUtilities;
|
||||||
|
|
||||||
import javax.xml.XMLConstants;
|
|
||||||
import javax.xml.bind.JAXBContext;
|
|
||||||
import javax.xml.bind.JAXBException;
|
import javax.xml.bind.JAXBException;
|
||||||
import javax.xml.bind.Marshaller;
|
|
||||||
import javax.xml.bind.Unmarshaller;
|
|
||||||
import javax.xml.bind.util.JAXBSource;
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
import javax.xml.transform.Source;
|
|
||||||
import javax.xml.transform.dom.DOMSource;
|
|
||||||
import javax.xml.validation.Schema;
|
|
||||||
import javax.xml.validation.SchemaFactory;
|
|
||||||
import javax.xml.validation.Validator;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.StringWriter;
|
|
||||||
import java.math.BigInteger;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
|||||||
@@ -34,9 +34,6 @@ public class LatestMessages extends Observable {
|
|||||||
private XMLMessage regattaXMLMessage;
|
private XMLMessage regattaXMLMessage;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ctor.
|
* Ctor.
|
||||||
*/
|
*/
|
||||||
@@ -46,6 +43,7 @@ public class LatestMessages extends Observable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a copy of the race snapshot.
|
* Returns a copy of the race snapshot.
|
||||||
|
*
|
||||||
* @return Copy of the race snapshot.
|
* @return Copy of the race snapshot.
|
||||||
*/
|
*/
|
||||||
public List<AC35Data> getSnapshot() {
|
public List<AC35Data> getSnapshot() {
|
||||||
@@ -55,6 +53,7 @@ public class LatestMessages extends Observable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the snapshot of the race.
|
* Sets the snapshot of the race.
|
||||||
|
*
|
||||||
* @param snapshot New snapshot of race.
|
* @param snapshot New snapshot of race.
|
||||||
*/
|
*/
|
||||||
public void setSnapshot(List<AC35Data> snapshot) {
|
public void setSnapshot(List<AC35Data> snapshot) {
|
||||||
@@ -62,12 +61,9 @@ public class LatestMessages extends Observable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the latest race xml message.
|
* Returns the latest race xml message.
|
||||||
|
*
|
||||||
* @return The latest race xml message.
|
* @return The latest race xml message.
|
||||||
*/
|
*/
|
||||||
public XMLMessage getRaceXMLMessage() {
|
public XMLMessage getRaceXMLMessage() {
|
||||||
@@ -76,6 +72,7 @@ public class LatestMessages extends Observable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the latest race xml message to a specified race XML message.
|
* Sets the latest race xml message to a specified race XML message.
|
||||||
|
*
|
||||||
* @param raceXMLMessage The new race XML message to use.
|
* @param raceXMLMessage The new race XML message to use.
|
||||||
*/
|
*/
|
||||||
public void setRaceXMLMessage(XMLMessage raceXMLMessage) {
|
public void setRaceXMLMessage(XMLMessage raceXMLMessage) {
|
||||||
@@ -88,6 +85,7 @@ public class LatestMessages extends Observable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the latest boat xml message.
|
* Returns the latest boat xml message.
|
||||||
|
*
|
||||||
* @return The latest boat xml message.
|
* @return The latest boat xml message.
|
||||||
*/
|
*/
|
||||||
public XMLMessage getBoatXMLMessage() {
|
public XMLMessage getBoatXMLMessage() {
|
||||||
@@ -96,6 +94,7 @@ public class LatestMessages extends Observable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the latest boat xml message to a specified boat XML message.
|
* Sets the latest boat xml message to a specified boat XML message.
|
||||||
|
*
|
||||||
* @param boatXMLMessage The new boat XML message to use.
|
* @param boatXMLMessage The new boat XML message to use.
|
||||||
*/
|
*/
|
||||||
public void setBoatXMLMessage(XMLMessage boatXMLMessage) {
|
public void setBoatXMLMessage(XMLMessage boatXMLMessage) {
|
||||||
@@ -108,6 +107,7 @@ public class LatestMessages extends Observable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the latest regatta xml message.
|
* Returns the latest regatta xml message.
|
||||||
|
*
|
||||||
* @return The latest regatta xml message.
|
* @return The latest regatta xml message.
|
||||||
*/
|
*/
|
||||||
public XMLMessage getRegattaXMLMessage() {
|
public XMLMessage getRegattaXMLMessage() {
|
||||||
@@ -116,6 +116,7 @@ public class LatestMessages extends Observable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the latest regatta xml message to a specified regatta XML message.
|
* Sets the latest regatta xml message to a specified regatta XML message.
|
||||||
|
*
|
||||||
* @param regattaXMLMessage The new regatta XML message to use.
|
* @param regattaXMLMessage The new regatta XML message to use.
|
||||||
*/
|
*/
|
||||||
public void setRegattaXMLMessage(XMLMessage regattaXMLMessage) {
|
public void setRegattaXMLMessage(XMLMessage regattaXMLMessage) {
|
||||||
@@ -127,6 +128,7 @@ public class LatestMessages extends Observable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks the type of xml message, and places it in this LatestMessages object.
|
* Checks the type of xml message, and places it in this LatestMessages object.
|
||||||
|
*
|
||||||
* @param xmlMessage The new xml message to use.
|
* @param xmlMessage The new xml message to use.
|
||||||
*/
|
*/
|
||||||
public void setXMLMessage(XMLMessage xmlMessage) {
|
public void setXMLMessage(XMLMessage xmlMessage) {
|
||||||
@@ -146,10 +148,12 @@ public class LatestMessages extends Observable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether or not there is an xml message for each message type.
|
* Returns whether or not there is an xml message for each message type.
|
||||||
|
*
|
||||||
* @return True if race, boat, and regatta have an xml message, false otherwise.
|
* @return True if race, boat, and regatta have an xml message, false otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean hasAllXMLMessages() {
|
public boolean hasAllXMLMessages() {
|
||||||
if (this.regattaXMLMessage == null || this.boatXMLMessage == null || this.raceXMLMessage == null) {
|
if (this.regattaXMLMessage == null || this.boatXMLMessage == null ||
|
||||||
|
this.raceXMLMessage == null) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package shared.model;
|
|||||||
import javafx.beans.property.SimpleStringProperty;
|
import javafx.beans.property.SimpleStringProperty;
|
||||||
import javafx.beans.property.StringProperty;
|
import javafx.beans.property.StringProperty;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import visualiser.Controllers.RaceStartController;
|
||||||
import visualiser.model.ResizableRaceCanvas;
|
import visualiser.model.ResizableRaceCanvas;
|
||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
@@ -15,8 +16,8 @@ import java.util.Date;
|
|||||||
* This class is used to implement a clock which keeps track of and
|
* This class is used to implement a clock which keeps track of and
|
||||||
* displays times relevant to a race. This is displayed on the
|
* displays times relevant to a race. This is displayed on the
|
||||||
* {@link ResizableRaceCanvas} via the
|
* {@link ResizableRaceCanvas} via the
|
||||||
* {@link visualiser.Controllers.RaceController} and the
|
* {@link visualiser.Controllers.RaceViewController} and the
|
||||||
* {@link visualiser.Controllers.StartController}.
|
* {@link RaceStartController}.
|
||||||
*/
|
*/
|
||||||
public class RaceClock {
|
public class RaceClock {
|
||||||
|
|
||||||
|
|||||||
@@ -1,65 +1,31 @@
|
|||||||
package visualiser.Controllers;
|
package visualiser.Controllers;
|
||||||
|
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.beans.property.Property;
|
import javafx.beans.property.Property;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
import javafx.scene.layout.Pane;
|
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import javafx.scene.shape.Circle;
|
|
||||||
import shared.model.Bearing;
|
import shared.model.Bearing;
|
||||||
import shared.model.Wind;
|
import shared.model.Wind;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller for the arrow.fxml view.
|
* Controller for the wind direction arrow on the race screen.
|
||||||
*/
|
*/
|
||||||
public class ArrowController {
|
public class ArrowController {
|
||||||
|
private @FXML StackPane arrowStackPane;
|
||||||
|
private @FXML ImageView arrowImage;
|
||||||
@FXML
|
private @FXML Label speedLabel;
|
||||||
private Pane compass;
|
private final static Integer MIN_KNOTS = 2; // knots for min_height
|
||||||
|
private final static Integer MAX_KNOTS = 30; // knots for max_height
|
||||||
@FXML
|
private final static Integer MIN_HEIGHT = 25; // min arrow height
|
||||||
private StackPane arrowStackPane;
|
private final static Integer MAX_HEIGHT = 75; // max arrow height
|
||||||
|
|
||||||
@FXML
|
|
||||||
private ImageView arrowImage;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private Circle circle;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private Label northLabel;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private Label windLabel;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private Label speedLabel;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the property our arrow control binds to.
|
|
||||||
*/
|
|
||||||
private Property<Wind> wind;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
*/
|
|
||||||
public ArrowController() {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets which wind property the arrow control should bind to.
|
* Sets which wind property the arrow control should bind to.
|
||||||
* @param wind The wind property to bind to.
|
* @param wind The wind property to bind to.
|
||||||
*/
|
*/
|
||||||
public void setWindProperty(Property<Wind> wind) {
|
public void setWindProperty(Property<Wind> wind) {
|
||||||
this.wind = wind;
|
|
||||||
|
|
||||||
wind.addListener((observable, oldValue, newValue) -> {
|
wind.addListener((observable, oldValue, newValue) -> {
|
||||||
if (newValue != null) {
|
if (newValue != null) {
|
||||||
Platform.runLater(() -> updateWind(newValue));
|
Platform.runLater(() -> updateWind(newValue));
|
||||||
@@ -67,7 +33,6 @@ public class ArrowController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the control to use the new wind value.
|
* Updates the control to use the new wind value.
|
||||||
* This updates the arrow direction (due to bearing), arrow length (due to speed), and label (due to speed).
|
* This updates the arrow direction (due to bearing), arrow length (due to speed), and label (due to speed).
|
||||||
@@ -78,7 +43,6 @@ public class ArrowController {
|
|||||||
updateWindSpeed(wind.getWindSpeed());
|
updateWindSpeed(wind.getWindSpeed());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the control to account for the new wind speed.
|
* Updates the control to account for the new wind speed.
|
||||||
* This changes the length (height) of the wind arrow, and updates the speed label.
|
* This changes the length (height) of the wind arrow, and updates the speed label.
|
||||||
@@ -94,29 +58,22 @@ public class ArrowController {
|
|||||||
* @param speedKnots Wind speed, in knots.
|
* @param speedKnots Wind speed, in knots.
|
||||||
*/
|
*/
|
||||||
private void updateWindArrowLength(double speedKnots) {
|
private void updateWindArrowLength(double speedKnots) {
|
||||||
|
double deltaKnots = MAX_KNOTS - MIN_KNOTS;
|
||||||
//At 2 knots, the arrow reaches its minimum height, and at 30 knots it reaches its maximum height.
|
double deltaHeight = MAX_HEIGHT - MIN_HEIGHT;
|
||||||
double minKnots = 2;
|
|
||||||
double maxKnots = 30;
|
|
||||||
double deltaKnots = maxKnots - minKnots;
|
|
||||||
|
|
||||||
double minHeight = 25;
|
|
||||||
double maxHeight = 75;
|
|
||||||
double deltaHeight = maxHeight - minHeight;
|
|
||||||
|
|
||||||
//Clamp speed.
|
//Clamp speed.
|
||||||
if (speedKnots > maxKnots) {
|
if (speedKnots > MAX_KNOTS) {
|
||||||
speedKnots = maxKnots;
|
speedKnots = MAX_KNOTS;
|
||||||
} else if (speedKnots < minKnots) {
|
} else if (speedKnots < MIN_KNOTS) {
|
||||||
speedKnots = minKnots;
|
speedKnots = MIN_KNOTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//How far between the knots bounds is the current speed?
|
//How far between the knots bounds is the current speed?
|
||||||
double currentDeltaKnots = speedKnots - minKnots;
|
double currentDeltaKnots = speedKnots - MIN_KNOTS;
|
||||||
double currentKnotsScalar = currentDeltaKnots / deltaKnots;
|
double currentKnotsScalar = currentDeltaKnots / deltaKnots;
|
||||||
|
|
||||||
//Thus, how far between the pixel height bounds should the arrow height be?
|
//Thus, how far between the pixel height bounds should the arrow height be?
|
||||||
double newHeight = minHeight + (currentKnotsScalar * deltaHeight);
|
double newHeight = MIN_HEIGHT + (currentKnotsScalar * deltaHeight);
|
||||||
|
|
||||||
arrowImage.setFitHeight(newHeight);
|
arrowImage.setFitHeight(newHeight);
|
||||||
}
|
}
|
||||||
@@ -129,7 +86,6 @@ public class ArrowController {
|
|||||||
speedLabel.setText(String.format("%.1fkn", speedKnots));
|
speedLabel.setText(String.format("%.1fkn", speedKnots));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the control to account for a new wind bearing.
|
* Updates the control to account for a new wind bearing.
|
||||||
* This rotates the arrow according to the bearing.
|
* This rotates the arrow according to the bearing.
|
||||||
@@ -140,7 +96,4 @@ public class ArrowController {
|
|||||||
arrowStackPane.setRotate(bearing.degrees());
|
arrowStackPane.setRotate(bearing.degrees());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,147 +0,0 @@
|
|||||||
package visualiser.Controllers;
|
|
||||||
|
|
||||||
import javafx.collections.FXCollections;
|
|
||||||
import javafx.collections.ObservableList;
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.scene.control.*;
|
|
||||||
import javafx.scene.layout.AnchorPane;
|
|
||||||
import mock.app.Event;
|
|
||||||
import org.xml.sax.SAXException;
|
|
||||||
import shared.exceptions.InvalidBoatDataException;
|
|
||||||
import shared.exceptions.InvalidRaceDataException;
|
|
||||||
import shared.exceptions.InvalidRegattaDataException;
|
|
||||||
import shared.exceptions.XMLReaderException;
|
|
||||||
import visualiser.model.RaceConnection;
|
|
||||||
|
|
||||||
import javax.xml.bind.JAXBException;
|
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
|
||||||
import javax.xml.soap.Text;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.Socket;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.net.UnknownHostException;
|
|
||||||
import java.util.ResourceBundle;
|
|
||||||
|
|
||||||
//TODO it appears this view/controller was replaced by Lobby.fxml. Remove?
|
|
||||||
/**
|
|
||||||
* Controls the connection that the VIsualiser can connect to.
|
|
||||||
*/
|
|
||||||
public class ConnectionController extends Controller {
|
|
||||||
@FXML
|
|
||||||
private AnchorPane connectionWrapper;
|
|
||||||
@FXML
|
|
||||||
private TableView<RaceConnection> connectionTable;
|
|
||||||
@FXML
|
|
||||||
private TableColumn<RaceConnection, String> hostnameColumn;
|
|
||||||
@FXML
|
|
||||||
private TableColumn<RaceConnection, String> statusColumn;
|
|
||||||
@FXML
|
|
||||||
private Button connectButton;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private TextField urlField;
|
|
||||||
@FXML
|
|
||||||
private TextField portField;
|
|
||||||
|
|
||||||
|
|
||||||
/*Title Screen fxml items*/
|
|
||||||
@FXML
|
|
||||||
private Button hostGameTitleBtn;
|
|
||||||
@FXML
|
|
||||||
private Button connectGameBtn;
|
|
||||||
@FXML
|
|
||||||
private RadioButton nightRadioBtn;
|
|
||||||
@FXML
|
|
||||||
private RadioButton dayRadioButton;
|
|
||||||
|
|
||||||
/*Lobby fxml items*/
|
|
||||||
@FXML
|
|
||||||
private TableView lobbyTable;
|
|
||||||
@FXML
|
|
||||||
private TableColumn gameNameColumn;
|
|
||||||
@FXML
|
|
||||||
private TableColumn hostNameColumn;
|
|
||||||
@FXML
|
|
||||||
private TableColumn playerCountColumn;
|
|
||||||
@FXML
|
|
||||||
private TextField playerNameField;
|
|
||||||
@FXML
|
|
||||||
private Button joinGameBtn;
|
|
||||||
|
|
||||||
/*Host game fxml items*/
|
|
||||||
@FXML
|
|
||||||
private TextField gameNameField;
|
|
||||||
@FXML
|
|
||||||
private TextField hostNameField;
|
|
||||||
@FXML
|
|
||||||
private TextField hostGameBtn;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private ObservableList<RaceConnection> connections;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initialize(URL location, ResourceBundle resources) {
|
|
||||||
// TODO - replace with config file
|
|
||||||
connections = FXCollections.observableArrayList();
|
|
||||||
|
|
||||||
connectionTable.setItems(connections);
|
|
||||||
hostnameColumn.setCellValueFactory(cellData -> cellData.getValue().hostnameProperty());
|
|
||||||
statusColumn.setCellValueFactory(cellData -> cellData.getValue().statusProperty());
|
|
||||||
|
|
||||||
connectionTable.getSelectionModel().selectedItemProperty().addListener((obs, prev, curr) -> {
|
|
||||||
if (curr != null && curr.check()) connectButton.setDisable(false);
|
|
||||||
else connectButton.setDisable(true);
|
|
||||||
});
|
|
||||||
connectButton.setDisable(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets current status of all connections.
|
|
||||||
*/
|
|
||||||
public void checkConnections() {
|
|
||||||
for(RaceConnection connection: connections) {
|
|
||||||
connection.check();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public AnchorPane startWrapper(){
|
|
||||||
return connectionWrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Connects to host currently selected in table. Button enabled only if host is ready.
|
|
||||||
*/
|
|
||||||
public void connectSocket() {
|
|
||||||
try{
|
|
||||||
RaceConnection connection = connectionTable.getSelectionModel().getSelectedItem();
|
|
||||||
Socket socket = new Socket(connection.getHostname(), connection.getPort());
|
|
||||||
socket.setKeepAlive(true);
|
|
||||||
connectionWrapper.setVisible(false);
|
|
||||||
//parent.enterLobby(socket);
|
|
||||||
} catch (IOException e) { /* Never reached */ }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* adds a new connection
|
|
||||||
*/
|
|
||||||
public void addConnection(){
|
|
||||||
String hostName = urlField.getText();
|
|
||||||
String portString = portField.getText();
|
|
||||||
try{
|
|
||||||
int port = Integer.parseInt(portString);
|
|
||||||
connections.add(new RaceConnection(hostName, port, null));
|
|
||||||
}catch(NumberFormatException e){
|
|
||||||
System.err.println("Port number entered is not a number");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,32 +1,108 @@
|
|||||||
package visualiser.Controllers;
|
package visualiser.Controllers;
|
||||||
|
|
||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.scene.Parent;
|
||||||
import java.net.URL;
|
import javafx.scene.Scene;
|
||||||
import java.util.ResourceBundle;
|
import javafx.scene.image.Image;
|
||||||
|
import javafx.stage.Modality;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import visualiser.app.App;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller parent for app controllers.
|
* Abstract controller class to give each subclass the functionality to load
|
||||||
* Created by fwy13 on 15/03/2017.
|
* a new scene into the existing stage, or create a new popup window.
|
||||||
*/
|
*/
|
||||||
public abstract class Controller implements Initializable {
|
public abstract class Controller {
|
||||||
protected MainController parent;
|
private Stage stage = App.getStage();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the parent of the application
|
* Loads the title screen again when app is already running.
|
||||||
*
|
* @throws IOException if a problem with the title.fxml
|
||||||
* @param parent controller
|
|
||||||
*/
|
*/
|
||||||
public void setParent(MainController parent) {
|
protected void loadTitleScreen() throws IOException {
|
||||||
this.parent = parent;
|
FXMLLoader loader = new FXMLLoader(getClass().getResource("/visualiser/scenes/title.fxml"));
|
||||||
|
Parent root = loader.load();
|
||||||
|
stage.setResizable(false);
|
||||||
|
Scene scene = new Scene(root);
|
||||||
|
addCssStyle(scene);
|
||||||
|
stage.setScene(scene);
|
||||||
|
stage.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialisation class that is run on start up.
|
* Used to load a new scene in the currently open stage.
|
||||||
*
|
* @param fxmlUrl the URL of the FXML file to be loaded
|
||||||
* @param location resources location
|
* @return the controller of the new scene
|
||||||
* @param resources resources bundle
|
* @throws IOException if there is an issue with the fxmlUrl
|
||||||
*/
|
*/
|
||||||
@Override
|
protected Controller loadScene(String fxmlUrl) throws IOException {
|
||||||
public abstract void initialize(URL location, ResourceBundle resources);
|
// load the correct fxml file
|
||||||
|
FXMLLoader loader = new FXMLLoader();
|
||||||
|
loader.setLocation(getClass().getResource
|
||||||
|
("/visualiser/scenes/"+fxmlUrl));
|
||||||
|
Parent root = loader.load();
|
||||||
|
|
||||||
|
// reuse previous stage and it's window size
|
||||||
|
Stage stage = App.getStage();
|
||||||
|
Double stageHeight = stage.getHeight();
|
||||||
|
Double stageWidth = stage.getWidth();
|
||||||
|
|
||||||
|
// set new scene into existing window
|
||||||
|
Scene scene = new Scene(root, stageWidth, stageHeight);
|
||||||
|
addCssStyle(scene);
|
||||||
|
stage.setScene(scene);
|
||||||
|
stage.setResizable(true);
|
||||||
|
stage.show();
|
||||||
|
stage.setHeight(stageHeight);
|
||||||
|
stage.setWidth(stageWidth);
|
||||||
|
stage.sizeToScene();
|
||||||
|
|
||||||
|
// return controller for the loaded fxml scene
|
||||||
|
return loader.getController();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to load a scene in a new separate popup stage.
|
||||||
|
* @param fxmlUrl the URL of the FXML file to be loaded
|
||||||
|
* @param title title for the new window
|
||||||
|
* @param modality modality settings for popup window
|
||||||
|
* @return the controller of the new scene
|
||||||
|
* @throws IOException if there is an issue with the fxmlUrl
|
||||||
|
*/
|
||||||
|
protected Controller loadPopupScene(String fxmlUrl, String title, Modality
|
||||||
|
modality) throws IOException {
|
||||||
|
// load the correct fxml scene
|
||||||
|
FXMLLoader loader = new FXMLLoader();
|
||||||
|
loader.setLocation(getClass().getResource(
|
||||||
|
"/visualiser/scenes/" + fxmlUrl));
|
||||||
|
Parent root = loader.load();
|
||||||
|
|
||||||
|
// create a new 'pop-up' window
|
||||||
|
Stage stage = new Stage();
|
||||||
|
stage.initModality(modality);
|
||||||
|
stage.setTitle(title);
|
||||||
|
stage.centerOnScreen();
|
||||||
|
stage.getIcons().add(new Image(getClass().getClassLoader().getResourceAsStream("images/SailIcon.png")));
|
||||||
|
Scene scene = new Scene(root);
|
||||||
|
addCssStyle(scene);
|
||||||
|
stage.setScene(scene);
|
||||||
|
stage.show();
|
||||||
|
|
||||||
|
// return controller for the loaded fxml scene
|
||||||
|
return loader.getController();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the relevant CSS styling to the scene being loaded.
|
||||||
|
* @param scene new scene to be loaded and displayed
|
||||||
|
*/
|
||||||
|
private void addCssStyle(Scene scene){
|
||||||
|
if (App.dayMode) {
|
||||||
|
scene.getStylesheets().add("/css/dayMode.css");
|
||||||
|
} else {
|
||||||
|
scene.getStylesheets().add("/css/nightMode.css");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,92 +0,0 @@
|
|||||||
package visualiser.Controllers;
|
|
||||||
|
|
||||||
|
|
||||||
import javafx.collections.ObservableList;
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.scene.control.Label;
|
|
||||||
import javafx.scene.control.TableColumn;
|
|
||||||
import javafx.scene.control.TableView;
|
|
||||||
import javafx.scene.layout.AnchorPane;
|
|
||||||
import visualiser.model.VisualiserBoat;
|
|
||||||
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ResourceBundle;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Finish Screen for when the race finishes.
|
|
||||||
*/
|
|
||||||
public class FinishController extends Controller {
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
AnchorPane finishWrapper;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
TableView<VisualiserBoat> boatInfoTable;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
TableColumn<VisualiserBoat, String> boatRankColumn;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
TableColumn<VisualiserBoat, String> boatNameColumn;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
Label raceWinnerLabel;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The boats to display on the table.
|
|
||||||
*/
|
|
||||||
private ObservableList<VisualiserBoat> boats;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ctor.
|
|
||||||
*/
|
|
||||||
public FinishController() {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initialize(URL location, ResourceBundle resources){
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets up the finish table
|
|
||||||
* @param boats Boats to display
|
|
||||||
*/
|
|
||||||
private void setFinishTable(ObservableList<VisualiserBoat> boats) {
|
|
||||||
this.boats = boats;
|
|
||||||
|
|
||||||
//Set contents.
|
|
||||||
boatInfoTable.setItems(boats);
|
|
||||||
|
|
||||||
//Name.
|
|
||||||
boatNameColumn.setCellValueFactory(cellData -> cellData.getValue().nameProperty());
|
|
||||||
|
|
||||||
//Rank/position.
|
|
||||||
boatRankColumn.setCellValueFactory(cellData -> cellData.getValue().placingProperty());
|
|
||||||
|
|
||||||
|
|
||||||
//Winner label.
|
|
||||||
if (boats.size() > 0) {
|
|
||||||
raceWinnerLabel.setText("Winner: " + boatNameColumn.getCellObservableValue(0).getValue());
|
|
||||||
raceWinnerLabel.setWrapText(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Display the table
|
|
||||||
* @param boats boats to display on the table.
|
|
||||||
*/
|
|
||||||
public void enterFinish(ObservableList<VisualiserBoat> boats){
|
|
||||||
finishWrapper.setVisible(true);
|
|
||||||
setFinishTable(boats);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,159 +0,0 @@
|
|||||||
package visualiser.Controllers;
|
|
||||||
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.scene.control.Button;
|
|
||||||
import javafx.scene.control.TextField;
|
|
||||||
import javafx.scene.image.Image;
|
|
||||||
import javafx.scene.image.ImageView;
|
|
||||||
import javafx.scene.control.TextField;
|
|
||||||
import javafx.scene.layout.AnchorPane;
|
|
||||||
import javafx.scene.layout.GridPane;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
import mock.app.Event;
|
|
||||||
import org.xml.sax.SAXException;
|
|
||||||
import mock.exceptions.EventConstructionException;
|
|
||||||
import shared.exceptions.InvalidBoatDataException;
|
|
||||||
import shared.exceptions.InvalidRaceDataException;
|
|
||||||
import shared.exceptions.InvalidRegattaDataException;
|
|
||||||
import shared.exceptions.XMLReaderException;
|
|
||||||
import visualiser.network.MatchBrowserInterface;
|
|
||||||
|
|
||||||
import javax.xml.bind.JAXBException;
|
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.DatagramSocket;
|
|
||||||
import java.net.Socket;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.ResourceBundle;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Controller for Hosting a game.
|
|
||||||
*/
|
|
||||||
public class HostController extends Controller {
|
|
||||||
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
TextField gameNameField;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
TextField hostNameField;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
AnchorPane hostWrapper;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
Button previousButton;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
Button nextButton;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
ImageView mapImage;
|
|
||||||
|
|
||||||
private Event game;
|
|
||||||
private DatagramSocket udpSocket;
|
|
||||||
|
|
||||||
private ArrayList<Image> listOfMaps;
|
|
||||||
private int currentMapIndex = 0;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initialize(URL location, ResourceBundle resources){
|
|
||||||
Image ac35Map = new Image(getClass().getClassLoader().getResourceAsStream("images/AC35_Racecourse_MAP.png"));
|
|
||||||
Image oMap = new Image(getClass().getClassLoader().getResourceAsStream("images/oMapLayout.png"));
|
|
||||||
Image iMap = new Image(getClass().getClassLoader().getResourceAsStream("images/iMapLayout.png"));
|
|
||||||
Image mMap = new Image(getClass().getClassLoader().getResourceAsStream("images/mMapLayout.png"));
|
|
||||||
|
|
||||||
listOfMaps = new ArrayList(Arrays.asList(ac35Map, oMap, iMap, mMap));
|
|
||||||
mapImage.setImage(listOfMaps.get(currentMapIndex));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hosts a game
|
|
||||||
*/
|
|
||||||
public void hostGamePressed() {
|
|
||||||
try {
|
|
||||||
this.game = new Event(false, currentMapIndex);
|
|
||||||
connectSocket("localhost", 4942);
|
|
||||||
alertMatchBrowser();
|
|
||||||
} catch (EventConstructionException e) {
|
|
||||||
Logger.getGlobal().log(Level.SEVERE, "Could not create Event.", e);
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sends info to the match browser so clients can see it
|
|
||||||
*/
|
|
||||||
public void alertMatchBrowser(){
|
|
||||||
MatchBrowserInterface matchBrowserInterface = new MatchBrowserInterface();
|
|
||||||
try{
|
|
||||||
matchBrowserInterface.startSendingHostData(this.game.getHostedGameData(), udpSocket);
|
|
||||||
}catch (IOException e){
|
|
||||||
System.err.println("failed to send out hosted game info");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void endEvent() throws IOException {
|
|
||||||
game.endEvent();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Connect to a socket
|
|
||||||
* @param address address of the server
|
|
||||||
* @param port port that the server is run off
|
|
||||||
*/
|
|
||||||
public void connectSocket(String address, int port) {
|
|
||||||
try{
|
|
||||||
Socket socket = new Socket(address, port);
|
|
||||||
hostWrapper.setVisible(false);
|
|
||||||
parent.enterGameLobby(socket, true);
|
|
||||||
} catch (IOException e) { /* Never reached */ }
|
|
||||||
}
|
|
||||||
|
|
||||||
public AnchorPane startWrapper(){
|
|
||||||
return hostWrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hosts a game.
|
|
||||||
*/
|
|
||||||
public void hostGame(DatagramSocket udpSocket){
|
|
||||||
mapImage.fitWidthProperty().bind(((Stage) mapImage.getScene().getWindow()).widthProperty().multiply(0.6));
|
|
||||||
hostWrapper.setVisible(true);
|
|
||||||
this.udpSocket = udpSocket;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void menuBtnPressed(){
|
|
||||||
hostWrapper.setVisible(false);
|
|
||||||
parent.enterTitle();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void nextImage(){
|
|
||||||
increaseIndex();
|
|
||||||
mapImage.setImage(listOfMaps.get(currentMapIndex));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void previousImage(){
|
|
||||||
decreaseIndex();
|
|
||||||
mapImage.setImage(listOfMaps.get(currentMapIndex));
|
|
||||||
}
|
|
||||||
private void increaseIndex(){
|
|
||||||
currentMapIndex = (currentMapIndex + 1)%listOfMaps.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void decreaseIndex(){
|
|
||||||
currentMapIndex = ((((currentMapIndex - 1)%listOfMaps.size())+listOfMaps.size())%listOfMaps.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGameType(int gameType){
|
|
||||||
this.currentMapIndex = gameType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getGameType(){ return this.currentMapIndex; }
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
package visualiser.Controllers;
|
||||||
|
|
||||||
|
import javafx.application.Platform;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.Alert;
|
||||||
|
import javafx.scene.control.ButtonType;
|
||||||
|
import javafx.scene.image.Image;
|
||||||
|
import javafx.scene.image.ImageView;
|
||||||
|
import mock.app.Event;
|
||||||
|
import mock.exceptions.EventConstructionException;
|
||||||
|
import visualiser.app.App;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.Socket;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller for Hosting a game.
|
||||||
|
*/
|
||||||
|
public class HostGameController extends Controller {
|
||||||
|
private @FXML ImageView mapImage;
|
||||||
|
private ArrayList<Image> listOfMaps;
|
||||||
|
private int currentMapIndex = 0;
|
||||||
|
|
||||||
|
public void initialize() {
|
||||||
|
loadMaps();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads in the list of playable maps to be selected from.
|
||||||
|
*/
|
||||||
|
private void loadMaps(){
|
||||||
|
// image preview of maps
|
||||||
|
Image ac35Map = new Image(getClass().getClassLoader().getResourceAsStream("images/AC35_Racecourse_MAP.png"));
|
||||||
|
Image oMap = new Image(getClass().getClassLoader().getResourceAsStream("images/oMapLayout.png"));
|
||||||
|
Image iMap = new Image(getClass().getClassLoader().getResourceAsStream("images/iMapLayout.png"));
|
||||||
|
Image mMap = new Image(getClass().getClassLoader().getResourceAsStream("images/mMapLayout.png"));
|
||||||
|
|
||||||
|
listOfMaps = new ArrayList(Arrays.asList(ac35Map, oMap, iMap, mMap));
|
||||||
|
mapImage.setImage(listOfMaps.get(currentMapIndex));
|
||||||
|
Platform.runLater(() -> {
|
||||||
|
mapImage.fitWidthProperty()
|
||||||
|
.bind(mapImage.getScene().getWindow().widthProperty().multiply(0.6));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hosts a game
|
||||||
|
*/
|
||||||
|
public void hostGamePressed() {
|
||||||
|
try {
|
||||||
|
App.game = new Event(false, currentMapIndex);
|
||||||
|
App.gameType = currentMapIndex;
|
||||||
|
connectSocket("localhost", 4942);
|
||||||
|
} catch (EventConstructionException e) {
|
||||||
|
Logger.getGlobal().log(Level.SEVERE, "Could not create Event.", e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connect to a socket
|
||||||
|
* @param address address of the server
|
||||||
|
* @param port port that the server is run off
|
||||||
|
*/
|
||||||
|
public void connectSocket(String address, int port) throws IOException {
|
||||||
|
Socket socket = new Socket(address, port);
|
||||||
|
RaceStartController rsc = (RaceStartController)loadScene("raceStart.fxml");
|
||||||
|
rsc.enterLobby(socket, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Menu button pressed. Prompt alert then return to menu
|
||||||
|
*/
|
||||||
|
public void menuBtnPressed() throws Exception {
|
||||||
|
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
|
||||||
|
alert.setTitle("Quitting race");
|
||||||
|
alert.setContentText("Do you wish to quit the race?");
|
||||||
|
alert.setHeaderText("You are about to quit the race");
|
||||||
|
Optional<ButtonType> result = alert.showAndWait();
|
||||||
|
if(result.get() == ButtonType.OK){
|
||||||
|
loadTitleScreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method called when the 'next' arrow button is pressed. It is used to
|
||||||
|
* change the currently displayed map preview to the next in the list.
|
||||||
|
*/
|
||||||
|
public void nextImage(){
|
||||||
|
// increase index
|
||||||
|
currentMapIndex = (currentMapIndex + 1) % listOfMaps.size();
|
||||||
|
// update map preview
|
||||||
|
mapImage.setImage(listOfMaps.get(currentMapIndex));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method called when the 'previous' arrow button is pressed. It is used to
|
||||||
|
* change the currently displayed map preview to the previous in the list.
|
||||||
|
*/
|
||||||
|
public void previousImage(){
|
||||||
|
// decrease index
|
||||||
|
currentMapIndex = ((((currentMapIndex - 1) % listOfMaps.size()) +
|
||||||
|
listOfMaps.size()) % listOfMaps.size());
|
||||||
|
// update map preview
|
||||||
|
mapImage.setImage(listOfMaps.get(currentMapIndex));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentMapIndex(Integer index){
|
||||||
|
this.currentMapIndex = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -87,7 +87,7 @@ public class InGameLobbyController extends Controller {
|
|||||||
|
|
||||||
private PopulatePlayers lobbyUpdateListener;
|
private PopulatePlayers lobbyUpdateListener;
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initialize(URL location, ResourceBundle resources) {
|
public void initialize(URL location, ResourceBundle resources) {
|
||||||
allPlayerLabels = new ArrayList(Arrays.asList(playerLabel, playerLabel2,
|
allPlayerLabels = new ArrayList(Arrays.asList(playerLabel, playerLabel2,
|
||||||
playerLabel3,
|
playerLabel3,
|
||||||
@@ -95,7 +95,7 @@ public class InGameLobbyController extends Controller {
|
|||||||
playerLabel5,
|
playerLabel5,
|
||||||
playerLabel6));
|
playerLabel6));
|
||||||
|
|
||||||
URL asset = HostController.class.getClassLoader().getResource("assets/V1.2 Complete Boat.stl");
|
URL asset = HostGameController.class.getClassLoader().getResource("assets/V1.2 Complete Boat.stl");
|
||||||
importer = new StlMeshImporter();
|
importer = new StlMeshImporter();
|
||||||
importer.read(asset);
|
importer.read(asset);
|
||||||
lobbyUpdateListener = new PopulatePlayers();
|
lobbyUpdateListener = new PopulatePlayers();
|
||||||
@@ -232,9 +232,16 @@ public class InGameLobbyController extends Controller {
|
|||||||
stop();
|
stop();
|
||||||
|
|
||||||
//Hide this, and display the race controller.
|
//Hide this, and display the race controller.
|
||||||
gameLobbyWrapper.setVisible(false);
|
try {
|
||||||
visualiserRaceEvent.getVisualiserRaceState().getBoats().removeListener(lobbyUpdateListener);
|
visualiserRaceEvent.getVisualiserRaceState().getBoats().removeListener(lobbyUpdateListener);
|
||||||
parent.beginRace(visualiserRaceEvent, controllerClient, isHost);
|
|
||||||
|
RaceViewController rvc = (RaceViewController)
|
||||||
|
loadScene("raceView.fxml");
|
||||||
|
rvc.startRace(visualiserRaceEvent, controllerClient,
|
||||||
|
isHost);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -273,9 +280,9 @@ public class InGameLobbyController extends Controller {
|
|||||||
alert.setHeaderText("You are about to quit the race");
|
alert.setHeaderText("You are about to quit the race");
|
||||||
Optional<ButtonType> result = alert.showAndWait();
|
Optional<ButtonType> result = alert.showAndWait();
|
||||||
if(result.get() == ButtonType.OK){
|
if(result.get() == ButtonType.OK){
|
||||||
visualiserRaceEvent.terminate();
|
try{
|
||||||
gameLobbyWrapper.setVisible(false);
|
loadScene("title.fxml");
|
||||||
parent.enterTitle();
|
}catch (IOException ignore){};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,6 @@ package visualiser.Controllers;
|
|||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.fxml.FXML;
|
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.Button;
|
||||||
import javafx.scene.control.ListView;
|
import javafx.scene.control.ListView;
|
||||||
import javafx.scene.input.KeyCode;
|
import javafx.scene.input.KeyCode;
|
||||||
@@ -20,12 +17,10 @@ import java.io.IOException;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static visualiser.app.App.keyFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller for the scene used to display and update current key bindings.
|
* Controller for the scene used to display and update current key bindings.
|
||||||
*/
|
*/
|
||||||
public class KeyBindingsController {
|
public class KeyBindingsController extends Controller {
|
||||||
private @FXML Button btnSave;
|
private @FXML Button btnSave;
|
||||||
private @FXML Button btnCancel;
|
private @FXML Button btnCancel;
|
||||||
private @FXML Button btnReset;
|
private @FXML Button btnReset;
|
||||||
@@ -33,23 +28,27 @@ public class KeyBindingsController {
|
|||||||
private @FXML ListView lstKey;
|
private @FXML ListView lstKey;
|
||||||
private @FXML ListView lstDescription;
|
private @FXML ListView lstDescription;
|
||||||
private @FXML AnchorPane anchor;
|
private @FXML AnchorPane anchor;
|
||||||
|
private KeyFactory existingKeyFactory;
|
||||||
private KeyFactory newKeyFactory;
|
private KeyFactory newKeyFactory;
|
||||||
private Boolean changed = false; // keyBindings have been modified
|
private Boolean changed = false; // keyBindings have been modified
|
||||||
private Button currentButton = null; // last button clicked
|
private Button currentButton = null; // last button clicked
|
||||||
|
|
||||||
public void initialize(){
|
public void initialize(){
|
||||||
// create new key factory to modify, keeping the existing one safe
|
// create new key factory to modify, keeping the existing one safe
|
||||||
|
existingKeyFactory = new KeyFactory();
|
||||||
|
existingKeyFactory.load();
|
||||||
newKeyFactory = copyExistingFactory();
|
newKeyFactory = copyExistingFactory();
|
||||||
initializeTable();
|
initializeTable();
|
||||||
populateTable();
|
populateTable();
|
||||||
setKeyListener();
|
setKeyListener();
|
||||||
|
setClosedListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up table before populating it.
|
* Sets up table before populating it.
|
||||||
* Set up includes headings, CSS styling and modifying default properties.
|
* Set up includes headings, CSS styling and modifying default properties.
|
||||||
*/
|
*/
|
||||||
public void initializeTable(){
|
private void initializeTable(){
|
||||||
// set the headings for each column
|
// set the headings for each column
|
||||||
lstKey.getItems().add("Key");
|
lstKey.getItems().add("Key");
|
||||||
lstControl.getItems().add("Command");
|
lstControl.getItems().add("Command");
|
||||||
@@ -67,15 +66,15 @@ public class KeyBindingsController {
|
|||||||
|
|
||||||
// stop the columns from being selectable, so only the buttons are
|
// stop the columns from being selectable, so only the buttons are
|
||||||
lstKey.getSelectionModel().selectedItemProperty()
|
lstKey.getSelectionModel().selectedItemProperty()
|
||||||
.addListener((observable, oldvalue, newValue) ->
|
.addListener((observable, oldValue, newValue) ->
|
||||||
Platform.runLater(() ->
|
Platform.runLater(() ->
|
||||||
lstKey.getSelectionModel().select(0)));
|
lstKey.getSelectionModel().select(0)));
|
||||||
lstDescription.getSelectionModel().selectedItemProperty()
|
lstDescription.getSelectionModel().selectedItemProperty()
|
||||||
.addListener((observable, oldvalue, newValue) ->
|
.addListener((observable, oldValue, newValue) ->
|
||||||
Platform.runLater(() ->
|
Platform.runLater(() ->
|
||||||
lstDescription.getSelectionModel().select(0)));
|
lstDescription.getSelectionModel().select(0)));
|
||||||
lstControl.getSelectionModel().selectedItemProperty()
|
lstControl.getSelectionModel().selectedItemProperty()
|
||||||
.addListener((observable, oldvalue, newValue) ->
|
.addListener((observable, oldValue, newValue) ->
|
||||||
Platform.runLater(() ->
|
Platform.runLater(() ->
|
||||||
lstControl.getSelectionModel().select(0)));
|
lstControl.getSelectionModel().select(0)));
|
||||||
}
|
}
|
||||||
@@ -83,7 +82,7 @@ public class KeyBindingsController {
|
|||||||
/**
|
/**
|
||||||
* Populates the table with commands and their key binding details.
|
* Populates the table with commands and their key binding details.
|
||||||
*/
|
*/
|
||||||
public void populateTable(){
|
private void populateTable(){
|
||||||
// add each command to the table
|
// add each command to the table
|
||||||
for (Map.Entry<String, ControlKey> entry : newKeyFactory.getKeyState().entrySet()) {
|
for (Map.Entry<String, ControlKey> entry : newKeyFactory.getKeyState().entrySet()) {
|
||||||
// create button for command
|
// create button for command
|
||||||
@@ -100,11 +99,11 @@ public class KeyBindingsController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes a copy of the {@link KeyFactory} that does not modify the original.
|
* Makes a copy of the {@link KeyFactory} that does not modify the original.
|
||||||
* @return new keyfactory to be modified
|
* @return new keyFactory to be modified
|
||||||
*/
|
*/
|
||||||
public KeyFactory copyExistingFactory(){
|
private KeyFactory copyExistingFactory(){
|
||||||
newKeyFactory = new KeyFactory();
|
newKeyFactory = new KeyFactory();
|
||||||
Map<String, ControlKey> oldKeyState = keyFactory.getKeyState();
|
Map<String, ControlKey> oldKeyState = existingKeyFactory.getKeyState();
|
||||||
Map<String, ControlKey> newKeyState = new HashMap<>();
|
Map<String, ControlKey> newKeyState = new HashMap<>();
|
||||||
|
|
||||||
// copy over commands and their keys
|
// copy over commands and their keys
|
||||||
@@ -116,11 +115,32 @@ public class KeyBindingsController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a listener for the base anchorpane for key presses.
|
* Creates a listener for when a user tries to close the current window.
|
||||||
|
*/
|
||||||
|
private void setClosedListener(){
|
||||||
|
anchor.sceneProperty().addListener((obsS, oldS, newS) -> {
|
||||||
|
if (newS != null) {
|
||||||
|
newS.windowProperty().addListener((obsW, oldW, newW) -> {
|
||||||
|
if (newW != null) {
|
||||||
|
Stage stage = (Stage)newW;
|
||||||
|
// WE is processed by onExit method
|
||||||
|
stage.setOnCloseRequest(we -> {
|
||||||
|
if (we.getEventType() == WindowEvent.WINDOW_CLOSE_REQUEST) {
|
||||||
|
onExit(we);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a listener for the base anchorPane for key presses.
|
||||||
* It updates the current key bindings of the {@link KeyFactory} if
|
* It updates the current key bindings of the {@link KeyFactory} if
|
||||||
* required.
|
* required.
|
||||||
*/
|
*/
|
||||||
public void setKeyListener(){
|
private void setKeyListener(){
|
||||||
anchor.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
|
anchor.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
|
||||||
// if esc, cancel current button click
|
// if esc, cancel current button click
|
||||||
if (event.getCode() == KeyCode.ESCAPE){
|
if (event.getCode() == KeyCode.ESCAPE){
|
||||||
@@ -179,10 +199,10 @@ public class KeyBindingsController {
|
|||||||
*/
|
*/
|
||||||
public void save(){
|
public void save(){
|
||||||
if (isFactoryValid()) {
|
if (isFactoryValid()) {
|
||||||
keyFactory = newKeyFactory;
|
existingKeyFactory = newKeyFactory;
|
||||||
newKeyFactory = new KeyFactory();
|
newKeyFactory = new KeyFactory();
|
||||||
changed = false;
|
changed = false;
|
||||||
keyFactory.save(); // save persistently
|
existingKeyFactory.save(); // save persistently
|
||||||
loadNotification("Key bindings were successfully saved.", false);
|
loadNotification("Key bindings were successfully saved.", false);
|
||||||
} else {
|
} else {
|
||||||
loadNotification("One or more key bindings are missing. " +
|
loadNotification("One or more key bindings are missing. " +
|
||||||
@@ -196,10 +216,10 @@ public class KeyBindingsController {
|
|||||||
* commands are missing a key binding.
|
* commands are missing a key binding.
|
||||||
* @return True if valid, false if invalid
|
* @return True if valid, false if invalid
|
||||||
*/
|
*/
|
||||||
public Boolean isFactoryValid(){
|
private Boolean isFactoryValid(){
|
||||||
for (Map.Entry<String, ControlKey> entry : newKeyFactory.getKeyState().entrySet
|
for (Map.Entry<String, ControlKey> entry : newKeyFactory.getKeyState().entrySet
|
||||||
()) {
|
()) {
|
||||||
if (entry.getKey().toString()==entry.getValue().toString()){
|
if (entry.getKey().equals(entry.getValue().toString())){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -212,7 +232,7 @@ public class KeyBindingsController {
|
|||||||
* @param we {@link WindowEvent} close request to be consumed if settings
|
* @param we {@link WindowEvent} close request to be consumed if settings
|
||||||
* have not been successfully saved.
|
* have not been successfully saved.
|
||||||
*/
|
*/
|
||||||
public void onExit(WindowEvent we){
|
private void onExit(WindowEvent we){
|
||||||
// if modified KeyFactory hasn't been saved
|
// if modified KeyFactory hasn't been saved
|
||||||
if (changed){
|
if (changed){
|
||||||
loadNotification("Please cancel or save your changes before exiting" +
|
loadNotification("Please cancel or save your changes before exiting" +
|
||||||
@@ -226,23 +246,15 @@ public class KeyBindingsController {
|
|||||||
* @param message the message to be displayed to the user
|
* @param message the message to be displayed to the user
|
||||||
* @param warning true if the message to be displayed is due to user error
|
* @param warning true if the message to be displayed is due to user error
|
||||||
*/
|
*/
|
||||||
public void loadNotification(String message, Boolean warning){
|
private void loadNotification(String message, Boolean warning){
|
||||||
Parent root = null;
|
|
||||||
FXMLLoader loader = new FXMLLoader(getClass().getResource
|
|
||||||
("/visualiser/scenes/notification.fxml"));
|
|
||||||
try {
|
try {
|
||||||
root = loader.load();
|
NotificationController nc = (NotificationController)
|
||||||
|
loadPopupScene("notification.fxml",
|
||||||
|
"", Modality.APPLICATION_MODAL);
|
||||||
|
nc.setMessage(message, warning);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
NotificationController controller = loader.getController();
|
|
||||||
Stage stage = new Stage();
|
|
||||||
stage.setScene(new Scene(root));
|
|
||||||
stage.centerOnScreen();
|
|
||||||
stage.initModality(Modality.APPLICATION_MODAL);
|
|
||||||
stage.show();
|
|
||||||
// displays given message in the window
|
|
||||||
controller.setMessage(message, warning);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,26 +27,15 @@ import java.util.ResourceBundle;
|
|||||||
* Controller for the Lobby for entering games
|
* Controller for the Lobby for entering games
|
||||||
*/
|
*/
|
||||||
public class LobbyController extends Controller {
|
public class LobbyController extends Controller {
|
||||||
|
private @FXML TableView<RaceConnection> lobbyTable;
|
||||||
@FXML
|
private @FXML TableColumn<RaceConnection, String> gameNameColumn;
|
||||||
private AnchorPane lobbyWrapper;
|
private @FXML TableColumn<RaceConnection, String> hostNameColumn;
|
||||||
@FXML
|
private @FXML TableColumn<RaceConnection, String> statusColumn;
|
||||||
private TableView<RaceConnection> lobbyTable;
|
private @FXML Button joinGameBtn;
|
||||||
@FXML
|
private @FXML TextField addressFld;
|
||||||
private TableColumn<RaceConnection, String> gameNameColumn;
|
private @FXML TextField portFld;
|
||||||
@FXML
|
|
||||||
private TableColumn<RaceConnection, String> hostNameColumn;
|
|
||||||
@FXML
|
|
||||||
private TableColumn<RaceConnection, String> statusColumn;
|
|
||||||
@FXML
|
|
||||||
private Button joinGameBtn;
|
|
||||||
@FXML
|
|
||||||
private TextField addressFld;
|
|
||||||
@FXML
|
|
||||||
private TextField portFld;
|
|
||||||
|
|
||||||
private ObservableList<RaceConnection> connections;
|
private ObservableList<RaceConnection> connections;
|
||||||
|
|
||||||
private ObservableList<RaceConnection> customConnections;
|
private ObservableList<RaceConnection> customConnections;
|
||||||
|
|
||||||
//the socket for match browser
|
//the socket for match browser
|
||||||
@@ -54,15 +43,13 @@ public class LobbyController extends Controller {
|
|||||||
|
|
||||||
private MatchBrowserLobbyInterface matchBrowserLobbyInterface;
|
private MatchBrowserLobbyInterface matchBrowserLobbyInterface;
|
||||||
|
|
||||||
|
public void initialize() {
|
||||||
@Override
|
// set up the connection table
|
||||||
public void initialize(URL location, ResourceBundle resources) {
|
|
||||||
connections = FXCollections.observableArrayList();
|
connections = FXCollections.observableArrayList();
|
||||||
customConnections = FXCollections.observableArrayList();
|
customConnections = FXCollections.observableArrayList();
|
||||||
//connections.add(new RaceConnection("localhost", 4942, "Local Game"));
|
//connections.add(new RaceConnection("localhost", 4942, "Local Game"));
|
||||||
|
|
||||||
lobbyTable.setItems(connections);
|
lobbyTable.setItems(connections);
|
||||||
|
|
||||||
gameNameColumn.setCellValueFactory(cellData -> cellData.getValue().gamenameProperty());
|
gameNameColumn.setCellValueFactory(cellData -> cellData.getValue().gamenameProperty());
|
||||||
hostNameColumn.setCellValueFactory(cellData -> cellData.getValue().hostnameProperty());
|
hostNameColumn.setCellValueFactory(cellData -> cellData.getValue().hostnameProperty());
|
||||||
statusColumn.setCellValueFactory(cellData -> cellData.getValue().statusProperty());
|
statusColumn.setCellValueFactory(cellData -> cellData.getValue().statusProperty());
|
||||||
@@ -70,8 +57,7 @@ public class LobbyController extends Controller {
|
|||||||
lobbyTable.getSelectionModel().selectedItemProperty().addListener((obs, prev, curr) -> {
|
lobbyTable.getSelectionModel().selectedItemProperty().addListener((obs, prev, curr) -> {
|
||||||
if (curr != null && curr.statusProperty().getValue().equals("Ready")) {
|
if (curr != null && curr.statusProperty().getValue().equals("Ready")) {
|
||||||
joinGameBtn.setDisable(false);
|
joinGameBtn.setDisable(false);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
joinGameBtn.setDisable(true);
|
joinGameBtn.setDisable(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -92,27 +78,22 @@ public class LobbyController extends Controller {
|
|||||||
} else {
|
} else {
|
||||||
joinGameBtn.setDisable(true);
|
joinGameBtn.setDisable(true);
|
||||||
}
|
}
|
||||||
} catch (Exception e){}
|
} catch (Exception ignored){}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connect to a connection.
|
* Connect to a connection.
|
||||||
*/
|
*/
|
||||||
public void connectSocket() {
|
public void connectSocket() throws IOException {
|
||||||
try{
|
|
||||||
RaceConnection connection = lobbyTable.getSelectionModel().getSelectedItem();
|
RaceConnection connection = lobbyTable.getSelectionModel().getSelectedItem();
|
||||||
Socket socket = new Socket(connection.getHostname(), connection.getPort());
|
Socket socket = new Socket(connection.getHostname(), connection.getPort());
|
||||||
lobbyWrapper.setVisible(false);
|
InGameLobbyController iglc = (InGameLobbyController)loadScene("gameLobby.fxml");
|
||||||
parent.enterGameLobby(socket, false);
|
iglc.enterGameLobby(socket, false);
|
||||||
} catch (IOException e) { /* Never reached */
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void menuBtnPressed(){
|
public void menuBtnPressed() throws IOException {
|
||||||
matchBrowserLobbyInterface.closeSocket();
|
matchBrowserLobbyInterface.closeSocket();
|
||||||
lobbyWrapper.setVisible(false);
|
loadScene("title.fxml");
|
||||||
parent.enterTitle();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -132,15 +113,7 @@ public class LobbyController extends Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public AnchorPane startWrapper(){
|
public void setupSocket(DatagramSocket udpSocket){
|
||||||
return lobbyWrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enter the lobby page.
|
|
||||||
*/
|
|
||||||
public void enterLobby(DatagramSocket udpSocket){
|
|
||||||
lobbyWrapper.setVisible(true);
|
|
||||||
this.udpSocket = udpSocket;
|
this.udpSocket = udpSocket;
|
||||||
matchBrowserLobbyInterface = new MatchBrowserLobbyInterface();
|
matchBrowserLobbyInterface = new MatchBrowserLobbyInterface();
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1,168 +0,0 @@
|
|||||||
package visualiser.Controllers;
|
|
||||||
|
|
||||||
import javafx.collections.ObservableList;
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.scene.layout.AnchorPane;
|
|
||||||
import visualiser.gameController.ControllerClient;
|
|
||||||
import visualiser.model.VisualiserBoat;
|
|
||||||
import visualiser.model.VisualiserRaceEvent;
|
|
||||||
import visualiser.network.MatchBrowserInterface;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.DatagramSocket;
|
|
||||||
import java.net.Socket;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ResourceBundle;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Controller that everything is overlayed onto. This makes it so that changing scenes does not resize your stage.
|
|
||||||
*/
|
|
||||||
public class MainController extends Controller {
|
|
||||||
|
|
||||||
@FXML private StartController startController;
|
|
||||||
@FXML private RaceController raceController;
|
|
||||||
@FXML private ConnectionController connectionController;
|
|
||||||
@FXML private FinishController finishController;
|
|
||||||
@FXML private TitleController titleController;
|
|
||||||
@FXML private HostController hostController;
|
|
||||||
@FXML private LobbyController lobbyController;
|
|
||||||
@FXML private InGameLobbyController inGameLobbyController;
|
|
||||||
|
|
||||||
private MatchBrowserInterface matchBrowserInterface;
|
|
||||||
private DatagramSocket udpSocket;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ctor.
|
|
||||||
*/
|
|
||||||
public MainController() {
|
|
||||||
this.matchBrowserInterface = new MatchBrowserInterface();
|
|
||||||
try{
|
|
||||||
this.udpSocket = matchBrowserInterface.setupMatchBrowserConnection();
|
|
||||||
}catch (IOException e){
|
|
||||||
System.err.println("Error in setting up connection with match browser");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transitions from the StartController screen (displays pre-race information) to the RaceController (displays the actual race).
|
|
||||||
* @param visualiserRace The object modelling the race.
|
|
||||||
* @param controllerClient Socket Client that manipulates the controller.
|
|
||||||
* @param isHost if the client is the host of a race or not.
|
|
||||||
*/
|
|
||||||
public void beginRace(VisualiserRaceEvent visualiserRace, ControllerClient controllerClient, Boolean isHost) {
|
|
||||||
raceController.startRace(visualiserRace, controllerClient, isHost);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void endEvent() throws IOException { hostController.endEvent(); }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transitions from the server selection screen to the pre-race lobby for a given server.
|
|
||||||
* @param socket The server to read data from.
|
|
||||||
* @param isHost is connection a host
|
|
||||||
*/
|
|
||||||
public void enterGameLobby(Socket socket, Boolean isHost) {
|
|
||||||
inGameLobbyController.enterGameLobby(socket, isHost);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transitions from the server selection screen to the pre-race lobby for a given server.
|
|
||||||
* @param socket The server to read data from.
|
|
||||||
* @param isHost is connection a host
|
|
||||||
*/
|
|
||||||
public void enterLobby(Socket socket, Boolean isHost) {
|
|
||||||
startController.enterLobby(socket, isHost);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transitions from the {@link RaceController} screen to the {@link FinishController} screen.
|
|
||||||
* @param boats The boats to display on the finish screen.
|
|
||||||
*/
|
|
||||||
public void enterFinish(ObservableList<VisualiserBoat> boats) {
|
|
||||||
finishController.enterFinish(boats);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transitions into the title screen
|
|
||||||
*/
|
|
||||||
public void enterTitle() {
|
|
||||||
titleController.enterTitle();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transitions into lobby screen
|
|
||||||
*/
|
|
||||||
public void enterLobby(){ lobbyController.enterLobby(udpSocket); }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transitions into host game screen
|
|
||||||
*/
|
|
||||||
public void hostGame(){ hostController.hostGame(udpSocket); }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets up the css for the start of the program
|
|
||||||
*/
|
|
||||||
public void startCss(){titleController.setDayMode();}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* host controller host a game
|
|
||||||
* @throws IOException throws exception
|
|
||||||
*/
|
|
||||||
public void beginGame() throws IOException {
|
|
||||||
hostController.hostGamePressed();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGameType(int gameType){
|
|
||||||
hostController.setGameType(gameType);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getGameType(){ return hostController.getGameType(); }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Main Controller for the applications will house the menu and the displayed pane.
|
|
||||||
*
|
|
||||||
* @param location of resources
|
|
||||||
* @param resources bundle
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void initialize(URL location, ResourceBundle resources) {
|
|
||||||
|
|
||||||
startController.setParent(this);
|
|
||||||
raceController.setParent(this);
|
|
||||||
connectionController.setParent(this);
|
|
||||||
finishController.setParent(this);
|
|
||||||
titleController.setParent(this);
|
|
||||||
hostController.setParent(this);
|
|
||||||
lobbyController.setParent(this);
|
|
||||||
inGameLobbyController.setParent(this);
|
|
||||||
|
|
||||||
|
|
||||||
AnchorPane.setTopAnchor(inGameLobbyController.gameLobbyWrapper(), 0.0);
|
|
||||||
AnchorPane.setBottomAnchor(inGameLobbyController.gameLobbyWrapper(), 0.0);
|
|
||||||
AnchorPane.setLeftAnchor(inGameLobbyController.gameLobbyWrapper(), 0.0);
|
|
||||||
AnchorPane.setRightAnchor(inGameLobbyController.gameLobbyWrapper(), 0.0);
|
|
||||||
|
|
||||||
AnchorPane.setTopAnchor(lobbyController.startWrapper(), 0.0);
|
|
||||||
AnchorPane.setBottomAnchor(lobbyController.startWrapper(), 0.0);
|
|
||||||
AnchorPane.setLeftAnchor(lobbyController.startWrapper(), 0.0);
|
|
||||||
AnchorPane.setRightAnchor(lobbyController.startWrapper(), 0.0);
|
|
||||||
|
|
||||||
AnchorPane.setTopAnchor(hostController.startWrapper(), 0.0);
|
|
||||||
AnchorPane.setBottomAnchor(hostController.startWrapper(), 0.0);
|
|
||||||
AnchorPane.setLeftAnchor(hostController.startWrapper(), 0.0);
|
|
||||||
AnchorPane.setRightAnchor(hostController.startWrapper(), 0.0);
|
|
||||||
|
|
||||||
AnchorPane.setTopAnchor(finishController.finishWrapper, 0.0);
|
|
||||||
AnchorPane.setBottomAnchor(finishController.finishWrapper, 0.0);
|
|
||||||
AnchorPane.setLeftAnchor(finishController.finishWrapper, 0.0);
|
|
||||||
AnchorPane.setRightAnchor(finishController.finishWrapper, 0.0);
|
|
||||||
|
|
||||||
AnchorPane.setTopAnchor(titleController.titleWrapper, 0.0);
|
|
||||||
AnchorPane.setBottomAnchor(titleController.titleWrapper, 0.0);
|
|
||||||
AnchorPane.setLeftAnchor(titleController.titleWrapper, 0.0);
|
|
||||||
AnchorPane.setRightAnchor(titleController.titleWrapper, 0.0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -9,7 +9,7 @@ import javafx.stage.Stage;
|
|||||||
/**
|
/**
|
||||||
* Controller for a popup notification regarding user activity.
|
* Controller for a popup notification regarding user activity.
|
||||||
*/
|
*/
|
||||||
public class NotificationController {
|
public class NotificationController extends Controller{
|
||||||
private @FXML Label lblDescription;
|
private @FXML Label lblDescription;
|
||||||
private @FXML Text txtMessage;
|
private @FXML Text txtMessage;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package visualiser.Controllers;
|
||||||
|
|
||||||
|
import javafx.collections.ObservableList;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.TableColumn;
|
||||||
|
import javafx.scene.control.TableView;
|
||||||
|
import visualiser.model.VisualiserBoat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finish Screen for when the race finishes.
|
||||||
|
*/
|
||||||
|
public class RaceFinishController extends Controller {
|
||||||
|
private @FXML TableView<VisualiserBoat> boatInfoTable;
|
||||||
|
private @FXML TableColumn<VisualiserBoat, String> boatRankColumn;
|
||||||
|
private @FXML TableColumn<VisualiserBoat, String> boatNameColumn;
|
||||||
|
private @FXML Label raceWinnerLabel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the table
|
||||||
|
* @param boats boats to display on the table.
|
||||||
|
*/
|
||||||
|
public void loadFinish(ObservableList<VisualiserBoat> boats) {
|
||||||
|
// set table contents
|
||||||
|
boatInfoTable.setItems(boats);
|
||||||
|
//Name.
|
||||||
|
boatNameColumn.setCellValueFactory(cellData -> cellData.getValue().nameProperty());
|
||||||
|
//Rank/position.
|
||||||
|
boatRankColumn.setCellValueFactory(cellData -> cellData.getValue().placingProperty());
|
||||||
|
|
||||||
|
//Winner label.
|
||||||
|
if (boats.size() > 0) {
|
||||||
|
raceWinnerLabel.setText("Winner: " +
|
||||||
|
boatNameColumn.getCellObservableValue(0).getValue());
|
||||||
|
raceWinnerLabel.setWrapText(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,141 @@
|
|||||||
|
package visualiser.Controllers;
|
||||||
|
|
||||||
|
import javafx.animation.AnimationTimer;
|
||||||
|
import javafx.application.Platform;
|
||||||
|
import javafx.collections.ObservableList;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.TableColumn;
|
||||||
|
import javafx.scene.control.TableView;
|
||||||
|
import network.Messages.Enums.RaceStatusEnum;
|
||||||
|
import network.Messages.Enums.RequestToJoinEnum;
|
||||||
|
import visualiser.gameController.ControllerClient;
|
||||||
|
import visualiser.model.VisualiserBoat;
|
||||||
|
import visualiser.model.VisualiserRaceEvent;
|
||||||
|
import visualiser.model.VisualiserRaceState;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.Socket;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller to for waiting for the race to start.
|
||||||
|
*/
|
||||||
|
public class RaceStartController extends Controller {
|
||||||
|
private @FXML Label raceTitleLabel;
|
||||||
|
private @FXML Label raceStartLabel;
|
||||||
|
private @FXML Label timeZoneTime;
|
||||||
|
private @FXML Label timer;
|
||||||
|
private @FXML TableView<VisualiserBoat> boatNameTable;
|
||||||
|
private @FXML TableColumn<VisualiserBoat, String> boatNameColumn;
|
||||||
|
private @FXML TableColumn<VisualiserBoat, String> boatCodeColumn;
|
||||||
|
private @FXML Label raceStatusLabel;
|
||||||
|
|
||||||
|
private VisualiserRaceEvent visualiserRaceEvent;
|
||||||
|
private VisualiserRaceState raceState;
|
||||||
|
private ControllerClient controllerClient;
|
||||||
|
private boolean isHost;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show starting information for a race given a socket.
|
||||||
|
* Intended to be called on loading the scene.
|
||||||
|
* @param socket network source of information
|
||||||
|
* @param isHost is user a host
|
||||||
|
*/
|
||||||
|
public void enterLobby(Socket socket, Boolean isHost) {
|
||||||
|
try {
|
||||||
|
this.isHost = isHost;
|
||||||
|
this.visualiserRaceEvent = new VisualiserRaceEvent(socket, RequestToJoinEnum.PARTICIPANT);
|
||||||
|
this.controllerClient = visualiserRaceEvent.getControllerClient();
|
||||||
|
this.raceState = visualiserRaceEvent.getVisualiserRaceState();
|
||||||
|
showRaceDetails();
|
||||||
|
} catch (IOException e) {
|
||||||
|
//TODO should probably let this propagate, so that we only enter this scene if everything works
|
||||||
|
Logger.getGlobal()
|
||||||
|
.log(Level.WARNING, "Could not connect to server.", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays details and starts the timer for the race being started
|
||||||
|
*/
|
||||||
|
private void showRaceDetails() {
|
||||||
|
raceTitleLabel.setText(this.raceState.getRegattaName());
|
||||||
|
initialiseBoatTable();
|
||||||
|
initialiseRaceClock();
|
||||||
|
countdownTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialises the boat table that is to be shown on the pane.
|
||||||
|
*/
|
||||||
|
private void initialiseBoatTable() {
|
||||||
|
//Get the boats.
|
||||||
|
ObservableList<VisualiserBoat> boats =
|
||||||
|
this.raceState.getBoats();
|
||||||
|
|
||||||
|
//Populate table.
|
||||||
|
boatNameTable.setItems(boats);
|
||||||
|
boatNameColumn.setCellValueFactory(cellData -> cellData.getValue().nameProperty());
|
||||||
|
boatCodeColumn.setCellValueFactory(cellData -> cellData.getValue().countryProperty());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialises the race clock/timer labels for the start time, current time, and remaining time.
|
||||||
|
*/
|
||||||
|
private void initialiseRaceClock() {
|
||||||
|
raceStartLabel.setText(
|
||||||
|
this.raceState.getRaceClock().getStartingTimeString());
|
||||||
|
|
||||||
|
// init clock start time
|
||||||
|
this.raceState.getRaceClock().startingTimeProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
|
Platform.runLater(() -> {
|
||||||
|
raceStartLabel.setText(newValue);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// init clock current time
|
||||||
|
this.raceState.getRaceClock().currentTimeProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
|
Platform.runLater(() -> {
|
||||||
|
timeZoneTime.setText(newValue);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// init clock remaining time
|
||||||
|
this.raceState.getRaceClock().durationProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
|
Platform.runLater(() -> {
|
||||||
|
timer.setText(newValue);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Countdown timer until race starts.
|
||||||
|
*/
|
||||||
|
private void countdownTimer() {
|
||||||
|
new AnimationTimer() {
|
||||||
|
@Override
|
||||||
|
public void handle(long arg0) {
|
||||||
|
// display current race status
|
||||||
|
RaceStatusEnum raceStatus = raceState.getRaceStatusEnum();
|
||||||
|
raceStatusLabel.setText("Race Status: " + raceStatus.name());
|
||||||
|
|
||||||
|
// if race is in PREPARATORY or STARTED status
|
||||||
|
if (raceStatus == RaceStatusEnum.PREPARATORY || raceStatus == RaceStatusEnum.STARTED) {
|
||||||
|
stop(); // stop this timer
|
||||||
|
// load up the race scene
|
||||||
|
try {
|
||||||
|
RaceViewController rvc = (RaceViewController)
|
||||||
|
loadScene("raceView.fxml");
|
||||||
|
rvc.startRace(visualiserRaceEvent, controllerClient,
|
||||||
|
isHost);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+138
-268
@@ -12,7 +12,6 @@ import javafx.scene.chart.LineChart;
|
|||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.input.KeyCode;
|
import javafx.scene.input.KeyCode;
|
||||||
import javafx.scene.input.KeyEvent;
|
import javafx.scene.input.KeyEvent;
|
||||||
import javafx.scene.layout.AnchorPane;
|
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import javafx.scene.shape.MeshView;
|
import javafx.scene.shape.MeshView;
|
||||||
@@ -27,96 +26,112 @@ import visualiser.app.App;
|
|||||||
import visualiser.enums.TutorialState;
|
import visualiser.enums.TutorialState;
|
||||||
import visualiser.gameController.ControllerClient;
|
import visualiser.gameController.ControllerClient;
|
||||||
import visualiser.gameController.Keys.ControlKey;
|
import visualiser.gameController.Keys.ControlKey;
|
||||||
|
import visualiser.gameController.Keys.KeyFactory;
|
||||||
import visualiser.layout.Subject3D;
|
import visualiser.layout.Subject3D;
|
||||||
import visualiser.layout.View3D;
|
import visualiser.layout.View3D;
|
||||||
import visualiser.model.*;
|
import visualiser.model.Sparkline;
|
||||||
|
import visualiser.model.VisualiserBoat;
|
||||||
|
import visualiser.model.VisualiserRaceEvent;
|
||||||
|
import visualiser.model.VisualiserRaceState;
|
||||||
import visualiser.utils.GPSConverter;
|
import visualiser.utils.GPSConverter;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import static visualiser.app.App.keyFactory;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller used to display a running race.
|
* Controller used to display a running race.
|
||||||
*/
|
*/
|
||||||
public class RaceController extends Controller {
|
public class RaceViewController extends Controller {
|
||||||
/**
|
|
||||||
* The race object which describes the currently occurring race.
|
|
||||||
*/
|
|
||||||
private VisualiserRaceEvent visualiserRace;
|
private VisualiserRaceEvent visualiserRace;
|
||||||
|
private VisualiserRaceState raceState;
|
||||||
/**
|
|
||||||
* Service for sending keystrokes to server
|
|
||||||
*/
|
|
||||||
private ControllerClient controllerClient;
|
private ControllerClient controllerClient;
|
||||||
|
private KeyFactory keyFactory = new KeyFactory();
|
||||||
|
private boolean infoTableShow = true; // shown or hidden
|
||||||
private boolean isHost;
|
private boolean isHost;
|
||||||
|
|
||||||
private TutorialState currentState;
|
private TutorialState currentState;
|
||||||
|
|
||||||
private ArrayList<TutorialState> tutorialStates;
|
private ArrayList<TutorialState> tutorialStates;
|
||||||
|
|
||||||
private boolean isTutorial = false;
|
private boolean isTutorial = false;
|
||||||
|
|
||||||
private String keyToPress;
|
private String keyToPress;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* state of the info table
|
|
||||||
*/
|
|
||||||
private boolean infoTableShow;
|
|
||||||
|
|
||||||
private View3D view3D;
|
private View3D view3D;
|
||||||
private ObservableList<Subject3D> viewSubjects;
|
private ObservableList<Subject3D> viewSubjects;
|
||||||
|
|
||||||
/**
|
// note: it says it's not used but it is! do not remove :)
|
||||||
* The arrow controller.
|
private @FXML ArrowController arrowController;
|
||||||
*/
|
private @FXML GridPane canvasBase;
|
||||||
@FXML private ArrowController arrowController;
|
private @FXML SplitPane racePane;
|
||||||
|
private @FXML StackPane arrowPane;
|
||||||
@FXML private GridPane canvasBase;
|
private @FXML Label timer;
|
||||||
|
private @FXML Label FPS;
|
||||||
@FXML private SplitPane racePane;
|
private @FXML Label timeZone;
|
||||||
|
private @FXML CheckBox showFPS;
|
||||||
@FXML private Label tutorialText;
|
private @FXML TableView<VisualiserBoat> boatInfoTable;
|
||||||
|
private @FXML TableColumn<VisualiserBoat, String> boatPlacingColumn;
|
||||||
|
private @FXML TableColumn<VisualiserBoat, String> boatTeamColumn;
|
||||||
|
private @FXML TableColumn<VisualiserBoat, Leg> boatMarkColumn;
|
||||||
|
private @FXML TableColumn<VisualiserBoat, Number> boatSpeedColumn;
|
||||||
|
private @FXML LineChart<Number, Number> sparklineChart;
|
||||||
|
private @FXML Label tutorialText;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the pane we place the actual arrow control inside of.
|
* Displays a specified race.
|
||||||
|
* Intended to be called on loading the scene.
|
||||||
|
* @param visualiserRace Object modelling the race.
|
||||||
|
* @param controllerClient Socket Client that manipulates the controller.
|
||||||
|
* @param isHost is user a host
|
||||||
*/
|
*/
|
||||||
@FXML private StackPane arrowPane;
|
public void startRace(VisualiserRaceEvent visualiserRace, ControllerClient controllerClient, Boolean isHost) {
|
||||||
@FXML private Label timer;
|
this.visualiserRace = visualiserRace;
|
||||||
@FXML private Label FPS;
|
this.raceState = visualiserRace.getVisualiserRaceState();
|
||||||
@FXML private Label timeZone;
|
this.controllerClient = controllerClient;
|
||||||
@FXML private CheckBox showFPS;
|
this.isHost = isHost;
|
||||||
@FXML private TableView<VisualiserBoat> boatInfoTable;
|
keyFactory.load();
|
||||||
@FXML private TableColumn<VisualiserBoat, String> boatPlacingColumn;
|
|
||||||
@FXML private TableColumn<VisualiserBoat, String> boatTeamColumn;
|
|
||||||
@FXML private TableColumn<VisualiserBoat, Leg> boatMarkColumn;
|
|
||||||
@FXML private TableColumn<VisualiserBoat, Number> boatSpeedColumn;
|
|
||||||
@FXML private LineChart<Number, Number> sparklineChart;
|
|
||||||
|
|
||||||
/**
|
tutorialCheck();
|
||||||
* Ctor.
|
initKeypressHandler();
|
||||||
*/
|
initialiseRaceVisuals();
|
||||||
public RaceController() {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
public void initialize(URL location, ResourceBundle resources) {
|
* Checks if the current game is a tutorial race and sets up initial
|
||||||
infoTableShow = true;
|
* tutorial displays if it is.
|
||||||
|
*/
|
||||||
|
private void tutorialCheck(){
|
||||||
|
if (App.gameType == 4) {
|
||||||
|
isTutorial = true;
|
||||||
|
tutorialText.setVisible(true);
|
||||||
|
tutorialStates = new ArrayList<>(Arrays.asList(TutorialState.values()));
|
||||||
|
|
||||||
// Initialise keyboard handler
|
currentState = tutorialStates.get(0);
|
||||||
|
tutorialStates.remove(0);
|
||||||
|
searchMapForKey("Upwind");
|
||||||
|
|
||||||
|
tutorialText.setText(
|
||||||
|
"Welcome to the tutorial! Exit at anytime with ESC. \nWe will first learn how to turn upwind. Press " +
|
||||||
|
keyToPress + " to turn upwind.");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
isTutorial = false;
|
||||||
|
tutorialText.setVisible(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets up the listener and actions that occur when a key is pressed.
|
||||||
|
*/
|
||||||
|
private void initKeypressHandler() {
|
||||||
racePane.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
|
racePane.addEventFilter(KeyEvent.KEY_PRESSED, event -> {
|
||||||
String codeString = event.getCode().toString();
|
String codeString = event.getCode().toString();
|
||||||
|
|
||||||
|
// tab key
|
||||||
if (codeString.equals("TAB")){toggleTable();}
|
if (codeString.equals("TAB")){toggleTable();}
|
||||||
|
|
||||||
|
// any key pressed
|
||||||
ControlKey controlKey = keyFactory.getKey(codeString);
|
ControlKey controlKey = keyFactory.getKey(codeString);
|
||||||
if(controlKey != null) {
|
if(controlKey != null) {
|
||||||
try {
|
try {
|
||||||
@@ -135,15 +150,15 @@ public class RaceController extends Controller {
|
|||||||
event.consume();
|
event.consume();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
|
Logger.getGlobal().log(Level.WARNING, "RaceViewController was interrupted on thread: " + Thread.currentThread() + "while sending: " + controlKey, e);
|
||||||
Logger.getGlobal().log(Level.WARNING, "RaceController was interrupted on thread: " + Thread.currentThread() + "while sending: " + controlKey, e);
|
Logger.getGlobal().log(Level.WARNING, "RaceController was interrupted on thread: " + Thread.currentThread() + "while sending: " + controlKey, e);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// escape key
|
||||||
if(event.getCode() == KeyCode.ESCAPE) {
|
if(event.getCode() == KeyCode.ESCAPE) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (isHost) {
|
if (isHost) {
|
||||||
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
|
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
|
||||||
@@ -151,9 +166,8 @@ public class RaceController extends Controller {
|
|||||||
alert.setContentText("Do you wish to quit the race? You are the host");
|
alert.setContentText("Do you wish to quit the race? You are the host");
|
||||||
Optional<ButtonType> result = alert.showAndWait();
|
Optional<ButtonType> result = alert.showAndWait();
|
||||||
if (result.get() == ButtonType.OK) {
|
if (result.get() == ButtonType.OK) {
|
||||||
parent.endEvent();
|
App.game.endEvent();
|
||||||
racePane.setVisible(false);
|
loadTitleScreen();
|
||||||
App.app.showMainStage(App.getStage());
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
|
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
|
||||||
@@ -161,12 +175,9 @@ public class RaceController extends Controller {
|
|||||||
alert.setContentText("Do you wish to quit the race?");
|
alert.setContentText("Do you wish to quit the race?");
|
||||||
Optional<ButtonType> result = alert.showAndWait();
|
Optional<ButtonType> result = alert.showAndWait();
|
||||||
if (result.get() == ButtonType.OK) {
|
if (result.get() == ButtonType.OK) {
|
||||||
racePane.setVisible(false);
|
loadTitleScreen();
|
||||||
App.app.showMainStage(App.getStage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -174,37 +185,27 @@ public class RaceController extends Controller {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialises the various UI components to listen to the {@link #visualiserRace}.
|
* Initialises the various UI components to listen to the {@link #visualiserRace}.
|
||||||
*/
|
*/
|
||||||
private void initialiseRace() {
|
private void initialiseRaceVisuals() {
|
||||||
//Fps display.
|
// initialise displays
|
||||||
initialiseFps(this.visualiserRace);
|
initialiseFps();
|
||||||
|
initialiseInfoTable();
|
||||||
//Information table.
|
initialiseView3D();
|
||||||
initialiseInfoTable(this.visualiserRace);
|
initialiseRaceClock();
|
||||||
|
raceTimer(); // start the timer
|
||||||
//Arrow.
|
new Sparkline(this.raceState, this.sparklineChart);
|
||||||
initialiseArrow(this.visualiserRace);
|
timeZone.setText(this.raceState.getRaceClock().getTimeZone());
|
||||||
|
arrowController.setWindProperty(this.raceState.windProperty());
|
||||||
initialiseView3D(this.visualiserRace);
|
|
||||||
|
|
||||||
//Race timezone label.
|
|
||||||
initialiseRaceTimezoneLabel(this.visualiserRace);
|
|
||||||
|
|
||||||
//Race clock.
|
|
||||||
initialiseRaceClock(this.visualiserRace);
|
|
||||||
|
|
||||||
//Start the race animation timer.
|
|
||||||
raceTimer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initialiseView3D(VisualiserRaceEvent race) {
|
private void initialiseView3D() {
|
||||||
viewSubjects = FXCollections.observableArrayList();
|
viewSubjects = FXCollections.observableArrayList();
|
||||||
|
|
||||||
// Import boat mesh
|
// Import boat mesh
|
||||||
URL asset = HostController.class.getClassLoader().getResource("assets/V1.2 Complete Boat.stl");
|
URL asset = RaceViewController.class.getClassLoader().getResource("assets/V1.2 " +
|
||||||
|
"Complete Boat.stl");
|
||||||
StlMeshImporter importer = new StlMeshImporter();
|
StlMeshImporter importer = new StlMeshImporter();
|
||||||
importer.read(asset);
|
importer.read(asset);
|
||||||
|
|
||||||
@@ -214,16 +215,15 @@ public class RaceController extends Controller {
|
|||||||
view3D.setYaw(0);
|
view3D.setYaw(0);
|
||||||
view3D.setPitch(60);
|
view3D.setPitch(60);
|
||||||
view3D.enableTracking();
|
view3D.enableTracking();
|
||||||
//newPane.getChildren().add(view3D);
|
|
||||||
canvasBase.add(view3D, 0, 0);
|
canvasBase.add(view3D, 0, 0);
|
||||||
|
|
||||||
// Set up projection from GPS to view
|
// Set up projection from GPS to view
|
||||||
RaceDataSource raceData = visualiserRace.getVisualiserRaceState().getRaceDataSource();
|
RaceDataSource raceData = raceState.getRaceDataSource();
|
||||||
final GPSConverter gpsConverter = new GPSConverter(raceData, 450, 450);
|
final GPSConverter gpsConverter = new GPSConverter(raceData, 450, 450);
|
||||||
|
|
||||||
view3D.setItems(viewSubjects);
|
view3D.setItems(viewSubjects);
|
||||||
// Position and add each mark to view
|
// Position and add each mark to view
|
||||||
for(Mark mark: race.getVisualiserRaceState().getMarks()) {
|
for (Mark mark : raceState.getMarks()) {
|
||||||
Subject3D subject = new Subject3D(new Sphere(2));
|
Subject3D subject = new Subject3D(new Sphere(2));
|
||||||
subject.setX(gpsConverter.convertGPS(mark.getPosition()).getX());
|
subject.setX(gpsConverter.convertGPS(mark.getPosition()).getX());
|
||||||
subject.setZ(gpsConverter.convertGPS(mark.getPosition()).getY());
|
subject.setZ(gpsConverter.convertGPS(mark.getPosition()).getY());
|
||||||
@@ -231,15 +231,14 @@ public class RaceController extends Controller {
|
|||||||
viewSubjects.add(subject);
|
viewSubjects.add(subject);
|
||||||
}
|
}
|
||||||
// Position and add each boat to view
|
// Position and add each boat to view
|
||||||
for(VisualiserBoat boat: race.getVisualiserRaceState().getBoats()) {
|
for (VisualiserBoat boat : raceState.getBoats()) {
|
||||||
MeshView mesh = new MeshView(importer.getImport());
|
MeshView mesh = new MeshView(importer.getImport());
|
||||||
Subject3D subject = new Subject3D(mesh);
|
Subject3D subject = new Subject3D(mesh);
|
||||||
viewSubjects.add(subject);
|
viewSubjects.add(subject);
|
||||||
|
|
||||||
// Track this boat's movement with the new subject
|
// Track this boat's movement with the new subject
|
||||||
AnimationTimer trackBoat = new AnimationTimer() {
|
AnimationTimer trackBoat = new AnimationTimer() {
|
||||||
@Override
|
@Override public void handle(long now) {
|
||||||
public void handle(long now) {
|
|
||||||
subject.setHeading(boat.getBearing().degrees());
|
subject.setHeading(boat.getBearing().degrees());
|
||||||
subject.setX(gpsConverter.convertGPS(boat.getPosition()).getX());
|
subject.setX(gpsConverter.convertGPS(boat.getPosition()).getX());
|
||||||
subject.setZ(gpsConverter.convertGPS(boat.getPosition()).getY());
|
subject.setZ(gpsConverter.convertGPS(boat.getPosition()).getY());
|
||||||
@@ -295,90 +294,58 @@ public class RaceController extends Controller {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialises the frame rate functionality. This allows for toggling the frame rate, and connect the fps label to the race's fps property.
|
* Initialises the frame rate functionality. This allows for toggling the
|
||||||
* @param visualiserRace The race to connect the fps label to.
|
* frame rate, and connect the fps label to the race's fps property.
|
||||||
*/
|
*/
|
||||||
private void initialiseFps(VisualiserRaceEvent visualiserRace) {
|
private void initialiseFps() {
|
||||||
|
// fps toggle listener
|
||||||
//On/off toggle.
|
|
||||||
initialiseFpsToggle();
|
|
||||||
|
|
||||||
//Label value.
|
|
||||||
initialiseFpsLabel(visualiserRace);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialises a listener for the fps toggle.
|
|
||||||
*/
|
|
||||||
private void initialiseFpsToggle() {
|
|
||||||
|
|
||||||
showFPS.selectedProperty().addListener((ov, old_val, new_val) -> {
|
showFPS.selectedProperty().addListener((ov, old_val, new_val) -> {
|
||||||
if (showFPS.isSelected()) {
|
if (showFPS.isSelected()) {
|
||||||
FPS.setVisible(true);
|
FPS.setVisible(true);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
FPS.setVisible(false);
|
FPS.setVisible(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
// fps label display
|
||||||
|
this.visualiserRace.getFrameRateProperty().addListener((observable,
|
||||||
/**
|
oldValue, newValue) -> {
|
||||||
* Initialises the fps label to update when the race fps changes.
|
Platform.runLater(() ->
|
||||||
* @param visualiserRace The race to monitor the frame rate of.
|
this.FPS.setText("FPS: " + newValue.toString()));
|
||||||
*/
|
|
||||||
private void initialiseFpsLabel(VisualiserRaceEvent visualiserRace) {
|
|
||||||
|
|
||||||
visualiserRace.getFrameRateProperty().addListener((observable, oldValue, newValue) -> {
|
|
||||||
Platform.runLater(() -> this.FPS.setText("FPS: " + newValue.toString()));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialises the information table view to listen to a given race.
|
* Initialises the information table view to listen to a given race.
|
||||||
* @param race Race to listen to.
|
|
||||||
*/
|
*/
|
||||||
public void initialiseInfoTable(VisualiserRaceEvent race) {
|
private void initialiseInfoTable() {
|
||||||
|
// list of boats to display data for
|
||||||
//Copy list of boats.
|
ObservableList<VisualiserBoat> boats = FXCollections
|
||||||
ObservableList<VisualiserBoat> boats = FXCollections.observableArrayList(race.getVisualiserRaceState().getBoats());
|
.observableArrayList(this.visualiserRace.getVisualiserRaceState().getBoats());
|
||||||
SortedList<VisualiserBoat> sortedBoats = new SortedList<>(boats);
|
SortedList<VisualiserBoat> sortedBoats = new SortedList<>(boats);
|
||||||
sortedBoats.comparatorProperty().bind(boatInfoTable.comparatorProperty());
|
sortedBoats.comparatorProperty().bind(boatInfoTable.comparatorProperty());
|
||||||
|
|
||||||
//Update copy when original changes.
|
// update list when boat information changes
|
||||||
race.getVisualiserRaceState().getBoats().addListener((ListChangeListener.Change<? extends VisualiserBoat> c) -> Platform.runLater(() -> {
|
this.visualiserRace.getVisualiserRaceState().getBoats().addListener(
|
||||||
boats.setAll(race.getVisualiserRaceState().getBoats());
|
(ListChangeListener.Change<? extends VisualiserBoat> c) -> Platform.runLater(() -> {
|
||||||
|
boats.setAll(this.visualiserRace.getVisualiserRaceState().getBoats());
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
// set table data
|
||||||
//Set up table.
|
|
||||||
boatInfoTable.setItems(sortedBoats);
|
boatInfoTable.setItems(sortedBoats);
|
||||||
|
|
||||||
|
|
||||||
//Set up each column.
|
|
||||||
|
|
||||||
//Name.
|
|
||||||
boatTeamColumn.setCellValueFactory(
|
boatTeamColumn.setCellValueFactory(
|
||||||
cellData -> cellData.getValue().nameProperty());
|
cellData -> cellData.getValue().nameProperty());
|
||||||
|
|
||||||
//Speed.
|
|
||||||
boatSpeedColumn.setCellValueFactory(
|
boatSpeedColumn.setCellValueFactory(
|
||||||
cellData -> cellData.getValue().currentSpeedProperty());
|
cellData -> cellData.getValue().currentSpeedProperty());
|
||||||
|
boatMarkColumn.setCellValueFactory(
|
||||||
|
cellData -> cellData.getValue().legProperty());
|
||||||
|
boatPlacingColumn.setCellValueFactory(
|
||||||
|
cellData -> cellData.getValue().placingProperty());
|
||||||
|
|
||||||
//Kind of ugly, but allows for formatting an observed speed.
|
//Kind of ugly, but allows for formatting an observed speed.
|
||||||
boatSpeedColumn.setCellFactory(
|
boatSpeedColumn.setCellFactory(
|
||||||
//Callback object.
|
|
||||||
new Callback<TableColumn<VisualiserBoat, Number>, TableCell<VisualiserBoat, Number>>() {
|
new Callback<TableColumn<VisualiserBoat, Number>, TableCell<VisualiserBoat, Number>>() {
|
||||||
|
|
||||||
//Callback function.
|
|
||||||
@Override
|
@Override
|
||||||
public TableCell<VisualiserBoat, Number> call(TableColumn<VisualiserBoat, Number> param) {
|
public TableCell<VisualiserBoat, Number> call(TableColumn<VisualiserBoat, Number> param) {
|
||||||
//We return a table cell that populates itself with a Number, and formats it.
|
//We return a table cell that populates itself with a Number, and formats it.
|
||||||
@@ -387,30 +354,18 @@ public class RaceController extends Controller {
|
|||||||
//Function to update the cell text.
|
//Function to update the cell text.
|
||||||
@Override
|
@Override
|
||||||
protected void updateItem(Number item, boolean empty) {
|
protected void updateItem(Number item, boolean empty) {
|
||||||
|
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
|
|
||||||
setText(String.format("%.2fkn", item.doubleValue()));
|
setText(String.format("%.2fkn", item.doubleValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//Last mark.
|
|
||||||
boatMarkColumn.setCellValueFactory(
|
|
||||||
cellData -> cellData.getValue().legProperty() );
|
|
||||||
|
|
||||||
//Kind of ugly, but allows for turning an observed Leg into a string.
|
//Kind of ugly, but allows for turning an observed Leg into a string.
|
||||||
boatMarkColumn.setCellFactory(
|
boatMarkColumn.setCellFactory(
|
||||||
//Callback object.
|
|
||||||
new Callback<TableColumn<VisualiserBoat, Leg>, TableCell<VisualiserBoat, Leg>>() {
|
new Callback<TableColumn<VisualiserBoat, Leg>, TableCell<VisualiserBoat, Leg>>() {
|
||||||
|
|
||||||
//Callback function.
|
|
||||||
@Override
|
@Override
|
||||||
public TableCell<VisualiserBoat, Leg> call(TableColumn<VisualiserBoat, Leg> param) {
|
public TableCell<VisualiserBoat, Leg> call(TableColumn<VisualiserBoat, Leg> param) {
|
||||||
//We return a table cell that populates itself with a Leg's name.
|
//We return a table cell that populates itself with a Leg's name.
|
||||||
@@ -419,105 +374,37 @@ public class RaceController extends Controller {
|
|||||||
//Function to update the cell text.
|
//Function to update the cell text.
|
||||||
@Override
|
@Override
|
||||||
protected void updateItem(Leg item, boolean empty) {
|
protected void updateItem(Leg item, boolean empty) {
|
||||||
|
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
super.updateItem(item, empty);
|
super.updateItem(item, empty);
|
||||||
|
|
||||||
setText(item.getName());
|
setText(item.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//Current place within race.
|
|
||||||
boatPlacingColumn.setCellValueFactory(
|
|
||||||
cellData -> cellData.getValue().placingProperty() );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialises the race time zone label with the race's time zone.
|
|
||||||
* @param race The race to get time zone from.
|
|
||||||
*/
|
|
||||||
private void initialiseRaceTimezoneLabel(VisualiserRaceEvent race) {
|
|
||||||
timeZone.setText(race.getVisualiserRaceState().getRaceClock().getTimeZone());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialises the race clock to listen to the specified race.
|
* Initialises the race clock to listen to the specified race.
|
||||||
* @param race The race to listen to.
|
|
||||||
*/
|
*/
|
||||||
private void initialiseRaceClock(VisualiserRaceEvent race) {
|
private void initialiseRaceClock() {
|
||||||
|
raceState.getRaceClock().durationProperty().addListener((observable,
|
||||||
//RaceClock.duration isn't necessarily being changed in the javaFX thread, so we need to runlater the update.
|
oldValue, newValue) -> {
|
||||||
race.getVisualiserRaceState().getRaceClock().durationProperty().addListener((observable, oldValue, newValue) -> {
|
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
timer.setText(newValue);
|
timer.setText(newValue);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays a specified race.
|
|
||||||
* @param visualiserRace Object modelling the race.
|
|
||||||
* @param controllerClient Socket Client that manipulates the controller.
|
|
||||||
* @param isHost is user a host
|
|
||||||
*/
|
|
||||||
public void startRace(VisualiserRaceEvent visualiserRace, ControllerClient controllerClient, Boolean isHost) {
|
|
||||||
|
|
||||||
this.visualiserRace = visualiserRace;
|
|
||||||
this.controllerClient = controllerClient;
|
|
||||||
this.isHost = isHost;
|
|
||||||
|
|
||||||
|
|
||||||
//Check if the game is a tutorial
|
|
||||||
if (parent.getGameType()==4){
|
|
||||||
isTutorial = true;
|
|
||||||
tutorialText.setVisible(true);
|
|
||||||
tutorialStates = new ArrayList<>(Arrays.asList(TutorialState.values()));
|
|
||||||
|
|
||||||
currentState = tutorialStates.get(0);
|
|
||||||
tutorialStates.remove(0);
|
|
||||||
|
|
||||||
searchMapForKey("Upwind");
|
|
||||||
|
|
||||||
tutorialText.setText("Welcome to the tutorial! Exit at anytime with ESC. \nWe will first learn how to turn upwind. Press " + keyToPress + " to turn upwind.");
|
|
||||||
|
|
||||||
} else {
|
|
||||||
isTutorial = false;
|
|
||||||
tutorialText.setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
initialiseRace();
|
|
||||||
|
|
||||||
//Display this controller.
|
|
||||||
racePane.setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transition from the race view to the finish view.
|
* Transition from the race view to the finish view.
|
||||||
* @param boats boats there are in the race.
|
|
||||||
*/
|
*/
|
||||||
public void finishRace(ObservableList<VisualiserBoat> boats) {
|
private void finishRace() throws IOException {
|
||||||
racePane.setVisible(false);
|
RaceFinishController fc =
|
||||||
parent.enterFinish(boats);
|
(RaceFinishController)loadScene("raceFinish.fxml");
|
||||||
|
fc.loadFinish(raceState.getBoats());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialises the arrow controller with data from the race to observe.
|
|
||||||
* @param race The race to observe.
|
|
||||||
*/
|
|
||||||
private void initialiseArrow(VisualiserRaceEvent race) {
|
|
||||||
arrowController.setWindProperty(race.getVisualiserRaceState().windProperty());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Timer which monitors the race.
|
* Timer which monitors the race.
|
||||||
*/
|
*/
|
||||||
@@ -525,40 +412,28 @@ public class RaceController extends Controller {
|
|||||||
new AnimationTimer() {
|
new AnimationTimer() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(long arg0) {
|
public void handle(long arg0) {
|
||||||
|
|
||||||
//Get the current race status.
|
|
||||||
RaceStatusEnum raceStatus = visualiserRace.getVisualiserRaceState().getRaceStatusEnum();
|
|
||||||
|
|
||||||
|
|
||||||
//If the race has finished, go to finish view.
|
//If the race has finished, go to finish view.
|
||||||
if (raceStatus == RaceStatusEnum.FINISHED) {
|
if (raceState.getRaceStatusEnum() == RaceStatusEnum.FINISHED) {
|
||||||
//Stop this timer.
|
stop(); // stop the timer
|
||||||
stop();
|
try {
|
||||||
|
finishRace();
|
||||||
//Hide this, and display the finish controller.
|
} catch (IOException e) {
|
||||||
finishRace(visualiserRace.getVisualiserRaceState().getBoats());
|
e.printStackTrace();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
//Sort the tableview. Doesn't automatically work for all columns.
|
|
||||||
boatInfoTable.sort();
|
boatInfoTable.sort();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Return to main screen if we lose connection.
|
//Return to main screen if we lose connection.
|
||||||
if (!visualiserRace.getServerConnection().isAlive()) {
|
if (!visualiserRace.getServerConnection().isAlive()) {
|
||||||
racePane.setVisible(false);
|
|
||||||
//parent.enterTitle();
|
|
||||||
try {
|
try {
|
||||||
App.app.showMainStage(App.getStage());
|
loadTitleScreen();
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
//TODO currently this doesn't work correctly - the title screen remains visible after clicking join game
|
|
||||||
//TODO we should display an error to the user
|
//TODO we should display an error to the user
|
||||||
//TODO also need to "reset" any state (race, connections, etc...).
|
//TODO also need to "reset" any state (race, connections, etc...).
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
}
|
}
|
||||||
@@ -567,24 +442,22 @@ public class RaceController extends Controller {
|
|||||||
* toggles if the info table is shown
|
* toggles if the info table is shown
|
||||||
*/
|
*/
|
||||||
private void toggleTable() {
|
private void toggleTable() {
|
||||||
double tablePercent = 1 - (boatPlacingColumn.getPrefWidth() + boatTeamColumn.getPrefWidth() + boatMarkColumn.getPrefWidth() + boatSpeedColumn.getPrefWidth())/racePane.getWidth();
|
double tablePercent = 1 - (boatPlacingColumn.getPrefWidth() +
|
||||||
|
boatTeamColumn.getPrefWidth() + boatMarkColumn.getPrefWidth()
|
||||||
|
+ boatSpeedColumn.getPrefWidth())/racePane.getWidth();
|
||||||
|
|
||||||
if (infoTableShow) {
|
if (infoTableShow) {
|
||||||
racePane.setDividerPositions(tablePercent);
|
racePane.setDividerPositions(tablePercent);
|
||||||
|
|
||||||
arrowPane.setScaleX(0.5);
|
arrowPane.setScaleX(0.5);
|
||||||
arrowPane.setScaleY(0.5);
|
arrowPane.setScaleY(0.5);
|
||||||
arrowPane.setTranslateX(0 + (arrowPane.getScene().getWidth()/4)*tablePercent);
|
arrowPane.setTranslateX(0 + (arrowPane.getScene().getWidth()/4)*tablePercent);
|
||||||
arrowPane.setTranslateY(0 - arrowPane.getScene().getHeight()/4);
|
arrowPane.setTranslateY(0 - arrowPane.getScene().getHeight()/4);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
racePane.setDividerPositions(1);
|
racePane.setDividerPositions(1);
|
||||||
|
|
||||||
arrowPane.setScaleX(1);
|
arrowPane.setScaleX(1);
|
||||||
arrowPane.setScaleY(1);
|
arrowPane.setScaleY(1);
|
||||||
arrowPane.setTranslateX(0);
|
arrowPane.setTranslateX(0);
|
||||||
arrowPane.setTranslateY(0);
|
arrowPane.setTranslateY(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
boatInfoTable.refresh();
|
boatInfoTable.refresh();
|
||||||
infoTableShow = !infoTableShow;
|
infoTableShow = !infoTableShow;
|
||||||
@@ -679,19 +552,16 @@ public class RaceController extends Controller {
|
|||||||
alert.setContentText("Now you know the controls you are ready to race!");
|
alert.setContentText("Now you know the controls you are ready to race!");
|
||||||
Optional<ButtonType> result = alert.showAndWait();
|
Optional<ButtonType> result = alert.showAndWait();
|
||||||
if (result.get() == ButtonType.OK) {
|
if (result.get() == ButtonType.OK) {
|
||||||
parent.endEvent();
|
App.game.endEvent();
|
||||||
racePane.setVisible(false);
|
loadTitleScreen();
|
||||||
App.app.showMainStage(App.getStage());
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//State not found. Exit tutorial to title menu
|
//State not found. Exit tutorial to title menu
|
||||||
parent.endEvent();
|
App.game.endEvent();
|
||||||
racePane.setVisible(false);
|
loadTitleScreen();
|
||||||
App.app.showMainStage(App.getStage());
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,271 +0,0 @@
|
|||||||
package visualiser.Controllers;
|
|
||||||
|
|
||||||
import javafx.animation.AnimationTimer;
|
|
||||||
import javafx.application.Platform;
|
|
||||||
import javafx.collections.ObservableList;
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.scene.control.Label;
|
|
||||||
import javafx.scene.control.TableColumn;
|
|
||||||
import javafx.scene.control.TableView;
|
|
||||||
import javafx.scene.layout.AnchorPane;
|
|
||||||
import javafx.scene.layout.GridPane;
|
|
||||||
import mock.model.commandFactory.CompositeCommand;
|
|
||||||
import network.Messages.Enums.RaceStatusEnum;
|
|
||||||
import network.Messages.Enums.RequestToJoinEnum;
|
|
||||||
import network.Messages.LatestMessages;
|
|
||||||
import shared.dataInput.*;
|
|
||||||
import shared.enums.XMLFileType;
|
|
||||||
import shared.exceptions.InvalidBoatDataException;
|
|
||||||
import shared.exceptions.InvalidRaceDataException;
|
|
||||||
import shared.exceptions.InvalidRegattaDataException;
|
|
||||||
import shared.exceptions.XMLReaderException;
|
|
||||||
import visualiser.gameController.ControllerClient;
|
|
||||||
import visualiser.model.VisualiserRaceState;
|
|
||||||
import visualiser.network.ServerConnection;
|
|
||||||
import visualiser.model.VisualiserBoat;
|
|
||||||
import visualiser.model.VisualiserRaceEvent;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.Socket;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Controller to for waiting for the race to start.
|
|
||||||
*/
|
|
||||||
public class StartController extends Controller {
|
|
||||||
|
|
||||||
@FXML private GridPane start;
|
|
||||||
@FXML private AnchorPane startWrapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The name of the race/regatta.
|
|
||||||
*/
|
|
||||||
@FXML private Label raceTitleLabel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The time the race starts at.
|
|
||||||
*/
|
|
||||||
@FXML private Label raceStartLabel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The current time at the race location.
|
|
||||||
*/
|
|
||||||
@FXML private Label timeZoneTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Time until the race starts.
|
|
||||||
*/
|
|
||||||
@FXML private Label timer;
|
|
||||||
|
|
||||||
@FXML private TableView<VisualiserBoat> boatNameTable;
|
|
||||||
@FXML private TableColumn<VisualiserBoat, String> boatNameColumn;
|
|
||||||
@FXML private TableColumn<VisualiserBoat, String> boatCodeColumn;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The status of the race.
|
|
||||||
*/
|
|
||||||
@FXML private Label raceStatusLabel;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The race + connection to server.
|
|
||||||
*/
|
|
||||||
private VisualiserRaceEvent visualiserRaceEvent;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes BoatActions to outgoing message queue.
|
|
||||||
*/
|
|
||||||
private ControllerClient controllerClient;
|
|
||||||
|
|
||||||
private boolean isHost;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ctor.
|
|
||||||
*/
|
|
||||||
public StartController() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initialize(URL location, ResourceBundle resources) {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Starts the race.
|
|
||||||
*/
|
|
||||||
private void startRace() {
|
|
||||||
|
|
||||||
//Initialise the boat table.
|
|
||||||
initialiseBoatTable(this.visualiserRaceEvent.getVisualiserRaceState());
|
|
||||||
|
|
||||||
//Initialise the race name.
|
|
||||||
initialiseRaceName(this.visualiserRaceEvent.getVisualiserRaceState());
|
|
||||||
|
|
||||||
//Initialises the race clock.
|
|
||||||
initialiseRaceClock(this.visualiserRaceEvent.getVisualiserRaceState());
|
|
||||||
|
|
||||||
//Starts the race countdown timer.
|
|
||||||
countdownTimer();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public AnchorPane startWrapper(){
|
|
||||||
return startWrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialises the boat table that is to be shown on the pane.
|
|
||||||
* @param visualiserRace The race to get data from.
|
|
||||||
*/
|
|
||||||
private void initialiseBoatTable(VisualiserRaceState visualiserRace) {
|
|
||||||
|
|
||||||
//Get the boats.
|
|
||||||
ObservableList<VisualiserBoat> boats = visualiserRace.getBoats();
|
|
||||||
|
|
||||||
//Populate table.
|
|
||||||
boatNameTable.setItems(boats);
|
|
||||||
boatNameColumn.setCellValueFactory(cellData -> cellData.getValue().nameProperty());
|
|
||||||
boatCodeColumn.setCellValueFactory(cellData -> cellData.getValue().countryProperty());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialises the race name which is shown on the pane.
|
|
||||||
* @param visualiserRace The race to get data from.
|
|
||||||
*/
|
|
||||||
private void initialiseRaceName(VisualiserRaceState visualiserRace) {
|
|
||||||
|
|
||||||
raceTitleLabel.setText(visualiserRace.getRegattaName());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialises the race clock/timer labels for the start time, current time, and remaining time.
|
|
||||||
* @param visualiserRace The race to get data from.
|
|
||||||
*/
|
|
||||||
private void initialiseRaceClock(VisualiserRaceState visualiserRace) {
|
|
||||||
|
|
||||||
//Start time.
|
|
||||||
initialiseRaceClockStartTime(visualiserRace);
|
|
||||||
|
|
||||||
//Current time.
|
|
||||||
initialiseRaceClockCurrentTime(visualiserRace);
|
|
||||||
|
|
||||||
//Remaining time.
|
|
||||||
initialiseRaceClockDuration(visualiserRace);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialises the race current time label.
|
|
||||||
* @param visualiserRace The race to get data from.
|
|
||||||
*/
|
|
||||||
private void initialiseRaceClockStartTime(VisualiserRaceState visualiserRace) {
|
|
||||||
|
|
||||||
raceStartLabel.setText(visualiserRace.getRaceClock().getStartingTimeString());
|
|
||||||
|
|
||||||
visualiserRace.getRaceClock().startingTimeProperty().addListener((observable, oldValue, newValue) -> {
|
|
||||||
Platform.runLater(() -> {
|
|
||||||
raceStartLabel.setText(newValue);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialises the race current time label.
|
|
||||||
* @param visualiserRace The race to get data from.
|
|
||||||
*/
|
|
||||||
private void initialiseRaceClockCurrentTime(VisualiserRaceState visualiserRace) {
|
|
||||||
|
|
||||||
visualiserRace.getRaceClock().currentTimeProperty().addListener((observable, oldValue, newValue) -> {
|
|
||||||
Platform.runLater(() -> {
|
|
||||||
timeZoneTime.setText(newValue);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialises the race duration label.
|
|
||||||
* @param visualiserRace The race to get data from.
|
|
||||||
*/
|
|
||||||
private void initialiseRaceClockDuration(VisualiserRaceState visualiserRace) {
|
|
||||||
|
|
||||||
visualiserRace.getRaceClock().durationProperty().addListener((observable, oldValue, newValue) -> {
|
|
||||||
Platform.runLater(() -> {
|
|
||||||
timer.setText(newValue);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Countdown timer until race starts.
|
|
||||||
*/
|
|
||||||
private void countdownTimer() {
|
|
||||||
new AnimationTimer() {
|
|
||||||
@Override
|
|
||||||
public void handle(long arg0) {
|
|
||||||
|
|
||||||
//Get the current race status.
|
|
||||||
RaceStatusEnum raceStatus = visualiserRaceEvent.getVisualiserRaceState().getRaceStatusEnum();
|
|
||||||
|
|
||||||
//If the race has reached the preparatory phase, or has started...
|
|
||||||
if (raceStatus == RaceStatusEnum.WARNING
|
|
||||||
|| raceStatus == RaceStatusEnum.PREPARATORY
|
|
||||||
|| raceStatus == RaceStatusEnum.STARTED) {
|
|
||||||
//Stop this timer.
|
|
||||||
stop();
|
|
||||||
|
|
||||||
//Hide this, and display the race controller.
|
|
||||||
startWrapper.setVisible(false);
|
|
||||||
//start.setVisible(false);//TODO is this needed?
|
|
||||||
|
|
||||||
parent.beginRace(visualiserRaceEvent, controllerClient, isHost);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.start();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show starting information for a race given a socket.
|
|
||||||
* @param socket network source of information
|
|
||||||
* @param isHost is user a host
|
|
||||||
*/
|
|
||||||
public void enterLobby(Socket socket, Boolean isHost) {
|
|
||||||
try {
|
|
||||||
|
|
||||||
this.isHost = isHost;
|
|
||||||
|
|
||||||
this.visualiserRaceEvent = new VisualiserRaceEvent(socket, RequestToJoinEnum.PARTICIPANT);
|
|
||||||
|
|
||||||
this.controllerClient = visualiserRaceEvent.getControllerClient();
|
|
||||||
|
|
||||||
|
|
||||||
startWrapper.setVisible(true);
|
|
||||||
|
|
||||||
startRace();
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
//TODO should probably let this propagate, so that we only enter this scene if everything works
|
|
||||||
Logger.getGlobal().log(Level.WARNING, "Could not connect to server.", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,29 +1,16 @@
|
|||||||
package visualiser.Controllers;
|
package visualiser.Controllers;
|
||||||
|
|
||||||
import javafx.event.EventHandler;
|
|
||||||
import javafx.fxml.FXML;
|
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.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.RadioButton;
|
import javafx.scene.control.RadioButton;
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
import javafx.scene.layout.AnchorPane;
|
|
||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.Pane;
|
||||||
import javafx.stage.Modality;
|
import javafx.stage.Modality;
|
||||||
import javafx.stage.Stage;
|
|
||||||
import mock.app.Event;
|
|
||||||
import mock.exceptions.EventConstructionException;
|
import mock.exceptions.EventConstructionException;
|
||||||
import javafx.stage.WindowEvent;
|
|
||||||
import visualiser.app.App;
|
import visualiser.app.App;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ResourceBundle;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller for the opening title window.
|
* Controller for the opening title window.
|
||||||
@@ -32,21 +19,11 @@ import java.util.logging.Logger;
|
|||||||
* the game.
|
* the game.
|
||||||
*/
|
*/
|
||||||
public class TitleController extends Controller {
|
public class TitleController extends Controller {
|
||||||
//FXML stuff
|
private @FXML RadioButton dayModeRD;
|
||||||
@FXML
|
private @FXML RadioButton nightModeRD;
|
||||||
Button btnJoin;
|
private @FXML Label tutorialLabel;
|
||||||
@FXML
|
private @FXML Pane menuPane;
|
||||||
AnchorPane titleWrapper;
|
private @FXML ImageView imgSun;
|
||||||
@FXML
|
|
||||||
RadioButton dayModeRD;
|
|
||||||
@FXML
|
|
||||||
RadioButton nightModeRD;
|
|
||||||
@FXML
|
|
||||||
Label tutorialLabel;
|
|
||||||
@FXML
|
|
||||||
Pane menuPane;
|
|
||||||
@FXML
|
|
||||||
ImageView imgSun;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method called when the 'host a game' button is pressed.
|
* Method called when the 'host a game' button is pressed.
|
||||||
@@ -55,27 +32,15 @@ public class TitleController extends Controller {
|
|||||||
* @throws IOException if main has problems
|
* @throws IOException if main has problems
|
||||||
*/
|
*/
|
||||||
public void hostAGame() throws IOException {
|
public void hostAGame() throws IOException {
|
||||||
titleWrapper.setVisible(false);
|
loadScene("hostGame.fxml");
|
||||||
parent.setGameType(0);
|
|
||||||
parent.hostGame();
|
|
||||||
App.getStage().setResizable(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Switch the scene to the title page.
|
|
||||||
*/
|
|
||||||
public void enterTitle(){
|
|
||||||
titleWrapper.setVisible(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To be implemented at a later date- will open the next scene displaying
|
* To be implemented at a later date- will open the next scene displaying
|
||||||
* games a player can join. Place holder method for now!
|
* games a player can join. Place holder method for now!
|
||||||
*/
|
*/
|
||||||
public void joinAGame() {
|
public void joinAGame() throws IOException {
|
||||||
titleWrapper.setVisible(false);
|
loadScene("lobby.fxml");
|
||||||
parent.enterLobby();
|
|
||||||
App.getStage().setResizable(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -88,6 +53,7 @@ public class TitleController extends Controller {
|
|||||||
dayModeRD.getScene().getStylesheets().add("/css/dayMode.css");
|
dayModeRD.getScene().getStylesheets().add("/css/dayMode.css");
|
||||||
menuPane.setStyle("-fx-background-color: #6be6ff;");
|
menuPane.setStyle("-fx-background-color: #6be6ff;");
|
||||||
nightModeRD.setSelected(false);
|
nightModeRD.setSelected(false);
|
||||||
|
App.dayMode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,49 +66,27 @@ public class TitleController extends Controller {
|
|||||||
nightModeRD.getScene().getStylesheets().add("/css/nightMode.css");
|
nightModeRD.getScene().getStylesheets().add("/css/nightMode.css");
|
||||||
menuPane.setStyle("-fx-background-color: #1f2c60;");
|
menuPane.setStyle("-fx-background-color: #1f2c60;");
|
||||||
dayModeRD.setSelected(false);
|
dayModeRD.setSelected(false);
|
||||||
}
|
App.dayMode = false;
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initialize(URL location, ResourceBundle resources) {
|
|
||||||
tutorialLabel.setWrapText(true);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when control button is pressed. New pop up window displaying controls
|
* Called when control button is pressed. New pop up window displaying controls
|
||||||
*/
|
*/
|
||||||
public void controlBtnPressed(){
|
public void showControls(){
|
||||||
try {
|
try {
|
||||||
FXMLLoader loader = new FXMLLoader();
|
loadPopupScene("keyBindings.fxml",
|
||||||
loader.setLocation(getClass().getResource("/visualiser/scenes/keyBindings.fxml"));
|
"Game Controls", Modality.WINDOW_MODAL);
|
||||||
Parent layout = loader.load();
|
} catch (IOException e) {
|
||||||
Scene scene = new Scene(layout);
|
|
||||||
Stage popupStage = new Stage();
|
|
||||||
popupStage.setResizable(false);
|
|
||||||
popupStage.setTitle("Game Controls");
|
|
||||||
popupStage.initModality(Modality.WINDOW_MODAL);
|
|
||||||
popupStage.centerOnScreen();
|
|
||||||
popupStage.setScene(scene);
|
|
||||||
popupStage.show();
|
|
||||||
KeyBindingsController controller = loader.getController();
|
|
||||||
popupStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
|
|
||||||
public void handle(WindowEvent we) {
|
|
||||||
if (we.getEventType() == WindowEvent.WINDOW_CLOSE_REQUEST) {
|
|
||||||
controller.onExit(we);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (Exception e){
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void tutorialStartPressed() throws IOException,
|
||||||
public void tutorialStartPressed() throws IOException {
|
EventConstructionException {
|
||||||
titleWrapper.setVisible(false);
|
App.gameType = 4;
|
||||||
parent.setGameType(4);
|
HostGameController hgc = new HostGameController();
|
||||||
parent.beginGame();
|
hgc.setCurrentMapIndex(4);
|
||||||
|
hgc.hostGamePressed();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3,19 +3,16 @@ package visualiser.app;
|
|||||||
import javafx.animation.FadeTransition;
|
import javafx.animation.FadeTransition;
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.beans.property.ReadOnlyObjectProperty;
|
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.concurrent.Task;
|
import javafx.concurrent.Task;
|
||||||
import javafx.concurrent.Worker;
|
import javafx.concurrent.Worker;
|
||||||
import javafx.event.EventHandler;
|
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.geometry.Pos;
|
import javafx.geometry.Pos;
|
||||||
import javafx.geometry.Rectangle2D;
|
import javafx.geometry.Rectangle2D;
|
||||||
import javafx.scene.Parent;
|
import javafx.scene.Parent;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.ListView;
|
|
||||||
import javafx.scene.control.ProgressBar;
|
import javafx.scene.control.ProgressBar;
|
||||||
import javafx.scene.effect.DropShadow;
|
import javafx.scene.effect.DropShadow;
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
@@ -26,25 +23,22 @@ import javafx.scene.paint.Color;
|
|||||||
import javafx.stage.Screen;
|
import javafx.stage.Screen;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import javafx.stage.StageStyle;
|
import javafx.stage.StageStyle;
|
||||||
import javafx.stage.WindowEvent;
|
|
||||||
import javafx.util.Duration;
|
import javafx.util.Duration;
|
||||||
import visualiser.Controllers.MainController;
|
import mock.app.Event;
|
||||||
import visualiser.gameController.Keys.KeyFactory;
|
|
||||||
|
|
||||||
public class App extends Application {
|
public class App extends Application {
|
||||||
|
|
||||||
private static Stage stage;
|
private static Stage stage;
|
||||||
|
public static Event game;
|
||||||
|
public static Boolean dayMode = true;
|
||||||
|
public static Integer gameType = 0;
|
||||||
private Pane splashLayout;
|
private Pane splashLayout;
|
||||||
private ProgressBar loadProgress;
|
private ProgressBar loadProgress;
|
||||||
private Label progressText;
|
private Label progressText;
|
||||||
private static final int SPLASH_WIDTH = 676;
|
private static final int SPLASH_WIDTH = 676;
|
||||||
private static final int SPLASH_HEIGHT = 227;
|
private static final int SPLASH_HEIGHT = 227;
|
||||||
public static KeyFactory keyFactory = new KeyFactory();
|
|
||||||
public static App app;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entry point for running the programme
|
* Entry point for running the programme
|
||||||
*
|
|
||||||
* @param args for starting the programme
|
* @param args for starting the programme
|
||||||
*/
|
*/
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
@@ -53,9 +47,6 @@ public class App extends Application {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
// load the user's personalised key bindings
|
|
||||||
keyFactory.load();
|
|
||||||
|
|
||||||
ImageView splash = new ImageView(new Image(
|
ImageView splash = new ImageView(new Image(
|
||||||
getClass().getClassLoader().getResourceAsStream("images/splashScreen.png")
|
getClass().getClassLoader().getResourceAsStream("images/splashScreen.png")
|
||||||
));
|
));
|
||||||
@@ -81,15 +72,15 @@ public class App extends Application {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Method that sets up and displays the splash screen
|
* Method that sets up and displays the splash screen
|
||||||
* @param initStage the inital stage
|
* @param stage the initial stage
|
||||||
* @throws Exception if something wrong with title screen.
|
* @throws Exception if something wrong with title screen.
|
||||||
*/
|
*/
|
||||||
public void start(Stage initStage) throws Exception {
|
public void start(Stage stage) throws Exception {
|
||||||
final Task<ObservableList<String>> boatTask = new Task<ObservableList<String>>() {
|
final Task<ObservableList<String>> boatTask = new Task<ObservableList<String>>() {
|
||||||
@Override
|
@Override
|
||||||
protected ObservableList<String> call() throws InterruptedException {
|
protected ObservableList<String> call() throws InterruptedException {
|
||||||
ObservableList<String> addedFilling =
|
ObservableList<String> addedFilling =
|
||||||
FXCollections.<String>observableArrayList();
|
FXCollections.observableArrayList();
|
||||||
ObservableList<String> burgerFilling =
|
ObservableList<String> burgerFilling =
|
||||||
FXCollections.observableArrayList(
|
FXCollections.observableArrayList(
|
||||||
"Buns", "Patties", "Lettuce", "Onions", "Tomato",
|
"Buns", "Patties", "Lettuce", "Onions", "Tomato",
|
||||||
@@ -107,69 +98,49 @@ public class App extends Application {
|
|||||||
}
|
}
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
updateMessage("Burger's done!");
|
updateMessage("Burger's done!");
|
||||||
|
|
||||||
return addedFilling;
|
return addedFilling;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
showSplash(
|
showSplash(
|
||||||
initStage,
|
stage,
|
||||||
boatTask,
|
boatTask,
|
||||||
() -> {
|
() -> {
|
||||||
try {
|
try {
|
||||||
showMainStage(new Stage());
|
loadTitleScreen();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
new Thread(boatTask).start();
|
new Thread(boatTask).start();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get main stage
|
* Get the main stage to be shared for all regular game play scenes.
|
||||||
* @return main stage
|
* @return shared stage
|
||||||
*/
|
*/
|
||||||
public static Stage getStage() {
|
public static Stage getStage() {
|
||||||
return App.stage;
|
return App.stage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set main stage
|
* Loads the title screen for the first time on app start.
|
||||||
* @param stage stage to set main stage
|
* @throws Exception if there is a problem with a resource loaded
|
||||||
*/
|
*/
|
||||||
public static void setStage(Stage stage) {
|
private void loadTitleScreen() throws Exception {
|
||||||
App.stage = stage;
|
stage = new Stage();
|
||||||
}
|
FXMLLoader loader = new FXMLLoader(getClass().getResource
|
||||||
|
("/visualiser/scenes/title.fxml"));
|
||||||
/**
|
|
||||||
* Show the main stage after the splash screen
|
|
||||||
* @param stage main stage for application
|
|
||||||
* @throws Exception Throws an exception on error
|
|
||||||
*/
|
|
||||||
public void showMainStage(Stage stage) throws Exception {
|
|
||||||
App.stage = stage;
|
|
||||||
App.app = this;
|
|
||||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("/visualiser/scenes/main.fxml"));
|
|
||||||
Parent root = loader.load();
|
Parent root = loader.load();
|
||||||
stage.setResizable(false);
|
stage.setResizable(false);
|
||||||
MainController mc = (MainController) loader.getController();
|
|
||||||
mc.enterTitle();
|
|
||||||
Scene scene = new Scene(root);
|
Scene scene = new Scene(root);
|
||||||
|
stage.setTitle("The Boat Game - Burgers & Boats");
|
||||||
stage.setScene(scene);
|
|
||||||
stage.setTitle("RaceVision - Team 7");
|
|
||||||
stage.getIcons().add(new Image(getClass().getClassLoader().getResourceAsStream("images/SailIcon.png")));
|
stage.getIcons().add(new Image(getClass().getClassLoader().getResourceAsStream("images/SailIcon.png")));
|
||||||
mc.startCss();
|
stage.setScene(scene);
|
||||||
setStage(stage);
|
|
||||||
stage.show();
|
stage.show();
|
||||||
stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
|
stage.setOnCloseRequest(event -> {
|
||||||
@Override
|
|
||||||
public void handle(WindowEvent event) {
|
|
||||||
Platform.exit();
|
Platform.exit();
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,6 @@
|
|||||||
package visualiser.enums;
|
package visualiser.enums;
|
||||||
|
|
||||||
import javafx.scene.input.KeyCode;
|
|
||||||
import network.Messages.BoatAction;
|
|
||||||
import network.Messages.Enums.BoatActionEnum;
|
import network.Messages.Enums.BoatActionEnum;
|
||||||
import visualiser.gameController.Keys.ControlKey;
|
|
||||||
import static visualiser.app.App.keyFactory;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* State of which stage the tutorial is currently in
|
* State of which stage the tutorial is currently in
|
||||||
|
|||||||
@@ -3,15 +3,14 @@ package visualiser.gameController;
|
|||||||
import javafx.animation.AnimationTimer;
|
import javafx.animation.AnimationTimer;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import visualiser.gameController.Keys.ControlKey;
|
import visualiser.gameController.Keys.ControlKey;
|
||||||
|
import visualiser.gameController.Keys.KeyFactory;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import static visualiser.app.App.keyFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for checking what keys are currently being used
|
* Class for checking what keys are currently being used
|
||||||
*/
|
*/
|
||||||
public class InputChecker {
|
public class InputChecker {
|
||||||
|
private KeyFactory keyFactory;
|
||||||
private HashMap<String, Boolean> currentlyActiveKeys = new HashMap<>();
|
private HashMap<String, Boolean> currentlyActiveKeys = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -19,7 +18,8 @@ public class InputChecker {
|
|||||||
* @param scene Scene the controller is to run in parallel with.
|
* @param scene Scene the controller is to run in parallel with.
|
||||||
*/
|
*/
|
||||||
public void runWithScene(Scene scene){
|
public void runWithScene(Scene scene){
|
||||||
// KeyFactory keyFactory = KeyFactory.getFactory();
|
KeyFactory keyFactory = new KeyFactory();
|
||||||
|
keyFactory.load();
|
||||||
|
|
||||||
scene.setOnKeyPressed(event -> {
|
scene.setOnKeyPressed(event -> {
|
||||||
String codeString = event.getCode().toString();
|
String codeString = event.getCode().toString();
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import java.util.Map;
|
|||||||
* Class that processes user selected annotation visibility options to
|
* Class that processes user selected annotation visibility options to
|
||||||
* display the requested information on the
|
* display the requested information on the
|
||||||
* {@link ResizableRaceCanvas}. These are displayed
|
* {@link ResizableRaceCanvas}. These are displayed
|
||||||
* via the {@link visualiser.Controllers.RaceController}. <br>
|
* via the {@link visualiser.Controllers.RaceViewController}. <br>
|
||||||
* Annotation options for a {@link VisualiserBoat} include: its name,
|
* Annotation options for a {@link VisualiserBoat} include: its name,
|
||||||
* abbreviation, speed, the time since it passed the last
|
* abbreviation, speed, the time since it passed the last
|
||||||
* {@link shared.model.Mark}, estimated time to the next marker,
|
* {@link shared.model.Mark}, estimated time to the next marker,
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* This JavaFX Canvas is used to update and display details for a
|
* This JavaFX Canvas is used to update and display details for a
|
||||||
* {@link RaceMap} via the
|
* {@link RaceMap} via the
|
||||||
* {@link visualiser.Controllers.RaceController}.<br>
|
* {@link visualiser.Controllers.RaceViewController}.<br>
|
||||||
* It fills it's parent and cannot be downsized. <br>
|
* It fills it's parent and cannot be downsized. <br>
|
||||||
* Details displayed include:
|
* Details displayed include:
|
||||||
* {@link VisualiserBoat}s (and their
|
* {@link VisualiserBoat}s (and their
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import java.util.Map;
|
|||||||
* placing position as they complete each {@link shared.model.Leg} by
|
* placing position as they complete each {@link shared.model.Leg} by
|
||||||
* passing a course {@link shared.model.Mark}. <br>
|
* passing a course {@link shared.model.Mark}. <br>
|
||||||
* This sparkline is displayed using the
|
* This sparkline is displayed using the
|
||||||
* {@link visualiser.Controllers.RaceController}.
|
* {@link visualiser.Controllers.RaceViewController}.
|
||||||
*/
|
*/
|
||||||
public class Sparkline {
|
public class Sparkline {
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import shared.model.GPSCoordinate;
|
|||||||
* {@link VisualiserBoat Boat} has travelled in a race. <br>
|
* {@link VisualiserBoat Boat} has travelled in a race. <br>
|
||||||
* TrackPoints are displayed on a
|
* TrackPoints are displayed on a
|
||||||
* {@link ResizableRaceCanvas}, via the
|
* {@link ResizableRaceCanvas}, via the
|
||||||
* {@link visualiser.Controllers.RaceController}. <br>
|
* {@link visualiser.Controllers.RaceViewController}. <br>
|
||||||
* Track points can be made visible or hidden via the RaceController's
|
* Track points can be made visible or hidden via the RaceViewController's
|
||||||
* {@link Annotations}.
|
* {@link Annotations}.
|
||||||
*/
|
*/
|
||||||
public class TrackPoint {
|
public class TrackPoint {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import java.util.List;
|
|||||||
* This class is used to represent and store information about a boat which may
|
* This class is used to represent and store information about a boat which may
|
||||||
* travel around in a race. It is displayed on the
|
* travel around in a race. It is displayed on the
|
||||||
* {@link ResizableRaceCanvas ResizableRaceCanvas} via the
|
* {@link ResizableRaceCanvas ResizableRaceCanvas} via the
|
||||||
* {@link visualiser.Controllers.RaceController RaceController}.
|
* {@link visualiser.Controllers.RaceViewController RaceViewController}.
|
||||||
*/
|
*/
|
||||||
public class VisualiserBoat extends Boat {
|
public class VisualiserBoat extends Boat {
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public class VisualiserRaceEvent {
|
|||||||
|
|
||||||
|
|
||||||
this.serverConnection = new ServerConnection(socket, visualiserRaceState, raceCommands, requestType);
|
this.serverConnection = new ServerConnection(socket, visualiserRaceState, raceCommands, requestType);
|
||||||
this.serverConnectionThread = new Thread(serverConnection, "StartController.enterLobby()->serverConnection thread " + serverConnection);
|
this.serverConnectionThread = new Thread(serverConnection, "RaceStartController.enterLobby()->serverConnection thread " + serverConnection);
|
||||||
this.serverConnectionThread.start();
|
this.serverConnectionThread.start();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,14 +7,12 @@ import network.MessageRouters.MessageRouter;
|
|||||||
import network.Messages.AC35Data;
|
import network.Messages.AC35Data;
|
||||||
import network.Messages.Enums.MessageType;
|
import network.Messages.Enums.MessageType;
|
||||||
import network.Messages.Enums.RequestToJoinEnum;
|
import network.Messages.Enums.RequestToJoinEnum;
|
||||||
import network.Messages.LatestMessages;
|
|
||||||
import network.StreamRelated.MessageDeserialiser;
|
import network.StreamRelated.MessageDeserialiser;
|
||||||
import network.StreamRelated.MessageSerialiser;
|
import network.StreamRelated.MessageSerialiser;
|
||||||
import shared.model.RunnableWithFramePeriod;
|
import shared.model.RunnableWithFramePeriod;
|
||||||
import visualiser.model.VisualiserRaceEvent;
|
|
||||||
import visualiser.model.VisualiserRaceController;
|
|
||||||
import visualiser.enums.ConnectionToServerState;
|
import visualiser.enums.ConnectionToServerState;
|
||||||
import visualiser.gameController.ControllerClient;
|
import visualiser.gameController.ControllerClient;
|
||||||
|
import visualiser.model.VisualiserRaceController;
|
||||||
import visualiser.model.VisualiserRaceState;
|
import visualiser.model.VisualiserRaceState;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -310,7 +308,7 @@ public class ServerConnection implements RunnableWithFramePeriod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//TODO create input controller here. RaceController should query for it, if it exists.
|
//TODO create input controller here. RaceViewController should query for it, if it exists.
|
||||||
private void createPlayerInputController() {
|
private void createPlayerInputController() {
|
||||||
|
|
||||||
this.messageRouter.addRoute(MessageType.BOATACTION, messageSerialiser.getMessagesToSend());
|
this.messageRouter.addRoute(MessageType.BOATACTION, messageSerialiser.getMessagesToSend());
|
||||||
|
|||||||
@@ -1,82 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.geometry.Insets?>
|
|
||||||
<?import javafx.scene.control.Button?>
|
|
||||||
<?import javafx.scene.control.Label?>
|
|
||||||
<?import javafx.scene.control.TableColumn?>
|
|
||||||
<?import javafx.scene.control.TableView?>
|
|
||||||
<?import javafx.scene.control.TextField?>
|
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
|
||||||
<?import javafx.scene.layout.ColumnConstraints?>
|
|
||||||
<?import javafx.scene.layout.GridPane?>
|
|
||||||
<?import javafx.scene.layout.RowConstraints?>
|
|
||||||
<?import javafx.scene.text.Font?>
|
|
||||||
|
|
||||||
<AnchorPane fx:id="connectionWrapper" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="780.0" visible="false" xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.ConnectionController">
|
|
||||||
<children>
|
|
||||||
<GridPane fx:id="connection" prefHeight="600.0" prefWidth="780.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="600.0" minWidth="10.0" prefWidth="600.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="600.0" minWidth="10.0" prefWidth="600.0" />
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<RowConstraints maxHeight="182.0" minHeight="10.0" prefHeight="182.0" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints maxHeight="434.0" minHeight="10.0" prefHeight="434.0" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints maxHeight="174.0" minHeight="10.0" prefHeight="174.0" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints maxHeight="80.0" minHeight="50.0" prefHeight="80.0" vgrow="SOMETIMES" />
|
|
||||||
</rowConstraints>
|
|
||||||
<children>
|
|
||||||
<TableView fx:id="connectionTable" prefHeight="200.0" prefWidth="1080.0" GridPane.columnSpan="2" GridPane.rowIndex="1">
|
|
||||||
<columns>
|
|
||||||
<TableColumn fx:id="hostnameColumn" prefWidth="453.99998474121094" text="Host" />
|
|
||||||
<TableColumn fx:id="statusColumn" prefWidth="205.0" text="Status" />
|
|
||||||
</columns>
|
|
||||||
<GridPane.margin>
|
|
||||||
<Insets left="50.0" right="50.0" />
|
|
||||||
</GridPane.margin>
|
|
||||||
</TableView>
|
|
||||||
<Button mnemonicParsing="false" onAction="#checkConnections" text="Refresh" GridPane.halignment="RIGHT" GridPane.rowIndex="3">
|
|
||||||
<GridPane.margin>
|
|
||||||
<Insets right="20.0" />
|
|
||||||
</GridPane.margin>
|
|
||||||
</Button>
|
|
||||||
<Button fx:id="connectButton" mnemonicParsing="false" onAction="#connectSocket" text="Connect" GridPane.columnIndex="1" GridPane.halignment="LEFT" GridPane.rowIndex="3">
|
|
||||||
<GridPane.margin>
|
|
||||||
<Insets left="20.0" />
|
|
||||||
</GridPane.margin>
|
|
||||||
</Button>
|
|
||||||
<Label text="Welcome to RaceVision" GridPane.columnSpan="2" GridPane.halignment="CENTER">
|
|
||||||
<font>
|
|
||||||
<Font size="36.0" />
|
|
||||||
</font>
|
|
||||||
</Label>
|
|
||||||
<GridPane GridPane.columnSpan="2" GridPane.rowIndex="2">
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
|
||||||
</rowConstraints>
|
|
||||||
<children>
|
|
||||||
<TextField fx:id="urlField" GridPane.rowIndex="1">
|
|
||||||
<GridPane.margin>
|
|
||||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
|
||||||
</GridPane.margin>
|
|
||||||
</TextField>
|
|
||||||
<TextField fx:id="portField" GridPane.columnIndex="1" GridPane.rowIndex="1">
|
|
||||||
<GridPane.margin>
|
|
||||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
|
||||||
</GridPane.margin>
|
|
||||||
</TextField>
|
|
||||||
<Button mnemonicParsing="false" onAction="#addConnection" text="Add New Connection" GridPane.columnIndex="2" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="CENTER" />
|
|
||||||
<Label text="Host Name:" GridPane.halignment="CENTER" GridPane.valignment="BOTTOM" />
|
|
||||||
<Label text="Port:" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.valignment="BOTTOM" />
|
|
||||||
</children>
|
|
||||||
</GridPane>
|
|
||||||
</children>
|
|
||||||
</GridPane>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.scene.image.*?>
|
|
||||||
<?import java.lang.*?>
|
|
||||||
<?import javafx.scene.layout.*?>
|
|
||||||
|
|
||||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="350.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
|
|
||||||
<children>
|
|
||||||
<ImageView fitHeight="385.0" fitWidth="600.0" layoutY="-2.0" pickOnBounds="true" preserveRatio="true" AnchorPane.bottomAnchor="-1.9456787109375" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="-2.0">
|
|
||||||
<image>
|
|
||||||
<Image url="@../images/game_controls.png" />
|
|
||||||
</image>
|
|
||||||
</ImageView>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.geometry.Insets?>
|
||||||
|
<?import javafx.scene.control.Button?>
|
||||||
|
<?import javafx.scene.control.Label?>
|
||||||
|
<?import javafx.scene.image.ImageView?>
|
||||||
|
<?import javafx.scene.layout.AnchorPane?>
|
||||||
|
<?import javafx.scene.layout.ColumnConstraints?>
|
||||||
|
<?import javafx.scene.layout.GridPane?>
|
||||||
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
|
<AnchorPane fx:id="hostWrapper" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="780.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.HostGameController">
|
||||||
|
<children>
|
||||||
|
<GridPane layoutY="14.0" AnchorPane.bottomAnchor="-14.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="14.0">
|
||||||
|
<columnConstraints>
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES" maxWidth="170.0" minWidth="10.0" prefWidth="170.0" />
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES" maxWidth="170.0" minWidth="10.0" prefWidth="170.0" />
|
||||||
|
</columnConstraints>
|
||||||
|
<rowConstraints>
|
||||||
|
<RowConstraints maxHeight="60.0" minHeight="60.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
|
<RowConstraints minHeight="10.0" prefHeight="435.0" vgrow="SOMETIMES" />
|
||||||
|
<RowConstraints maxHeight="80.0" minHeight="80.0" prefHeight="80.0" vgrow="SOMETIMES" />
|
||||||
|
</rowConstraints>
|
||||||
|
<children>
|
||||||
|
<Button fx:id="hostGameBtn" mnemonicParsing="false" onAction="#hostGamePressed" text="Start Game" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="2" GridPane.valignment="CENTER">
|
||||||
|
<font>
|
||||||
|
<Font size="20.0" />
|
||||||
|
</font>
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
|
||||||
|
</GridPane.margin>
|
||||||
|
</Button>
|
||||||
|
<Label text="Address: 127.0.0.1" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.valignment="TOP">
|
||||||
|
<font>
|
||||||
|
<Font size="17.0" />
|
||||||
|
</font>
|
||||||
|
</Label>
|
||||||
|
<Label text="Port: 4942" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.valignment="BOTTOM">
|
||||||
|
<font>
|
||||||
|
<Font size="17.0" />
|
||||||
|
</font>
|
||||||
|
</Label>
|
||||||
|
<Button mnemonicParsing="false" onAction="#menuBtnPressed" text="Main Menu" GridPane.halignment="LEFT" GridPane.valignment="TOP">
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||||
|
</GridPane.margin>
|
||||||
|
</Button>
|
||||||
|
<ImageView fx:id="mapImage" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.hgrow="ALWAYS" GridPane.rowIndex="1" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS" />
|
||||||
|
<Button fx:id="previousButton" maxHeight="80.0" maxWidth="80.0" mnemonicParsing="false" onAction="#previousImage" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="CENTER" />
|
||||||
|
<Button fx:id="nextButton" maxHeight="80.0" maxWidth="80.0" mnemonicParsing="false" onAction="#nextImage" GridPane.columnIndex="2" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="CENTER" />
|
||||||
|
</children>
|
||||||
|
</GridPane>
|
||||||
|
</children>
|
||||||
|
</AnchorPane>
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import java.lang.*?>
|
|
||||||
<?import javafx.geometry.*?>
|
|
||||||
<?import javafx.scene.control.*?>
|
|
||||||
<?import javafx.scene.image.*?>
|
|
||||||
<?import javafx.scene.layout.*?>
|
|
||||||
<?import javafx.scene.text.*?>
|
|
||||||
<?import javafx.geometry.Insets?>
|
|
||||||
<?import javafx.scene.control.Button?>
|
|
||||||
<?import javafx.scene.control.Label?>
|
|
||||||
<?import javafx.scene.image.ImageView?>
|
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
|
||||||
<?import javafx.scene.layout.ColumnConstraints?>
|
|
||||||
<?import javafx.scene.layout.GridPane?>
|
|
||||||
<?import javafx.scene.layout.RowConstraints?>
|
|
||||||
<?import javafx.scene.text.Font?>
|
|
||||||
|
|
||||||
<AnchorPane fx:id="hostWrapper" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="780.0" visible="false" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.HostController">
|
|
||||||
<children>
|
|
||||||
<GridPane layoutY="14.0" AnchorPane.bottomAnchor="-14.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="14.0">
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="170.0" minWidth="10.0" prefWidth="170.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="170.0" minWidth="10.0" prefWidth="170.0" />
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<RowConstraints maxHeight="60.0" minHeight="60.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="435.0" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints maxHeight="80.0" minHeight="80.0" prefHeight="80.0" vgrow="SOMETIMES" />
|
|
||||||
</rowConstraints>
|
|
||||||
<children>
|
|
||||||
<Button fx:id="hostGameBtn" mnemonicParsing="false" onAction="#hostGamePressed" text="Start Game" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="2" GridPane.valignment="CENTER">
|
|
||||||
<font>
|
|
||||||
<Font size="20.0" />
|
|
||||||
</font>
|
|
||||||
<GridPane.margin>
|
|
||||||
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
|
|
||||||
</GridPane.margin>
|
|
||||||
</Button>
|
|
||||||
<Label text="Address: 127.0.0.1" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.valignment="TOP">
|
|
||||||
<font>
|
|
||||||
<Font size="17.0" />
|
|
||||||
</font>
|
|
||||||
</Label>
|
|
||||||
<Label text="Port: 4942" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.valignment="BOTTOM">
|
|
||||||
<font>
|
|
||||||
<Font size="17.0" />
|
|
||||||
</font>
|
|
||||||
</Label>
|
|
||||||
<Button mnemonicParsing="false" onAction="#menuBtnPressed" text="Main Menu" GridPane.halignment="LEFT" GridPane.valignment="TOP">
|
|
||||||
<GridPane.margin>
|
|
||||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
|
||||||
</GridPane.margin></Button>
|
|
||||||
<ImageView fx:id="mapImage" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.hgrow="ALWAYS" GridPane.rowIndex="1" GridPane.valignment="CENTER" GridPane.vgrow="ALWAYS" />
|
|
||||||
<Button fx:id="previousButton" maxHeight="80.0" maxWidth="80.0" mnemonicParsing="false" onAction="#previousImage" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="CENTER" />
|
|
||||||
<Button fx:id="nextButton" maxHeight="80.0" maxWidth="80.0" mnemonicParsing="false" onAction="#nextImage" GridPane.columnIndex="2" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="CENTER" />
|
|
||||||
</children>
|
|
||||||
</GridPane>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
||||||
@@ -1,10 +1,5 @@
|
|||||||
<?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 javafx.scene.text.*?>
|
|
||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.scene.control.Button?>
|
<?import javafx.scene.control.Button?>
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
@@ -17,7 +12,7 @@
|
|||||||
<?import javafx.scene.layout.RowConstraints?>
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
<AnchorPane fx:id="lobbyWrapper" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="780.0" visible="false" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.LobbyController">
|
<AnchorPane fx:id="lobbyWrapper" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="780.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.LobbyController">
|
||||||
<children>
|
<children>
|
||||||
<GridPane fx:id="connection" prefHeight="600.0" prefWidth="780.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<GridPane fx:id="connection" prefHeight="600.0" prefWidth="780.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
|
||||||
<AnchorPane fx:id="main" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.MainController">
|
|
||||||
<children>
|
|
||||||
<fx:include fx:id="race" source="race.fxml" />
|
|
||||||
<fx:include fx:id="start" source="start.fxml" />
|
|
||||||
<fx:include fx:id="connection" source="connect.fxml" />
|
|
||||||
<fx:include fx:id="finish" source="finish.fxml" />
|
|
||||||
<fx:include fx:id="host" source="hostgame.fxml" />
|
|
||||||
<fx:include fx:id="title" source="titleScreen.fxml" />
|
|
||||||
<fx:include fx:id="lobby" source="lobby.fxml" />
|
|
||||||
<fx:include fx:id="inGameLobby" source="gameLobby.fxml" />
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
||||||
+9
-3
@@ -1,9 +1,15 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.Label?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.control.TableColumn?>
|
||||||
|
<?import javafx.scene.control.TableView?>
|
||||||
|
<?import javafx.scene.layout.AnchorPane?>
|
||||||
|
<?import javafx.scene.layout.ColumnConstraints?>
|
||||||
|
<?import javafx.scene.layout.GridPane?>
|
||||||
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
<AnchorPane fx:id="finishWrapper" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" visible="false" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.FinishController">
|
|
||||||
|
<AnchorPane fx:id="finishWrapper" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.RaceFinishController">
|
||||||
<children>
|
<children>
|
||||||
<GridPane fx:id="start" alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="600.0" prefWidth="780.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<GridPane fx:id="start" alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="600.0" prefWidth="780.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
+9
-3
@@ -1,9 +1,15 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.Label?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.control.TableColumn?>
|
||||||
|
<?import javafx.scene.control.TableView?>
|
||||||
|
<?import javafx.scene.layout.AnchorPane?>
|
||||||
|
<?import javafx.scene.layout.ColumnConstraints?>
|
||||||
|
<?import javafx.scene.layout.GridPane?>
|
||||||
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
<AnchorPane fx:id="startWrapper" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" visible="false" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.StartController">
|
|
||||||
|
<AnchorPane fx:id="startWrapper" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.RaceStartController">
|
||||||
<children>
|
<children>
|
||||||
<GridPane fx:id="start" prefHeight="600.0" prefWidth="780.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<GridPane fx:id="start" prefHeight="600.0" prefWidth="780.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
+5
-1
@@ -28,7 +28,11 @@
|
|||||||
<?import javafx.scene.layout.StackPane?>
|
<?import javafx.scene.layout.StackPane?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
<SplitPane fx:id="racePane" dividerPositions="1.0" prefHeight="431.0" prefWidth="610.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.RaceController">
|
<SplitPane fx:id="racePane" dividerPositions="1.0" prefHeight="431.0"
|
||||||
|
prefWidth="610.0" visible="true" AnchorPane.bottomAnchor="0.0"
|
||||||
|
AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
|
||||||
|
AnchorPane.topAnchor="0.0" xmlns="http://javafx.com/javafx/8.0.65"
|
||||||
|
xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.RaceViewController">
|
||||||
<items>
|
<items>
|
||||||
<StackPane fx:id="newPane" prefHeight="150.0" prefWidth="200.0">
|
<StackPane fx:id="newPane" prefHeight="150.0" prefWidth="200.0">
|
||||||
<children>
|
<children>
|
||||||
@@ -1,61 +1,94 @@
|
|||||||
<!--<?xml version="1.0" encoding="UTF-8"?>-->
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<!--<?import javafx.geometry.*?>-->
|
<?import javafx.scene.control.Button?>
|
||||||
<!--<?import javafx.scene.control.*?>-->
|
<?import javafx.scene.control.Label?>
|
||||||
<!--<?import javafx.scene.layout.*?>-->
|
<?import javafx.scene.control.RadioButton?>
|
||||||
<!--<?import javafx.scene.text.Font?>-->
|
<?import javafx.scene.image.Image?>
|
||||||
<!--<AnchorPane fx:id="connectionWrapper" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="780.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.ConnectionController">-->
|
<?import javafx.scene.image.ImageView?>
|
||||||
<!--<children>-->
|
<?import javafx.scene.layout.AnchorPane?>
|
||||||
<!--<GridPane AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">-->
|
<?import javafx.scene.layout.ColumnConstraints?>
|
||||||
<!--<columnConstraints>-->
|
<?import javafx.scene.layout.GridPane?>
|
||||||
<!--<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />-->
|
<?import javafx.scene.layout.Pane?>
|
||||||
<!--<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />-->
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
<!--<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />-->
|
<?import javafx.scene.text.Font?>
|
||||||
<!--</columnConstraints>-->
|
<?import javafx.scene.text.Text?>
|
||||||
<!--<rowConstraints>-->
|
|
||||||
<!--<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />-->
|
<AnchorPane fx:id="titleWrapper" maxHeight="600.0" maxWidth="800.0" minHeight="600.0" minWidth="800.0" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.TitleController">
|
||||||
<!--<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />-->
|
<children>
|
||||||
<!--<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />-->
|
<GridPane layoutY="39.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="500.0" prefWidth="800.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<!--</rowConstraints>-->
|
<columnConstraints>
|
||||||
<!--<children>-->
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||||
<!--<Button fx:id="hostGameTitleBtn" maxWidth="204.0" mnemonicParsing="false" text="Host Game" GridPane.halignment="LEFT" GridPane.rowIndex="1">-->
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||||
<!--<font>-->
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||||
<!--<Font size="20.0" />-->
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||||
<!--</font>-->
|
</columnConstraints>
|
||||||
<!--<GridPane.margin>-->
|
<rowConstraints>
|
||||||
<!--<Insets left="50.0" />-->
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
<!--</GridPane.margin>-->
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
<!--</Button>-->
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
<!--<Button fx:id="connectGameBtn" maxWidth="204.0" mnemonicParsing="false" text="Connect to Game" GridPane.columnIndex="2" GridPane.halignment="RIGHT" GridPane.rowIndex="1">-->
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
<!--<font>-->
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
<!--<Font size="20.0" />-->
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
<!--</font>-->
|
</rowConstraints>
|
||||||
<!--<GridPane.margin>-->
|
<children>
|
||||||
<!--<Insets right="50.0" />-->
|
<Pane prefHeight="20.0" prefWidth="20.0" style="-fx-background-color: #0061ff;" GridPane.columnSpan="4" GridPane.rowIndex="4" GridPane.rowSpan="2">
|
||||||
<!--</GridPane.margin>-->
|
<children>
|
||||||
<!--</Button>-->
|
<Text fx:id="txtTitle" layoutX="167.0" layoutY="136.0" strokeType="OUTSIDE" strokeWidth="0.0" text="The Boat Game!">
|
||||||
<!--<RadioButton fx:id="nightRadioBtn" mnemonicParsing="false" text="Night Mode" GridPane.columnIndex="1" GridPane.halignment="LEFT" GridPane.rowIndex="2">-->
|
<font>
|
||||||
<!--<padding>-->
|
<Font name="Comic Sans MS" size="64.0" />
|
||||||
<!--<Insets bottom="-50.0" />-->
|
</font>
|
||||||
<!--</padding>-->
|
</Text>
|
||||||
<!--<GridPane.margin>-->
|
<Text layoutX="690.0" layoutY="80.0" strokeType="OUTSIDE" strokeWidth="0.0" text="TM">
|
||||||
<!--<Insets left="80.0" />-->
|
<font>
|
||||||
<!--</GridPane.margin>-->
|
<Font name="Comic Sans MS" size="12.0" />
|
||||||
<!--</RadioButton>-->
|
</font>
|
||||||
<!--<RadioButton fx:id="dayRadioBtn" mnemonicParsing="false" text="Day Mode" GridPane.columnIndex="1" GridPane.halignment="LEFT" GridPane.rowIndex="2">-->
|
</Text>
|
||||||
<!--<padding>-->
|
<RadioButton fx:id="nightModeRD" layoutX="681.0" layoutY="168.0" mnemonicParsing="false" onAction="#setNightMode" text="Night Mode" />
|
||||||
<!--<Insets top="-50.0" />-->
|
<RadioButton fx:id="dayModeRD" layoutX="574.0" layoutY="168.0" mnemonicParsing="false" onAction="#setDayMode" selected="true" text="Day Mode" />
|
||||||
<!--</padding>-->
|
<Button layoutX="28.0" layoutY="152.0" mnemonicParsing="false" onAction="#showControls" text="Controls" />
|
||||||
<!--<GridPane.margin>-->
|
</children>
|
||||||
<!--<Insets left="80.0" />-->
|
</Pane>
|
||||||
<!--</GridPane.margin>-->
|
<Pane fx:id="menuPane" prefHeight="20.0" prefWidth="20.0" style="-fx-background-color: #6be6ff;" GridPane.columnSpan="4" GridPane.rowSpan="4">
|
||||||
<!--</RadioButton>-->
|
<children>
|
||||||
<!--<Label text="Game" textAlignment="CENTER" GridPane.columnIndex="1" GridPane.halignment="CENTER">-->
|
<ImageView fx:id="imgBoat" fitHeight="404.0" fitWidth="296.0" layoutX="268.0" pickOnBounds="true" preserveRatio="true">
|
||||||
<!--<font>-->
|
<image>
|
||||||
<!--<Font size="60.0" />-->
|
<Image url="@../images/boat.png" />
|
||||||
<!--</font>-->
|
</image>
|
||||||
<!--</Label>-->
|
</ImageView>
|
||||||
<!--</children>-->
|
<ImageView fx:id="imgCloud1" fitHeight="291.0" fitWidth="307.0" pickOnBounds="true" preserveRatio="true">
|
||||||
<!--</GridPane>-->
|
<image>
|
||||||
<!--</children>-->
|
<Image url="@../images/cloud.png" />
|
||||||
<!--</AnchorPane>-->
|
</image>
|
||||||
|
</ImageView>
|
||||||
|
<ImageView fx:id="imgWhale" fitHeight="113.0" fitWidth="98.0" layoutX="69.0" layoutY="302.0" pickOnBounds="true" preserveRatio="true">
|
||||||
|
<image>
|
||||||
|
<Image url="@../images/whale.png" />
|
||||||
|
</image>
|
||||||
|
</ImageView>
|
||||||
|
<ImageView fx:id="imgCloud2" fitHeight="291.0" fitWidth="307.0" layoutX="501.0" pickOnBounds="true" preserveRatio="true">
|
||||||
|
<image>
|
||||||
|
<Image url="@../images/cloud.png" />
|
||||||
|
</image>
|
||||||
|
</ImageView>
|
||||||
|
<ImageView fx:id="imgSun" fitHeight="154.0" fitWidth="145.0" layoutX="701.0" layoutY="-39.0" pickOnBounds="true" preserveRatio="true">
|
||||||
|
<image>
|
||||||
|
<Image url="@../images/sun.png" />
|
||||||
|
</image>
|
||||||
|
</ImageView>
|
||||||
|
<Button fx:id="btnJoin" layoutX="78.0" layoutY="149.0" mnemonicParsing="false" onAction="#joinAGame" prefHeight="31.0" prefWidth="130.0" text="Join a Game">
|
||||||
|
<font>
|
||||||
|
<Font name="Comic Sans MS Bold" size="16.0" />
|
||||||
|
</font>
|
||||||
|
</Button>
|
||||||
|
<Button layoutX="578.0" layoutY="150.0" mnemonicParsing="false" onAction="#hostAGame" prefHeight="31.0" prefWidth="130.0" text="Host a Game">
|
||||||
|
<font>
|
||||||
|
<Font name="Comic Sans MS Bold" size="16.0" />
|
||||||
|
</font>
|
||||||
|
</Button>
|
||||||
|
<Label fx:id="tutorialLabel" alignment="CENTER" layoutX="94.0" layoutY="223.0" onMouseClicked="#tutorialStartPressed" prefHeight="167.0" prefWidth="206.0" style="-fx-shape: "M 45.673,0 C 67.781,0 85.703,12.475 85.703,27.862 C 85.703,43.249 67.781,55.724 45.673,55.724 C 38.742,55.724 32.224,54.497 26.539,52.34 C 15.319,56.564 0,64.542 0,64.542 C 0,64.542 9.989,58.887 14.107,52.021 C 15.159,50.266 15.775,48.426 16.128,46.659 C 9.618,41.704 5.643,35.106 5.643,27.862 C 5.643,12.475 23.565,0 45.673,0 M 45.673,2.22 C 24.824,2.22 7.862,13.723 7.862,27.863 C 7.862,34.129 11.275,40.177 17.472,44.893 L 18.576,45.734 L 18.305,47.094 C 17.86,49.324 17.088,51.366 16.011,53.163 C 15.67,53.73 15.294,54.29 14.891,54.837 C 18.516,53.191 22.312,51.561 25.757,50.264 L 26.542,49.968 L 27.327,50.266 C 32.911,52.385 39.255,53.505 45.673,53.505 C 66.522,53.505 83.484,42.002 83.484,27.862 C 83.484,13.722 66.522,2.22 45.673,2.22 L 45.673,2.22 z "; -fx-background-color: black, white; -fx-background-insets: 0,1; -fx-padding: 50;" text="How do you play this game? Click here!" textAlignment="CENTER" wrapText="true" />
|
||||||
|
</children>
|
||||||
|
</Pane>
|
||||||
|
</children>
|
||||||
|
</GridPane>
|
||||||
|
</children>
|
||||||
|
</AnchorPane>
|
||||||
|
|||||||
@@ -1,89 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import java.lang.*?>
|
|
||||||
<?import javafx.scene.control.*?>
|
|
||||||
<?import javafx.scene.control.Button?>
|
|
||||||
<?import javafx.scene.control.RadioButton?>
|
|
||||||
<?import javafx.scene.image.*?>
|
|
||||||
<?import javafx.scene.layout.*?>
|
|
||||||
<?import javafx.scene.text.*?>
|
|
||||||
|
|
||||||
<AnchorPane fx:id="titleWrapper" maxHeight="600.0" maxWidth="800.0" minHeight="600.0" minWidth="800.0" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.TitleController">
|
|
||||||
<children>
|
|
||||||
<GridPane layoutY="39.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="500.0" prefWidth="800.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<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" prefHeight="30.0" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
|
||||||
</rowConstraints>
|
|
||||||
<children>
|
|
||||||
<Pane prefHeight="20.0" prefWidth="20.0" style="-fx-background-color: #0061ff;" GridPane.columnSpan="4" GridPane.rowIndex="4" GridPane.rowSpan="2">
|
|
||||||
<children>
|
|
||||||
<Text fx:id="txtTitle" layoutX="167.0" layoutY="136.0" strokeType="OUTSIDE" strokeWidth="0.0" text="The Boat Game!">
|
|
||||||
<font>
|
|
||||||
<Font name="Comic Sans MS" size="64.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
<Text layoutX="690.0" layoutY="80.0" strokeType="OUTSIDE" strokeWidth="0.0" text="TM">
|
|
||||||
<font>
|
|
||||||
<Font name="Comic Sans MS" size="12.0" />
|
|
||||||
</font>
|
|
||||||
</Text>
|
|
||||||
<RadioButton fx:id="nightModeRD" layoutX="681.0" layoutY="168.0" mnemonicParsing="false" onAction="#setNightMode" text="Night Mode" />
|
|
||||||
<RadioButton fx:id="dayModeRD" layoutX="574.0" layoutY="168.0" mnemonicParsing="false" onAction="#setDayMode" selected="true" text="Day Mode" />
|
|
||||||
<Button layoutX="28.0" layoutY="152.0" mnemonicParsing="false" onAction="#controlBtnPressed" text="Controls" />
|
|
||||||
</children>
|
|
||||||
</Pane>
|
|
||||||
<Pane fx:id="menuPane" prefHeight="20.0" prefWidth="20.0" style="-fx-background-color: #6be6ff;" GridPane.columnSpan="4" GridPane.rowSpan="4">
|
|
||||||
<children>
|
|
||||||
<ImageView fx:id="imgBoat" fitHeight="404.0" fitWidth="296.0" layoutX="268.0" pickOnBounds="true" preserveRatio="true">
|
|
||||||
<image>
|
|
||||||
<Image url="@../images/boat.png" />
|
|
||||||
</image>
|
|
||||||
</ImageView>
|
|
||||||
<ImageView fx:id="imgCloud1" fitHeight="291.0" fitWidth="307.0" pickOnBounds="true" preserveRatio="true">
|
|
||||||
<image>
|
|
||||||
<Image url="@../images/cloud.png" />
|
|
||||||
</image>
|
|
||||||
</ImageView>
|
|
||||||
<ImageView fx:id="imgWhale" fitHeight="113.0" fitWidth="98.0" layoutX="69.0" layoutY="302.0" pickOnBounds="true" preserveRatio="true">
|
|
||||||
<image>
|
|
||||||
<Image url="@../images/whale.png" />
|
|
||||||
</image>
|
|
||||||
</ImageView>
|
|
||||||
<ImageView fx:id="imgCloud2" fitHeight="291.0" fitWidth="307.0" layoutX="501.0" pickOnBounds="true" preserveRatio="true">
|
|
||||||
<image>
|
|
||||||
<Image url="@../images/cloud.png" />
|
|
||||||
</image>
|
|
||||||
</ImageView>
|
|
||||||
<ImageView fx:id="imgSun" fitHeight="154.0" fitWidth="145.0" layoutX="701.0" layoutY="-39.0" pickOnBounds="true" preserveRatio="true">
|
|
||||||
<image>
|
|
||||||
<Image url="@../images/sun.png" />
|
|
||||||
</image>
|
|
||||||
</ImageView>
|
|
||||||
<Button fx:id="btnJoin" layoutX="78.0" layoutY="149.0" mnemonicParsing="false" onAction="#joinAGame" prefHeight="31.0" prefWidth="130.0" text="Join a Game">
|
|
||||||
<font>
|
|
||||||
<Font name="Comic Sans MS Bold" size="16.0" />
|
|
||||||
</font>
|
|
||||||
</Button>
|
|
||||||
<Button layoutX="578.0" layoutY="150.0" mnemonicParsing="false" onAction="#hostAGame" prefHeight="31.0" prefWidth="130.0" text="Host a Game">
|
|
||||||
<font>
|
|
||||||
<Font name="Comic Sans MS Bold" size="16.0" />
|
|
||||||
</font>
|
|
||||||
</Button>
|
|
||||||
<Label fx:id="tutorialLabel" alignment="CENTER" layoutX="94.0" layoutY="223.0" onMouseClicked="#tutorialStartPressed" prefHeight="167.0" prefWidth="206.0" style="-fx-shape: "M 45.673,0 C 67.781,0 85.703,12.475 85.703,27.862 C 85.703,43.249 67.781,55.724 45.673,55.724 C 38.742,55.724 32.224,54.497 26.539,52.34 C 15.319,56.564 0,64.542 0,64.542 C 0,64.542 9.989,58.887 14.107,52.021 C 15.159,50.266 15.775,48.426 16.128,46.659 C 9.618,41.704 5.643,35.106 5.643,27.862 C 5.643,12.475 23.565,0 45.673,0 M 45.673,2.22 C 24.824,2.22 7.862,13.723 7.862,27.863 C 7.862,34.129 11.275,40.177 17.472,44.893 L 18.576,45.734 L 18.305,47.094 C 17.86,49.324 17.088,51.366 16.011,53.163 C 15.67,53.73 15.294,54.29 14.891,54.837 C 18.516,53.191 22.312,51.561 25.757,50.264 L 26.542,49.968 L 27.327,50.266 C 32.911,52.385 39.255,53.505 45.673,53.505 C 66.522,53.505 83.484,42.002 83.484,27.862 C 83.484,13.722 66.522,2.22 45.673,2.22 L 45.673,2.22 z "; -fx-background-color: black, white; -fx-background-insets: 0,1; -fx-padding: 50;" text="How do you play this game? Click here!" textAlignment="CENTER" />
|
|
||||||
</children>
|
|
||||||
</Pane>
|
|
||||||
</children>
|
|
||||||
</GridPane>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<java version="1.8.0_111" class="java.beans.XMLDecoder">
|
<java version="1.8.0_121" class="java.beans.XMLDecoder">
|
||||||
<object class="java.util.HashMap">
|
<object class="java.util.HashMap">
|
||||||
<void method="put">
|
<void method="put">
|
||||||
<string>SPACE</string>
|
<string>SPACE</string>
|
||||||
@@ -10,8 +10,8 @@
|
|||||||
<object class="visualiser.gameController.Keys.SailsToggleKey"/>
|
<object class="visualiser.gameController.Keys.SailsToggleKey"/>
|
||||||
</void>
|
</void>
|
||||||
<void method="put">
|
<void method="put">
|
||||||
<string>DOWN</string>
|
<string>LEFT</string>
|
||||||
<object class="visualiser.gameController.Keys.DownWindKey"/>
|
<object class="visualiser.gameController.Keys.UpWindKey"/>
|
||||||
</void>
|
</void>
|
||||||
<void method="put">
|
<void method="put">
|
||||||
<string>X</string>
|
<string>X</string>
|
||||||
@@ -21,13 +21,13 @@
|
|||||||
<string>ENTER</string>
|
<string>ENTER</string>
|
||||||
<object class="visualiser.gameController.Keys.TackGybeKey"/>
|
<object class="visualiser.gameController.Keys.TackGybeKey"/>
|
||||||
</void>
|
</void>
|
||||||
|
<void method="put">
|
||||||
|
<string>RIGHT</string>
|
||||||
|
<object class="visualiser.gameController.Keys.DownWindKey"/>
|
||||||
|
</void>
|
||||||
<void method="put">
|
<void method="put">
|
||||||
<string>Z</string>
|
<string>Z</string>
|
||||||
<object class="visualiser.gameController.Keys.ZoomInKey"/>
|
<object class="visualiser.gameController.Keys.ZoomInKey"/>
|
||||||
</void>
|
</void>
|
||||||
<void method="put">
|
|
||||||
<string>UP</string>
|
|
||||||
<object class="visualiser.gameController.Keys.UpWindKey"/>
|
|
||||||
</void>
|
|
||||||
</object>
|
</object>
|
||||||
</java>
|
</java>
|
||||||
|
|||||||
Reference in New Issue
Block a user