Remove start button from StartController.

#story[778]
main
David Wu 9 years ago
parent 09483fff2c
commit b60b4b257f

@ -131,6 +131,7 @@ public class Race implements Runnable {
boatOffset = (boatOffset + 1) % (startingBoats.size()); boatOffset = (boatOffset + 1) % (startingBoats.size());
if (timeLeft <= 60000/scaleFactor && timeLeft > 0) { if (timeLeft <= 60000/scaleFactor && timeLeft > 0) {
System.out.println("Race status 2");
RaceStatus raceStatus = new RaceStatus(System.currentTimeMillis(), raceId, 2, 2, boatStatusMessages); RaceStatus raceStatus = new RaceStatus(System.currentTimeMillis(), raceId, 2, 2, boatStatusMessages);
mockOutput.parseRaceStatus(raceStatus); mockOutput.parseRaceStatus(raceStatus);
} }
@ -142,6 +143,7 @@ public class Race implements Runnable {
stop(); stop();
} }
else { else {
System.out.println("Race status 1");
RaceStatus raceStatus = new RaceStatus(System.currentTimeMillis(), raceId, 1, 2, boatStatusMessages); RaceStatus raceStatus = new RaceStatus(System.currentTimeMillis(), raceId, 1, 2, boatStatusMessages);
mockOutput.parseRaceStatus(raceStatus); mockOutput.parseRaceStatus(raceStatus);
} }

@ -43,7 +43,7 @@ public class StartController extends Controller implements Observer {
@FXML private Label timer; @FXML private Label timer;
@FXML private int PRERACE_TIME = 10; @FXML private int PRERACE_TIME = 10;
@FXML Button fifteenMinButton; //@FXML Button fifteenMinButton;
private RaceClock raceClock; private RaceClock raceClock;
@ -56,12 +56,13 @@ public class StartController extends Controller implements Observer {
* Begins the race with a scale factor of 1 * Begins the race with a scale factor of 1
*/ */
public void startRaceNoScaling() { public void startRaceNoScaling() {
startRace(1); //startRace(1);
countdownTimer(1);
} }
private void startRace(int raceScale){ private void startRace(int raceScale){
fifteenMinButton.setDisable(true); //fifteenMinButton.setDisable(true);
countdownTimer(raceScale); //countdownTimer(raceScale);
} }
@Override @Override
@ -107,11 +108,12 @@ public class StartController extends Controller implements Observer {
@Override @Override
public void handle(long arg0) { public void handle(long arg0) {
timeLeft = startTime - currentTime; timeLeft = startTime - currentTime;
if (timeLeft <= 0) { if (visualiserInput.getRaceStatus().getRaceStatus()==2) {
updateTime("Race is starting..."); updateTime("Race is starting...");
stop(); stop();
parent.beginRace(visualiserInput); parent.beginRace(visualiserInput);
startWrapper.setVisible(false); startWrapper.setVisible(false);
start.setVisible(false);
} else { } else {
updateTime(timerFormat.format(currentTime)); updateTime(timerFormat.format(currentTime));
@ -166,4 +168,5 @@ public class StartController extends Controller implements Observer {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<?import javafx.scene.control.Button?> <?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?> <?import javafx.scene.control.Label?>
<?import javafx.scene.control.TableColumn?> <?import javafx.scene.control.TableColumn?>
@ -10,7 +14,7 @@
<?import javafx.scene.layout.RowConstraints?> <?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.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.Controllers.StartController"> <AnchorPane fx:id="startWrapper" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng302.Controllers.StartController">
<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>
@ -29,7 +33,6 @@
<RowConstraints maxHeight="191.5" minHeight="10.0" prefHeight="82.0" vgrow="SOMETIMES" /> <RowConstraints maxHeight="191.5" minHeight="10.0" prefHeight="82.0" vgrow="SOMETIMES" />
</rowConstraints> </rowConstraints>
<children> <children>
<Button fx:id="fifteenMinButton" maxWidth="-Infinity" minWidth="-Infinity" mnemonicParsing="false" onAction="#startRaceNoScaling" prefWidth="100.0" text="Start" GridPane.columnIndex="2" GridPane.halignment="CENTER" GridPane.rowIndex="4" />
<TableView fx:id="boatNameTable" prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.columnSpan="3" GridPane.rowIndex="2"> <TableView fx:id="boatNameTable" prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.columnSpan="3" GridPane.rowIndex="2">
<placeholder> <placeholder>
<Label text="Initial lineup..." /> <Label text="Initial lineup..." />

@ -4,7 +4,8 @@ import org.junit.Before;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import static org.testng.Assert.*; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/** /**
* Created by connortaylorbrown on 3/05/17. * Created by connortaylorbrown on 3/05/17.

Loading…
Cancel
Save