Fixed timer separator instead of dot to semicolon, and fixed the timer position in race canvas, and updated the start screen so it does not grow vertically

#story[572]
This commit is contained in:
Zhi You Tan
2017-05-01 18:35:17 +12:00
parent d927531354
commit ee6a543f8d
5 changed files with 22 additions and 28 deletions
@@ -87,25 +87,21 @@ public class Controller implements Initializable {
timeTillLive.setTextFill(Color.RED);
timeTillLive.setText("Race finished! Waiting for new race...");
switchToRaceViewButton.setDisable(true);
} else if (StreamParser.getTimeSinceStart() > 0 && StreamParser.getTimeSinceStart() % 10 == 0) {
} else if (StreamParser.getTimeSinceStart() > 0) {
updateTeamList();
timeTillLive.setTextFill(Color.RED);
switchToRaceViewButton.setDisable(false);
Long timerMinute = StreamParser.getTimeSinceStart() / 60;
Long timerSecond = StreamParser.getTimeSinceStart() % 60;
String timerString = "-" + timerMinute + "." + timerSecond + " minutes";
String timerString = "-" + timerMinute + ":" + timerSecond + " minutes";
timeTillLive.setText(timerString);
} else if (StreamParser.getTimeSinceStart() % 10 == 0) {
// ArrayList<XMLParser.RaceXMLObject.Limit> courseLimits = xmlParser.getRaceXML().getCourseLimit();
// for (XMLParser.RaceXMLObject.Limit courseLimit : courseLimits) {
// System.out.println("Lat,Lng: " + courseLimit.getLat() + courseLimit.getLng());
// }
} else {
updateTeamList();
timeTillLive.setTextFill(Color.BLACK);
switchToRaceViewButton.setDisable(false);
Long timerMinute = -1 * StreamParser.getTimeSinceStart() / 60;
Long timerSecond = -1 * StreamParser.getTimeSinceStart() % 60;
String timerString = timerMinute + "." + timerSecond + " minutes";
String timerString = timerMinute + ":" + timerSecond + " minutes";
timeTillLive.setText(timerString);
}
});
@@ -293,14 +293,14 @@ public class RaceViewController extends Thread{
private String currentTimer() {
String timerString = "0:00 minutes";
if (StreamParser.getTimeSinceStart() > 0 && StreamParser.getTimeSinceStart() % 10 == 0) {
if (StreamParser.getTimeSinceStart() > 0) {
Long timerMinute = StreamParser.getTimeSinceStart() / 60;
Long timerSecond = StreamParser.getTimeSinceStart() % 60;
timerString = "-" + timerMinute + "." + timerSecond + " minutes";
} else if (StreamParser.getTimeSinceStart() % 10 == 0) {
timerString = "-" + timerMinute + ":" + timerSecond + " minutes";
} else {
Long timerMinute = -1 * StreamParser.getTimeSinceStart() / 60;
Long timerSecond = -1 * StreamParser.getTimeSinceStart() % 60;
timerString = timerMinute + "." + timerSecond + " minutes";
timerString = timerMinute + ":" + timerSecond + " minutes";
}
return timerString;
}
@@ -164,7 +164,7 @@ public class StreamParser extends Thread{
DateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
format.setTimeZone(TimeZone.getTimeZone("UTC"));
long timeTillStart = ((new Date (expectedStartTime)).getTime() - (new Date (currentTime)).getTime())/1000;
if (timeTillStart > 0 && timeTillStart % 10 == 0) {
if (timeTillStart > 0) {
timeSinceStart = timeTillStart;
System.out.println("Time till start: " + timeTillStart + " Seconds");
} else {
@@ -177,10 +177,8 @@ public class StreamParser extends Thread{
raceFinished = false;
System.out.println("RACE HAS STARTED");
}
if (timeTillStart % 10 == 0){
System.out.println("Time since start: " + -1 * timeTillStart + " Seconds");
timeSinceStart = timeTillStart;
}
System.out.println("Time since start: " + -1 * timeTillStart + " Seconds");
timeSinceStart = timeTillStart;
}
long windDir = bytesToLong(Arrays.copyOfRange(payload,18,20));
long windSpeed = bytesToLong(Arrays.copyOfRange(payload,20,22));
+9 -9
View File
@@ -9,18 +9,18 @@
<AnchorPane fx:id="contentPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="1080.0" prefWidth="1920.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.controllers.Controller">
<children>
<GridPane alignment="CENTER" prefHeight="1080.0" prefWidth="1920.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<GridPane nodeOrientation="LEFT_TO_RIGHT" prefHeight="1080.0" prefWidth="1920.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>
<rowConstraints>
<RowConstraints maxHeight="403.0" minHeight="0.0" prefHeight="170.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="444.0" minHeight="0.0" prefHeight="52.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="432.0" minHeight="2.0" prefHeight="102.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="635.0" minHeight="0.0" prefHeight="60.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="635.0" minHeight="10.0" prefHeight="365.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="635.0" minHeight="10.0" prefHeight="93.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="599.0" minHeight="10.0" prefHeight="262.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="170.0" minHeight="170.0" prefHeight="170.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="52.0" minHeight="52.0" prefHeight="52.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="102.0" minHeight="102.0" prefHeight="102.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="60.0" minHeight="60.0" prefHeight="60.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="365.0" minHeight="365.0" prefHeight="365.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="93.0" minHeight="93.0" prefHeight="93.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="262.0" minHeight="262.0" prefHeight="262.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label alignment="CENTER" text="Welcome to Race Vision" GridPane.halignment="CENTER" GridPane.valignment="BOTTOM">
@@ -44,7 +44,7 @@
</font>
</Label>
<Button fx:id="streamButton" mnemonicParsing="false" onAction="#startStream" text="Click to stream" GridPane.halignment="CENTER" GridPane.rowIndex="3" />
<Button fx:id="switchToRaceViewButton" disable="true" mnemonicParsing="false" onAction="#switchToRaceView" text="Watch Race" GridPane.halignment="CENTER" GridPane.rowIndex="6" />
<Button fx:id="switchToRaceViewButton" disable="true" mnemonicParsing="false" onAction="#switchToRaceView" text="Watch Race" GridPane.halignment="CENTER" GridPane.rowIndex="6" GridPane.valignment="TOP" />
<TableView fx:id="teamList" maxWidth="500.0" prefHeight="200.0" prefWidth="200.0" GridPane.halignment="CENTER" GridPane.rowIndex="4">
<columns>
<TableColumn fx:id="boatNameCol" editable="false" prefWidth="250.0" sortable="false" text="Boat Name" />
+2 -2
View File
@@ -49,9 +49,9 @@
<VBox fx:id="positionVbox" layoutX="12.0" layoutY="280.0" prefHeight="140.0" prefWidth="200.0" />
<Pane layoutX="11.0" layoutY="30.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="51.0" prefWidth="193.0">
<children>
<Text fx:id="timerLabel" layoutX="6.0" layoutY="37.0" strokeType="OUTSIDE" strokeWidth="0.0" text="00:00" textAlignment="CENTER" wrappingWidth="181.0">
<Text fx:id="timerLabel" layoutX="-26.0" layoutY="34.0" strokeType="OUTSIDE" strokeWidth="0.0" text="00:00" textAlignment="CENTER" wrappingWidth="246.0">
<font>
<Font size="34.0" />
<Font size="25.0" />
</font>
</Text>
</children>