Added the race results to the RaceResultController. Also fixed some bugs

- Fixed a bug where the race results would be out of order.
- Changed the colour of the start and finish gates
- Added the race results to the RaceResultController and updated view

Tags: #fix #implement #story[13, 10, 11]
This commit is contained in:
Michael Rausch
2017-03-22 22:30:49 +13:00
parent a41f2e4bde
commit 9e22eac4d8
8 changed files with 76 additions and 56 deletions
@@ -2,8 +2,10 @@ package seng302.controllers;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import seng302.models.Race;
import java.net.URL;
import java.util.ResourceBundle;
@@ -13,15 +15,23 @@ import java.util.ResourceBundle;
*/
public class RaceResultController implements Initializable{
@FXML private AnchorPane window;
@FXML private Parent raceView;
@FXML private RaceController raceViewController;
@FXML private VBox resultsVBox;
private Race race;
public void setResults(){
System.out.println("HI MOM");
RaceResultController(Race race){
this.race = race;
}
@Override
public void initialize(URL location, ResourceBundle resources) {
int boatPosition = this.race.getFinishedBoats().length;
for (int i = this.race.getFinishedBoats().length - 1; i >= 0; i--){
resultsVBox.getChildren().add(0, new Text(boatPosition + ": " + this.race.getFinishedBoats()[i].getTeamName()));
boatPosition--;
}
}
}