mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Fixed a bug where clicking "watch race" before race starts will cause boats to travel in unexpected ways.
#story[923]
This commit is contained in:
@@ -46,7 +46,7 @@ public class Controller implements Initializable {
|
||||
@FXML
|
||||
private Label realTime;
|
||||
|
||||
private XMLParser xmlParser;
|
||||
private boolean switchedToRaceView = false;
|
||||
|
||||
private void setContentPane(String jfxUrl){
|
||||
try{
|
||||
@@ -65,9 +65,6 @@ public class Controller implements Initializable {
|
||||
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
//DateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
|
||||
//format.setTimeZone(TimeZone.getTimeZone("GMT-8"));
|
||||
//realTime.setText(format.format(new Date()));
|
||||
contentPane.getStylesheets().add(getClass().getResource("/css/master.css").toString());
|
||||
teamList.getStylesheets().add(getClass().getResource("/css/master.css").toString());
|
||||
}
|
||||
@@ -77,7 +74,6 @@ public class Controller implements Initializable {
|
||||
*/
|
||||
public void startStream() {
|
||||
if (StreamParser.isStreamStatus()) {
|
||||
xmlParser = StreamParser.getXmlObject();
|
||||
streamButton.setVisible(false);
|
||||
realTime.setVisible(true);
|
||||
timeTillLive.setVisible(true);
|
||||
@@ -89,7 +85,9 @@ public class Controller implements Initializable {
|
||||
public void run() {
|
||||
Platform.runLater(() -> {
|
||||
if (StreamParser.isRaceStarted()) {
|
||||
if (!switchedToRaceView) {
|
||||
switchToRaceView();
|
||||
}
|
||||
timer.cancel();
|
||||
}
|
||||
if (StreamParser.isRaceFinished()) {
|
||||
@@ -132,6 +130,7 @@ public class Controller implements Initializable {
|
||||
}
|
||||
|
||||
public void switchToRaceView() {
|
||||
switchedToRaceView = true;
|
||||
setContentPane("/views/RaceView.fxml");
|
||||
}
|
||||
|
||||
@@ -152,18 +151,8 @@ public class Controller implements Initializable {
|
||||
posCol.setCellValueFactory(
|
||||
new PropertyValueFactory<>("position")
|
||||
);
|
||||
// if (StreamParser.isRaceStarted()) {
|
||||
data.addAll(StreamParser.getBoatsPos().values());
|
||||
// } else {
|
||||
// for (Yacht boat : StreamParser.getBoats().values()) {
|
||||
// boat.setPosition("-");
|
||||
// data.add(boat);
|
||||
// }
|
||||
// }
|
||||
teamList.refresh();
|
||||
|
||||
// posCol.setSortType(TableColumn.SortType.ASCENDING);
|
||||
// teamList.getSortOrder().add(posCol);
|
||||
// posCol.setSortable(false);
|
||||
data.addAll(StreamParser.getBoatsPos().values());
|
||||
teamList.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user