Race length is affected by slider value.
- modified constructor of a race event to take in a scale value - race is scaled according to minutes selected on the slider - applied minimal css styling - playing around with more styling options - bug exists with 1 minute races, to be fixed #story[1323]
This commit is contained in:
@@ -21,7 +21,7 @@ public class App extends Application {
|
|||||||
public void start(Stage primaryStage) {
|
public void start(Stage primaryStage) {
|
||||||
try {
|
try {
|
||||||
//TODO should read a configuration file to configure server?
|
//TODO should read a configuration file to configure server?
|
||||||
Event raceEvent = new Event(false, 0);
|
Event raceEvent = new Event(false, 0, 5);
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -40,46 +40,33 @@ public class Event {
|
|||||||
private String raceXML;
|
private String raceXML;
|
||||||
private String regattaXML;
|
private String regattaXML;
|
||||||
private String boatXML;
|
private String boatXML;
|
||||||
|
|
||||||
private XMLFileType xmlFileType;
|
private XMLFileType xmlFileType;
|
||||||
|
|
||||||
private Polars boatPolars;
|
private Polars boatPolars;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data sources containing data from the xml files.
|
* Data sources containing data from the xml files.
|
||||||
*/
|
*/
|
||||||
RaceDataSource raceDataSource;
|
private RaceDataSource raceDataSource;
|
||||||
BoatDataSource boatDataSource;
|
private BoatDataSource boatDataSource;
|
||||||
RegattaDataSource regattaDataSource;
|
private RegattaDataSource regattaDataSource;
|
||||||
|
|
||||||
|
|
||||||
private ConnectionAcceptor connectionAcceptor;
|
private ConnectionAcceptor connectionAcceptor;
|
||||||
private LatestMessages latestMessages;
|
private LatestMessages latestMessages;
|
||||||
|
|
||||||
private CompositeCommand compositeCommand;
|
private CompositeCommand compositeCommand;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is used to allocate source IDs.
|
* This is used to allocate source IDs.
|
||||||
*/
|
*/
|
||||||
private SourceIdAllocator sourceIdAllocator;
|
private SourceIdAllocator sourceIdAllocator;
|
||||||
|
|
||||||
private Thread raceThread;
|
private Thread raceThread;
|
||||||
|
|
||||||
private Thread connectionThread;
|
private Thread connectionThread;
|
||||||
|
|
||||||
private int mapIndex;
|
private int mapIndex;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an event, using various XML files.
|
* Constructs an event, using various XML files.
|
||||||
* @param singlePlayer Whether or not to create a single player event.
|
* @param singlePlayer Whether or not to create a single player event.
|
||||||
* @param mapIndex Specifies which map to use.
|
* @param mapIndex Specifies which map to use.
|
||||||
* @throws EventConstructionException Thrown if we cannot create an Event for any reason.
|
* @throws EventConstructionException Thrown if we cannot create an Event for any reason.
|
||||||
*/
|
*/
|
||||||
public Event(boolean singlePlayer, int mapIndex) throws EventConstructionException {
|
public Event(boolean singlePlayer, int mapIndex, int raceLength) throws
|
||||||
|
EventConstructionException {
|
||||||
PolarParser.parseNewPolars("mock/polars/acc_polars.csv");
|
PolarParser.parseNewPolars("mock/polars/acc_polars.csv");
|
||||||
this.mapIndex = mapIndex;
|
this.mapIndex = mapIndex;
|
||||||
String raceXMLFile;
|
String raceXMLFile;
|
||||||
@@ -121,7 +108,9 @@ public class Event {
|
|||||||
this.raceXML = RaceXMLCreator.alterRaceToWind(this.raceXML, XMLFileType.Contents, -1, true);
|
this.raceXML = RaceXMLCreator.alterRaceToWind(this.raceXML, XMLFileType.Contents, -1, true);
|
||||||
} else {
|
} else {
|
||||||
this.raceXML = RaceXMLCreator.alterRaceToWind(this.raceXML, XMLFileType.Contents, windAngle, false);
|
this.raceXML = RaceXMLCreator.alterRaceToWind(this.raceXML, XMLFileType.Contents, windAngle, false);
|
||||||
this.raceXML = RaceXMLCreator.scaleRaceSize(raceXML, windSpeed, 15 * 60 * 1000);
|
this.raceXML = RaceXMLCreator.scaleRaceSize(raceXML,
|
||||||
|
windSpeed, raceLength);
|
||||||
|
System.out.println(raceLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.boatXML = XMLReader.readXMLFileToString(boatsXMLFile, StandardCharsets.UTF_8);
|
this.boatXML = XMLReader.readXMLFileToString(boatsXMLFile, StandardCharsets.UTF_8);
|
||||||
|
|||||||
@@ -67,6 +67,8 @@ public class HostGameController extends Controller {
|
|||||||
sliderLength.setShowTickLabels(true);
|
sliderLength.setShowTickLabels(true);
|
||||||
sliderLength.setMajorTickUnit(MAX_RACE_LENGTH-1);
|
sliderLength.setMajorTickUnit(MAX_RACE_LENGTH-1);
|
||||||
sliderLength.setBlockIncrement(1);
|
sliderLength.setBlockIncrement(1);
|
||||||
|
|
||||||
|
sliderLength.getStylesheets().add("/css/slider.css");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -93,7 +95,8 @@ public class HostGameController extends Controller {
|
|||||||
*/
|
*/
|
||||||
public void hostGamePressed() {
|
public void hostGamePressed() {
|
||||||
try {
|
try {
|
||||||
App.game = new Event(false, currentMapIndex);
|
App.game = new Event(false, currentMapIndex,
|
||||||
|
selectedRaceLength*60*1000);
|
||||||
App.gameType = currentMapIndex;
|
App.gameType = currentMapIndex;
|
||||||
|
|
||||||
HttpMatchBrowserHost matchBrowserHost = new HttpMatchBrowserHost();
|
HttpMatchBrowserHost matchBrowserHost = new HttpMatchBrowserHost();
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
.slider .thumb {
|
||||||
|
-fx-background-image: url("/visualiser/images/sun.png");
|
||||||
|
-fx-background-size: 25px;
|
||||||
|
-fx-pref-height: 25px;
|
||||||
|
-fx-pref-width: 25px;
|
||||||
|
-fx-background-position: top;
|
||||||
|
-fx-background-repeat: no-repeat;
|
||||||
|
-fx-focus-color: transparent;
|
||||||
|
-fx-background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slider .track {
|
||||||
|
-fx-control-inner-background: dodgerblue;
|
||||||
|
-fx-border-color: rgba(30, 144, 255, 0.44);
|
||||||
|
-fx-border-radius: 0.25em, 0.25em, 0.166667em;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user