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) {
|
||||
try {
|
||||
//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) {
|
||||
|
||||
@@ -40,46 +40,33 @@ public class Event {
|
||||
private String raceXML;
|
||||
private String regattaXML;
|
||||
private String boatXML;
|
||||
|
||||
private XMLFileType xmlFileType;
|
||||
|
||||
private Polars boatPolars;
|
||||
|
||||
/**
|
||||
* Data sources containing data from the xml files.
|
||||
*/
|
||||
RaceDataSource raceDataSource;
|
||||
BoatDataSource boatDataSource;
|
||||
RegattaDataSource regattaDataSource;
|
||||
|
||||
|
||||
private RaceDataSource raceDataSource;
|
||||
private BoatDataSource boatDataSource;
|
||||
private RegattaDataSource regattaDataSource;
|
||||
private ConnectionAcceptor connectionAcceptor;
|
||||
private LatestMessages latestMessages;
|
||||
|
||||
private CompositeCommand compositeCommand;
|
||||
|
||||
/**
|
||||
* This is used to allocate source IDs.
|
||||
*/
|
||||
private SourceIdAllocator sourceIdAllocator;
|
||||
|
||||
private Thread raceThread;
|
||||
|
||||
private Thread connectionThread;
|
||||
|
||||
private int mapIndex;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructs an event, using various XML files.
|
||||
* @param singlePlayer Whether or not to create a single player event.
|
||||
* @param mapIndex Specifies which map to use.
|
||||
* @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");
|
||||
this.mapIndex = mapIndex;
|
||||
String raceXMLFile;
|
||||
@@ -121,7 +108,9 @@ public class Event {
|
||||
this.raceXML = RaceXMLCreator.alterRaceToWind(this.raceXML, XMLFileType.Contents, -1, true);
|
||||
} else {
|
||||
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);
|
||||
|
||||
@@ -67,6 +67,8 @@ public class HostGameController extends Controller {
|
||||
sliderLength.setShowTickLabels(true);
|
||||
sliderLength.setMajorTickUnit(MAX_RACE_LENGTH-1);
|
||||
sliderLength.setBlockIncrement(1);
|
||||
|
||||
sliderLength.getStylesheets().add("/css/slider.css");
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +95,8 @@ public class HostGameController extends Controller {
|
||||
*/
|
||||
public void hostGamePressed() {
|
||||
try {
|
||||
App.game = new Event(false, currentMapIndex);
|
||||
App.game = new Event(false, currentMapIndex,
|
||||
selectedRaceLength*60*1000);
|
||||
App.gameType = currentMapIndex;
|
||||
|
||||
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