added viewing of scores

This commit is contained in:
Joshua Perry 2023-02-01 13:51:13 +00:00
parent 811eb582b8
commit 5e32a47e8e
2 changed files with 169 additions and 72 deletions

View File

@ -39,9 +39,33 @@ public class MainController implements Initializable {
@FXML @FXML
TextField favoriteDefender; TextField favoriteDefender;
@FXML
TextField scores0;
@FXML
TextField scores1;
@FXML
TextField scores2;
@FXML
TextField scores3;
@FXML
TextField scores4;
@FXML
TextField scores5;
@FXML
TextField overallScore;
TextField[] scores;
@Override @Override
public void initialize(URL url, ResourceBundle rb) { public void initialize(URL url, ResourceBundle rb) {
loadCompetitors(); loadCompetitors();
this.scores = new TextField[]{scores0, scores1, scores2, scores3, scores4, scores5};
loadView(); loadView();
} }
@ -67,7 +91,12 @@ public class MainController implements Initializable {
this.playerNumber.setText(String.valueOf(player.getPlayerNumber())); this.playerNumber.setText(String.valueOf(player.getPlayerNumber()));
this.playerName.setText(player.getPlayerName().getFullName()); this.playerName.setText(player.getPlayerName().getFullName());
this.playerLevel.setText(player.getPlayerLevel().getRank()); this.playerLevel.setText(player.getPlayerLevel().getRank());
loadFavoriteCharacters(player);
loadScores(player);
this.overallScore.setText(String.valueOf(player.getOverallScore()));
}
private void loadFavoriteCharacters(Competitor player) {
if (player instanceof R6Player) { if (player instanceof R6Player) {
this.favoriteAttacker.setText(((R6Player) player).getFavoriteAttacker().getAttacker()); this.favoriteAttacker.setText(((R6Player) player).getFavoriteAttacker().getAttacker());
this.favoriteDefender.setText(((R6Player) player).getFavoriteDefender().getDefender()); this.favoriteDefender.setText(((R6Player) player).getFavoriteDefender().getDefender());
@ -79,6 +108,12 @@ public class MainController implements Initializable {
this.favoriteDefender.visibleProperty().set(false); this.favoriteDefender.visibleProperty().set(false);
this.favoriteCharacters.setText("Favorite Agent"); this.favoriteCharacters.setText("Favorite Agent");
} }
}
private void loadScores(Competitor player) {
int[] playerScores = player.getScores();
for (int i = 0; i < playerScores.length; i++) {
this.scores[i].setText(String.valueOf(playerScores[i]));
}
} }
} }

View File

