GUI, table: improved save/load table config for new tourney dialog (miss num seats, decks, skill, player types and other params, related to #12981)

This commit is contained in:
Oleg Agafonov 2024-10-12 11:31:42 +04:00
parent d9e558f9c3
commit 2b9ae8e0aa
7 changed files with 147 additions and 69 deletions

View file

@ -22,15 +22,31 @@ public class TournamentPlayerPanel extends javax.swing.JPanel {
this.pnlPlayerName.setVisible(false);
}
public void init(int playerNum) {
public void init(int playerNum, PlayerType playerType, int playerSkill) {
cbPlayerType.setModel(new DefaultComboBoxModel(SessionHandler.getPlayerTypes()));
this.lblPlayerNum.setText("Player " + playerNum);
if (ClientDefaultSettings.otherPlayerIndex != null) {
Integer index = Integer.parseInt(ClientDefaultSettings.otherPlayerIndex);
if (index >= cbPlayerType.getItemCount()) {
cbPlayerType.setSelectedIndex(cbPlayerType.getItemCount() - 1);
} else {
cbPlayerType.setSelectedIndex(index);
}
}
if (playerType != null) {
this.cbPlayerType.setSelectedItem(playerType);
}
this.spnLevel.setValue(playerSkill);
}
public JComboBox getPlayerType() {
return this.cbPlayerType;
}
public int getPlayerSkill() {
return (Integer) this.spnLevel.getValue();
}
public boolean joinTournamentTable(UUID roomId, UUID tableId, DeckCardLists deckCardLists) {
if (this.cbPlayerType.getSelectedItem() != PlayerType.HUMAN) {
return SessionHandler.joinTournamentTable(