Updated FXMLs to add depleting tomato
- Tab view now contains health column - BoatStateCommand now fails silently if command is received before race state is set up #story[1291]
This commit is contained in:
+1
-1
@@ -24,7 +24,7 @@ public class BoatStateCommand implements Command {
|
|||||||
VisualiserBoat boat = visualiserRace.getBoat(boatState.getSourceID());
|
VisualiserBoat boat = visualiserRace.getBoat(boatState.getSourceID());
|
||||||
boat.setHealth(boatState.getBoatHealth());
|
boat.setHealth(boatState.getBoatHealth());
|
||||||
} catch (BoatNotFoundException e) {
|
} catch (BoatNotFoundException e) {
|
||||||
e.printStackTrace();
|
// Fail silently
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,14 +85,15 @@ public class RaceViewController extends Controller {
|
|||||||
private @FXML Label timeZone;
|
private @FXML Label timeZone;
|
||||||
private @FXML CheckBox showFPS;
|
private @FXML CheckBox showFPS;
|
||||||
private @FXML TableView<VisualiserBoat> boatInfoTable;
|
private @FXML TableView<VisualiserBoat> boatInfoTable;
|
||||||
private @FXML TableColumn<VisualiserBoat, String> boatPlacingColumn;
|
|
||||||
private @FXML TableColumn<VisualiserBoat, String> boatTeamColumn;
|
private @FXML TableColumn<VisualiserBoat, String> boatTeamColumn;
|
||||||
private @FXML TableColumn<VisualiserBoat, Leg> boatMarkColumn;
|
private @FXML TableColumn<VisualiserBoat, Leg> boatMarkColumn;
|
||||||
private @FXML TableColumn<VisualiserBoat, Number> boatSpeedColumn;
|
private @FXML TableColumn<VisualiserBoat, Number> boatSpeedColumn;
|
||||||
|
private @FXML TableColumn<VisualiserBoat, Number> boatHealthColumn;
|
||||||
private @FXML LineChart<Number, Number> sparklineChart;
|
private @FXML LineChart<Number, Number> sparklineChart;
|
||||||
private @FXML Label tutorialText;
|
private @FXML Label tutorialText;
|
||||||
private @FXML AnchorPane infoWrapper;
|
private @FXML AnchorPane infoWrapper;
|
||||||
private @FXML AnchorPane lineChartWrapper;
|
private @FXML AnchorPane lineChartWrapper;
|
||||||
|
private @FXML GridPane playerHealthContainer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a specified race.
|
* Displays a specified race.
|
||||||
@@ -334,12 +335,9 @@ public class RaceViewController extends Controller {
|
|||||||
|
|
||||||
boat.legProperty().addListener((o, prev, curr) -> Platform.runLater(() -> swapColours(curr)));
|
boat.legProperty().addListener((o, prev, curr) -> Platform.runLater(() -> swapColours(curr)));
|
||||||
boat.hasCollidedProperty().addListener((o, prev, curr) -> Platform.runLater(() -> showCollision(boat, shockwave)));
|
boat.hasCollidedProperty().addListener((o, prev, curr) -> Platform.runLater(() -> showCollision(boat, shockwave)));
|
||||||
boat.healthProperty().addListener((o, prev, curr) -> {
|
|
||||||
System.out.println("Tab view: " + curr);
|
|
||||||
});
|
|
||||||
if(boat.getSourceID() == race.getVisualiserRaceState().getPlayerBoatID()) {
|
if(boat.getSourceID() == race.getVisualiserRaceState().getPlayerBoatID()) {
|
||||||
boat.healthProperty().addListener((o, prev, curr) -> {
|
boat.healthProperty().addListener((o, prev, curr) -> {
|
||||||
System.out.println("Tomato: " + curr);
|
System.out.println(curr);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -529,13 +527,17 @@ public class RaceViewController extends Controller {
|
|||||||
// set table data
|
// set table data
|
||||||
boatInfoTable.setItems(sortedBoats);
|
boatInfoTable.setItems(sortedBoats);
|
||||||
boatTeamColumn.setCellValueFactory(
|
boatTeamColumn.setCellValueFactory(
|
||||||
cellData -> cellData.getValue().nameProperty());
|
cellData -> cellData.getValue().nameProperty()
|
||||||
|
);
|
||||||
boatSpeedColumn.setCellValueFactory(
|
boatSpeedColumn.setCellValueFactory(
|
||||||
cellData -> cellData.getValue().currentSpeedProperty());
|
cellData -> cellData.getValue().currentSpeedProperty()
|
||||||
|
);
|
||||||
boatMarkColumn.setCellValueFactory(
|
boatMarkColumn.setCellValueFactory(
|
||||||
cellData -> cellData.getValue().legProperty());
|
cellData -> cellData.getValue().legProperty()
|
||||||
boatPlacingColumn.setCellValueFactory(
|
);
|
||||||
cellData -> cellData.getValue().placingProperty());
|
boatHealthColumn.setCellValueFactory(
|
||||||
|
cellData -> cellData.getValue().healthProperty()
|
||||||
|
);
|
||||||
|
|
||||||
//Kind of ugly, but allows for formatting an observed speed.
|
//Kind of ugly, but allows for formatting an observed speed.
|
||||||
boatSpeedColumn.setCellFactory(
|
boatSpeedColumn.setCellFactory(
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
@@ -3,26 +3,26 @@
|
|||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.scene.chart.LineChart?>
|
<?import javafx.scene.chart.LineChart?>
|
||||||
<?import javafx.scene.chart.NumberAxis?>
|
<?import javafx.scene.chart.NumberAxis?>
|
||||||
<?import javafx.scene.control.Accordion?>
|
|
||||||
<?import javafx.scene.control.Button?>
|
|
||||||
<?import javafx.scene.control.CheckBox?>
|
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
<?import javafx.scene.control.RadioButton?>
|
|
||||||
<?import javafx.scene.control.Separator?>
|
|
||||||
<?import javafx.scene.control.SplitPane?>
|
<?import javafx.scene.control.SplitPane?>
|
||||||
<?import javafx.scene.control.TableColumn?>
|
<?import javafx.scene.control.TableColumn?>
|
||||||
<?import javafx.scene.control.TableView?>
|
<?import javafx.scene.control.TableView?>
|
||||||
<?import javafx.scene.control.TitledPane?>
|
|
||||||
<?import javafx.scene.control.ToggleGroup?>
|
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
<?import javafx.scene.layout.AnchorPane?>
|
||||||
<?import javafx.scene.layout.ColumnConstraints?>
|
<?import javafx.scene.layout.ColumnConstraints?>
|
||||||
<?import javafx.scene.layout.GridPane?>
|
<?import javafx.scene.layout.GridPane?>
|
||||||
<?import javafx.scene.layout.Pane?>
|
|
||||||
<?import javafx.scene.layout.RowConstraints?>
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
<?import javafx.scene.layout.StackPane?>
|
<?import javafx.scene.layout.StackPane?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
<SplitPane fx:id="racePane" prefHeight="431.0" prefWidth="610.0" visible="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.RaceViewController">
|
<?import javafx.scene.layout.Pane?>
|
||||||
|
<?import javafx.scene.control.Accordion?>
|
||||||
|
<?import javafx.scene.control.TitledPane?>
|
||||||
|
<?import javafx.scene.control.CheckBox?>
|
||||||
|
<?import javafx.scene.control.Separator?>
|
||||||
|
<?import javafx.scene.control.RadioButton?>
|
||||||
|
<?import javafx.scene.control.Button?>
|
||||||
|
<?import javafx.scene.control.ToggleGroup?>
|
||||||
|
<SplitPane fx:id="racePane" prefHeight="431.0" prefWidth="610.0" visible="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="visualiser.Controllers.RaceViewController">
|
||||||
<items>
|
<items>
|
||||||
<StackPane fx:id="newPane" prefHeight="150.0" prefWidth="200.0">
|
<StackPane fx:id="newPane" prefHeight="150.0" prefWidth="200.0">
|
||||||
<children>
|
<children>
|
||||||
@@ -103,6 +103,17 @@
|
|||||||
</children>
|
</children>
|
||||||
</StackPane>
|
</StackPane>
|
||||||
<Label fx:id="tutorialText" alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" style="-fx-border-color: orange; -fx-border-radius: 5px; -fx-background-color: #ffffcc; -fx-text-fill: #3399ff; -fx-border-width: 3; -fx-border-insets: -3;" text="This is the tutorial text" visible="false" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="150.0" AnchorPane.topAnchor="100.0" />
|
<Label fx:id="tutorialText" alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" style="-fx-border-color: orange; -fx-border-radius: 5px; -fx-background-color: #ffffcc; -fx-text-fill: #3399ff; -fx-border-width: 3; -fx-border-insets: -3;" text="This is the tutorial text" visible="false" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="150.0" AnchorPane.topAnchor="100.0" />
|
||||||
|
<GridPane fx:id="playerHealthContainer" prefHeight="40.0" prefWidth="46.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
|
<columnConstraints>
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||||
|
</columnConstraints>
|
||||||
|
<rowConstraints>
|
||||||
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
|
</rowConstraints>
|
||||||
|
<padding>
|
||||||
|
<Insets left="10.0" top="10.0" />
|
||||||
|
</padding>
|
||||||
|
</GridPane>
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
<AnchorPane fx:id="infoWrapper" focusTraversable="true" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="200.0" visible="false">
|
<AnchorPane fx:id="infoWrapper" focusTraversable="true" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="200.0" visible="false">
|
||||||
@@ -120,10 +131,10 @@
|
|||||||
<children>
|
<children>
|
||||||
<TableView fx:id="boatInfoTable" minWidth="475.0" prefHeight="214.0" prefWidth="475.0" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
|
<TableView fx:id="boatInfoTable" minWidth="475.0" prefHeight="214.0" prefWidth="475.0" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
|
||||||
<columns>
|
<columns>
|
||||||
<TableColumn fx:id="boatPlacingColumn" prefWidth="50.0" text="Place" />
|
<TableColumn fx:id="boatTeamColumn" prefWidth="135.0" text="Team" />
|
||||||
<TableColumn fx:id="boatTeamColumn" prefWidth="200.0" text="Team" />
|
<TableColumn fx:id="boatMarkColumn" prefWidth="142.0" text="Mark" />
|
||||||
<TableColumn fx:id="boatMarkColumn" prefWidth="150.0" text="Mark" />
|
<TableColumn fx:id="boatHealthColumn" prefWidth="110.0" text="Health" />
|
||||||
<TableColumn fx:id="boatSpeedColumn" prefWidth="75.0" text="Speed" />
|
<TableColumn fx:id="boatSpeedColumn" prefWidth="87.0" text="Speed" />
|
||||||
</columns>
|
</columns>
|
||||||
</TableView>
|
</TableView>
|
||||||
<AnchorPane fx:id="lineChartWrapper" prefHeight="167.0" prefWidth="178.0" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="CENTER">
|
<AnchorPane fx:id="lineChartWrapper" prefHeight="167.0" prefWidth="178.0" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="CENTER">
|
||||||
|
|||||||
Reference in New Issue
Block a user