diff --git a/changelog.md b/changelog.md index c182739..3fcc220 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,6 @@ # Changelog -#### Unreleased Changes +#### Version 1.6 - 17. October 2019 - Now writes overlay data to a json next to the cleopetra.jar. This can be disabled in RLBotSettings tab. - NicEastvillage - Improved the RLBot runner process. - NicEastvillage - The RLBot console window (RLBot runner) now does not need to be shut down after each match. #88 @@ -9,11 +9,11 @@ - Skyborg's overlay will work properly. - Rendering and bot percentages does not have to be toggled each match. - Improved how round robin decides the top teams of the stage. #92 - NicEastvillage - +- Added button for auto-naming teams based on its bots. #79 - NicEastvillage #### Version 1.5.1 - 3. October 2019 - Added seeding for first round of Swiss. - NicEastvillage -- Bogded the Swiss round generation algorithm to never make rounds with missing matches. Instead +- Bodged the Swiss round generation algorithm to never make rounds with missing matches. Instead it will accept a few rematches and warn the user. "Fixes" #5. - NicEastvillage #### Version 1.5 - 1. October 2019 diff --git a/src/dk/aau/cs/ds306e18/tournament/ui/ParticipantSettingsTabController.java b/src/dk/aau/cs/ds306e18/tournament/ui/ParticipantSettingsTabController.java index b34590c..9fc9206 100644 --- a/src/dk/aau/cs/ds306e18/tournament/ui/ParticipantSettingsTabController.java +++ b/src/dk/aau/cs/ds306e18/tournament/ui/ParticipantSettingsTabController.java @@ -4,6 +4,7 @@ import dk.aau.cs.ds306e18.tournament.model.*; import dk.aau.cs.ds306e18.tournament.utility.Alerts; import dk.aau.cs.ds306e18.tournament.rlbot.BotCollection; +import dk.aau.cs.ds306e18.tournament.utility.AutoNaming; import javafx.application.Platform; import javafx.collections.FXCollections; import javafx.event.ActionEvent; @@ -20,6 +21,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.Set; import java.util.stream.Collectors; @@ -30,6 +32,7 @@ public class ParticipantSettingsTabController { @FXML private HBox participantSettingsTab; @FXML private ChoiceBox seedingChoicebox; @FXML private TextField teamNameTextField; + @FXML private Button autoNameTeamButton; @FXML private Spinner seedSpinner; @FXML private Button addTeamBtn; @FXML private Button removeTeamBtn; @@ -192,7 +195,8 @@ void teamNameTextFieldOnKeyReleased(KeyEvent event) { void onActionAddTeam(ActionEvent actionEvent) { //Create a team with a bot and add the team to the tournament - Team team = new Team("Team " + (Tournament.get().getTeams().size() + 1), new ArrayList<>(), teamsListView.getItems().size() + 1, ""); + Team team = new Team("Unnamed Team", new ArrayList<>(), teamsListView.getItems().size() + 1, ""); + AutoNaming.autoName(team, Tournament.get().getTeams()); Tournament.get().addTeam(team); teamsListView.setItems(FXCollections.observableArrayList(Tournament.get().getTeams())); @@ -228,6 +232,8 @@ private void updateParticipantFields() { SeedingOption seedingOption = Tournament.get().getSeedingOption(); seedingChoicebox.setDisable(started); + teamsListView.refresh(); + int selectedIndex = getSelectedTeamIndex(); // Handle team order button disabling / enabling @@ -300,6 +306,7 @@ private void checkForEmptyTeamName() { String nameCheck = team.getTeamName(); nameCheck = nameCheck.replaceAll("\\s+", ""); if (nameCheck.compareTo("") == 0) { + team.setTeamName("Team ?"); } } @@ -410,4 +417,11 @@ public void onActionLoadFolder(ActionEvent actionEvent) { Main.lastSavedDirectory = folder; } } + + public void onActionAutoNameTeam(ActionEvent actionEvent) { + Team team = getSelectedTeam(); + AutoNaming.autoName(team, Tournament.get().getTeams()); + updateTeamFields(); + teamsListView.refresh(); + } } diff --git a/src/dk/aau/cs/ds306e18/tournament/ui/layout/ParticipantSettingsTab.fxml b/src/dk/aau/cs/ds306e18/tournament/ui/layout/ParticipantSettingsTab.fxml index 840fa29..82e05ab 100644 --- a/src/dk/aau/cs/ds306e18/tournament/ui/layout/ParticipantSettingsTab.fxml +++ b/src/dk/aau/cs/ds306e18/tournament/ui/layout/ParticipantSettingsTab.fxml @@ -120,11 +120,16 @@ - - - - - + + + + + + + +