@ -3,6 +3,8 @@
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.ListView?> <?import javafx.scene.control.ListView?>
<?import javafx.scene.control.SplitPane?> <?import javafx.scene.control.SplitPane?>
<?import javafx.scene.control.Tab?>
<?import javafx.scene.control.TabPane?>
<?import javafx.scene.control.TextField?> <?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?> <?import javafx.scene.layout.ColumnConstraints?>
@ -13,77 +15,137 @@
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.r0r5chach.MainController"> <VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.r0r5chach.MainController">
<children> <children>
<SplitPane dividerPositions="0.2959866220735786" prefHeight="452.0" prefWidth="600.0"> <TabPane prefHeight="406.0" prefWidth="600.0" tabClosingPolicy="UNAVAILABLE">
<items> <tabs>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0"> <Tab text="Edit">
<children> <content>
<ListView fx:id="competitorsList" onMouseClicked="#getCompetitor" prefHeight="398.0" prefWidth="175.0" /> <SplitPane dividerPositions="0.29" prefHeight="254.0" prefWidth="600.0">
</children> <items>
</AnchorPane> <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
<GridPane> <children>
<columnConstraints> <ListView fx:id="competitorsList" onMouseClicked="#getCompetitor" prefHeight="398.0" prefWidth="175.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="204.0" minWidth="10.0" prefWidth="127.0" /> </children>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="326.0" minWidth="10.0" prefWidth="291.0" /> </AnchorPane>
</columnConstraints> <GridPane>
<rowConstraints> <columnConstraints>
<RowConstraints vgrow="SOMETIMES" /> <ColumnConstraints hgrow="SOMETIMES" maxWidth="204.0" minWidth="10.0" prefWidth="127.0" />
<RowConstraints vgrow="SOMETIMES" /> <ColumnConstraints hgrow="SOMETIMES" maxWidth="326.0" minWidth="10.0" prefWidth="291.0" />
<RowConstraints vgrow="SOMETIMES" /> </columnConstraints>
<RowConstraints vgrow="SOMETIMES" /> <rowConstraints>
</rowConstraints> <RowConstraints vgrow="SOMETIMES" />
<children> <RowConstraints vgrow="SOMETIMES" />
<TextField fx:id="playerNumber" prefHeight="25.0" prefWidth="160.0" GridPane.columnIndex="1"> <RowConstraints vgrow="SOMETIMES" />
<GridPane.margin> <RowConstraints vgrow="SOMETIMES" />
<Insets right="100.0" /> <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</GridPane.margin> <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</TextField> </rowConstraints>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Player Number" GridPane.halignment="RIGHT"> <children>
<GridPane.margin> <TextField fx:id="playerNumber" prefHeight="25.0" prefWidth="160.0" GridPane.columnIndex="1">
<Insets right="10.0" /> <GridPane.margin>
</GridPane.margin> <Insets right="100.0" />
</Text> </GridPane.margin>
<TextField fx:id="playerName" prefHeight="25.0" prefWidth="160.0" GridPane.columnIndex="1" GridPane.rowIndex="1"> </TextField>
<GridPane.margin> <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Player Number" GridPane.halignment="RIGHT">
<Insets right="100.0" /> <GridPane.margin>
</GridPane.margin> <Insets right="10.0" />
</TextField> </GridPane.margin>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Name" GridPane.halignment="RIGHT" GridPane.rowIndex="1"> </Text>
<GridPane.margin> <TextField fx:id="playerName" prefHeight="25.0" prefWidth="160.0" GridPane.columnIndex="1" GridPane.rowIndex="1">
<Insets right="10.0" /> <GridPane.margin>
</GridPane.margin> <Insets right="100.0" />
</Text> </GridPane.margin>
<TextField fx:id="playerLevel" GridPane.columnIndex="1" GridPane.rowIndex="2"> </TextField>
<GridPane.margin> <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Name" GridPane.halignment="RIGHT" GridPane.rowIndex="1">
<Insets right="100.0" /> <GridPane.margin>
</GridPane.margin> <Insets right="10.0" />
</TextField> </GridPane.margin>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Level" GridPane.halignment="RIGHT" GridPane.rowIndex="2"> </Text>
<GridPane.margin> <TextField fx:id="playerLevel" GridPane.columnIndex="1" GridPane.rowIndex="2">
<Insets right="10.0" /> <GridPane.margin>
</GridPane.margin> <Insets right="100.0" />
</Text> </GridPane.margin>
<Text fx:id="favoriteCharacters" strokeType="OUTSIDE" strokeWidth="0.0" text="Favorite Character(s)" GridPane.halignment="RIGHT" GridPane.rowIndex="3"> </TextField>
<GridPane.margin> <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Level" GridPane.halignment="RIGHT" GridPane.rowIndex="2">
<Insets bottom="45.0" right="10.0" /> <GridPane.margin>
</GridPane.margin> <Insets right="10.0" />
</Text> </GridPane.margin>
<VBox prefHeight="0.0" prefWidth="291.0" GridPane.columnIndex="1" GridPane.rowIndex="3"> </Text>
<children> <Text fx:id="favoriteCharacters" strokeType="OUTSIDE" strokeWidth="0.0" text="Favorite Character(s)" GridPane.halignment="RIGHT" GridPane.rowIndex="3">
<TextField fx:id="favoriteAttacker"> <GridPane.margin>
<VBox.margin> <Insets bottom="45.0" right="10.0" />
<Insets right="100.0" top="15.0" /> </GridPane.margin>
</VBox.margin> </Text>
</TextField> <VBox prefHeight="0.0" prefWidth="291.0" GridPane.columnIndex="1" GridPane.rowIndex="3">
<TextField fx:id="favoriteDefender"> <children>
<VBox.margin> <TextField fx:id="favoriteAttacker">
<Insets right="100.0" top="15.0" /> <VBox.margin>
</VBox.margin> <Insets right="100.0" top="15.0" />
</TextField> </VBox.margin>
</children> </TextField>
</VBox> <TextField fx:id="favoriteDefender">
</children> <VBox.margin>
</GridPane> <Insets right="100.0" top="15.0" />
</items> </VBox.margin>
</SplitPane> </TextField>
</children>
</VBox>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Scores" GridPane.halignment="RIGHT" GridPane.rowIndex="4">
<GridPane.margin>
<Insets right="10.0" />
</GridPane.margin>
</Text>
<TextField fx:id="scores0" GridPane.columnIndex="1" GridPane.rowIndex="4">
<GridPane.margin>
<Insets right="268.0" />
</GridPane.margin>
</TextField>
<TextField fx:id="scores1" GridPane.columnIndex="1" GridPane.rowIndex="4">
<GridPane.margin>
<Insets left="40.0" right="228.0" />
</GridPane.margin>
</TextField>
<TextField fx:id="scores2" GridPane.columnIndex="1" GridPane.rowIndex="4">
<GridPane.margin>
<Insets left="80.0" right="188.0" />
</GridPane.margin>
</TextField>
<TextField fx:id="scores3" GridPane.columnIndex="1" GridPane.rowIndex="4">
<GridPane.margin>
<Insets left="120.0" right="148.0" />
</GridPane.margin>
</TextField>
<TextField fx:id="scores4" GridPane.columnIndex="1" GridPane.rowIndex="4">
<GridPane.margin>
<Insets left="160.0" right="108.0" />
</GridPane.margin>
</TextField>
<TextField fx:id="scores5" GridPane.columnIndex="1" GridPane.rowIndex="4">
<GridPane.margin>
<Insets left="200.0" right="68.0" />
</GridPane.margin>
</TextField>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Overall Score" GridPane.halignment="RIGHT" GridPane.rowIndex="5">
<GridPane.margin>
<Insets right="10.0" />
</GridPane.margin>
</Text>
<TextField fx:id="overallScore" GridPane.columnIndex="1" GridPane.rowIndex="5">
<GridPane.margin>
<Insets right="200.0" />
</GridPane.margin>
</TextField>
</children>
</GridPane>
</items>
</SplitPane>
</content>
</Tab>
<Tab text="View">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" />
</content>
</Tab>
</tabs>
</TabPane>
</children> </children>
</VBox> </VBox>