mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
playertype, enum singleton
This commit is contained in:
parent
b19170f34f
commit
211d433ea9
50 changed files with 642 additions and 675 deletions
|
|
@ -1,13 +1,12 @@
|
|||
package mage.client;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import mage.cards.decks.DeckCardLists;
|
||||
import mage.client.chat.LocalCommands;
|
||||
import mage.constants.ManaType;
|
||||
import mage.constants.PlayerAction;
|
||||
import mage.game.match.MatchOptions;
|
||||
import mage.game.tournament.TournamentOptions;
|
||||
import mage.players.PlayerType;
|
||||
import mage.players.net.UserData;
|
||||
import mage.remote.Connection;
|
||||
import mage.remote.MageRemoteException;
|
||||
|
|
@ -15,6 +14,8 @@ import mage.remote.Session;
|
|||
import mage.remote.SessionImpl;
|
||||
import mage.view.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Created by IGOUDT on 15-9-2016.
|
||||
*/
|
||||
|
|
@ -91,11 +92,11 @@ public final class SessionHandler {
|
|||
session.sendPlayerBoolean(gameId, b);
|
||||
}
|
||||
|
||||
public static String[] getPlayerTypes() {
|
||||
public static PlayerType[] getPlayerTypes() {
|
||||
return session.getPlayerTypes();
|
||||
}
|
||||
|
||||
public static boolean joinTournamentTable(UUID roomId, UUID tableId, String text, String selectedItem, Integer integer, DeckCardLists deckCardLists, String s) {
|
||||
public static boolean joinTournamentTable(UUID roomId, UUID tableId, String text, PlayerType selectedItem, Integer integer, DeckCardLists deckCardLists, String s) {
|
||||
return session.joinTournamentTable(roomId, tableId, text, selectedItem, integer, deckCardLists, s);
|
||||
}
|
||||
|
||||
|
|
@ -233,7 +234,7 @@ public final class SessionHandler {
|
|||
return session.createTable(roomId, options);
|
||||
}
|
||||
|
||||
public static boolean joinTable(UUID roomId, UUID tableId, String playerName, String human, int skill, DeckCardLists deckCardLists, String text) {
|
||||
public static boolean joinTable(UUID roomId, UUID tableId, String playerName, PlayerType human, int skill, DeckCardLists deckCardLists, String text) {
|
||||
return session.joinTable(roomId, tableId, playerName, human, skill, deckCardLists, text);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,14 +27,16 @@
|
|||
*/
|
||||
package mage.client.dialog;
|
||||
|
||||
import java.util.UUID;
|
||||
import javax.swing.JOptionPane;
|
||||
import mage.cards.decks.importer.DeckImporterUtil;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.SessionHandler;
|
||||
import mage.players.PlayerType;
|
||||
import mage.remote.Session;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -143,9 +145,9 @@ public class JoinTableDialog extends MageDialog {
|
|||
try {
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_PASSWORD_JOIN, txtPassword.getText());
|
||||
if (isTournament) {
|
||||
joined = session.joinTournamentTable(roomId, tableId, this.newPlayerPanel.getPlayerName(), "Human", 1, DeckImporterUtil.importDeck(this.newPlayerPanel.getDeckFile()), this.txtPassword.getText());
|
||||
joined = session.joinTournamentTable(roomId, tableId, this.newPlayerPanel.getPlayerName(), PlayerType.HUMAN, 1, DeckImporterUtil.importDeck(this.newPlayerPanel.getDeckFile()), this.txtPassword.getText());
|
||||
} else {
|
||||
joined = session.joinTable(roomId, tableId, this.newPlayerPanel.getPlayerName(), "Human", 1, DeckImporterUtil.importDeck(this.newPlayerPanel.getDeckFile()), this.txtPassword.getText());
|
||||
joined = session.joinTable(roomId, tableId, this.newPlayerPanel.getPlayerName(), PlayerType.HUMAN, 1, DeckImporterUtil.importDeck(this.newPlayerPanel.getDeckFile()), this.txtPassword.getText());
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
|
|
|
|||
|
|
@ -27,14 +27,6 @@
|
|||
*/
|
||||
package mage.client.dialog;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.swing.*;
|
||||
|
||||
import mage.cards.decks.importer.DeckImporterUtil;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.SessionHandler;
|
||||
|
|
@ -48,10 +40,18 @@ import mage.constants.MultiplayerAttackOption;
|
|||
import mage.constants.RangeOfInfluence;
|
||||
import mage.constants.SkillLevel;
|
||||
import mage.game.match.MatchOptions;
|
||||
import mage.players.PlayerType;
|
||||
import mage.view.GameTypeView;
|
||||
import mage.view.TableView;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -65,7 +65,7 @@ public class NewTableDialog extends MageDialog {
|
|||
private UUID roomId;
|
||||
private String lastSessionId;
|
||||
private final List<TablePlayerPanel> players = new ArrayList<>();
|
||||
private final List<String> prefPlayerTypes = new ArrayList<>();
|
||||
private final List<PlayerType> prefPlayerTypes = new ArrayList<>();
|
||||
|
||||
private static final String LIMITED = "Limited";
|
||||
|
||||
|
|
@ -370,7 +370,7 @@ public class NewTableDialog extends MageDialog {
|
|||
private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed
|
||||
GameTypeView gameType = (GameTypeView) cbGameType.getSelectedItem();
|
||||
MatchOptions options = new MatchOptions(this.txtName.getText(), gameType.getName(), false, 2);
|
||||
options.getPlayerTypes().add("Human");
|
||||
options.getPlayerTypes().add(PlayerType.HUMAN);
|
||||
for (TablePlayerPanel player : players) {
|
||||
options.getPlayerTypes().add(player.getPlayerType());
|
||||
}
|
||||
|
|
@ -404,7 +404,7 @@ public class NewTableDialog extends MageDialog {
|
|||
roomId,
|
||||
table.getTableId(),
|
||||
this.player1Panel.getPlayerName(),
|
||||
"Human", 1,
|
||||
PlayerType.HUMAN, 1,
|
||||
DeckImporterUtil.importDeck(this.player1Panel.getDeckFile()),
|
||||
this.txtPassword.getText())) {
|
||||
for (TablePlayerPanel player : players) {
|
||||
|
|
@ -509,7 +509,7 @@ public class NewTableDialog extends MageDialog {
|
|||
if (numPlayers > players.size()) {
|
||||
while (players.size() != numPlayers) {
|
||||
TablePlayerPanel playerPanel = new TablePlayerPanel();
|
||||
String playerType = "Human";
|
||||
PlayerType playerType = PlayerType.HUMAN;
|
||||
if (prefPlayerTypes.size() >= players.size() && !players.isEmpty()) {
|
||||
playerType = prefPlayerTypes.get(players.size() - 1);
|
||||
}
|
||||
|
|
@ -597,7 +597,9 @@ public class NewTableDialog extends MageDialog {
|
|||
|
||||
String playerTypes = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_PLAYER_TYPES, "Human");
|
||||
prefPlayerTypes.clear();
|
||||
prefPlayerTypes.addAll(Arrays.asList(playerTypes.split(",")));
|
||||
for(String pType : playerTypes.split(",")) {
|
||||
prefPlayerTypes.add(PlayerType.getByDescription(pType));
|
||||
}
|
||||
this.spnNumPlayers.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_PLAYERS, "2")));
|
||||
|
||||
String gameTypeName = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_GAME_TYPE, "Two Player Duel");
|
||||
|
|
|
|||
|
|
@ -33,22 +33,6 @@
|
|||
*/
|
||||
package mage.client.dialog;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.swing.ComboBoxModel;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.SpinnerNumberModel;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.cards.decks.importer.DeckImporterUtil;
|
||||
import mage.cards.repository.ExpansionInfo;
|
||||
|
|
@ -65,13 +49,20 @@ import mage.game.draft.DraftOptions;
|
|||
import mage.game.draft.DraftOptions.TimingOption;
|
||||
import mage.game.tournament.LimitedOptions;
|
||||
import mage.game.tournament.TournamentOptions;
|
||||
import mage.players.PlayerType;
|
||||
import mage.view.GameTypeView;
|
||||
import mage.view.TableView;
|
||||
import mage.view.TournamentTypeView;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class NewTournamentDialog extends MageDialog {
|
||||
|
|
@ -93,7 +84,9 @@ public class NewTournamentDialog extends MageDialog {
|
|||
private String cubeFromDeckFilename = "";
|
||||
private boolean automaticChange = false;
|
||||
|
||||
/** Creates new form NewTournamentDialog */
|
||||
/**
|
||||
* Creates new form NewTournamentDialog
|
||||
*/
|
||||
public NewTournamentDialog() {
|
||||
initComponents();
|
||||
lastSessionId = "";
|
||||
|
|
@ -121,8 +114,8 @@ public class NewTournamentDialog extends MageDialog {
|
|||
cbDraftCube.setModel(new DefaultComboBoxModel(SessionHandler.getDraftCubes()));
|
||||
cbDraftTiming.setModel(new DefaultComboBoxModel(DraftOptions.TimingOption.values()));
|
||||
// update player types
|
||||
int i=2;
|
||||
for (TournamentPlayerPanel tournamentPlayerPanel :players) {
|
||||
int i = 2;
|
||||
for (TournamentPlayerPanel tournamentPlayerPanel : players) {
|
||||
tournamentPlayerPanel.init(i++);
|
||||
}
|
||||
cbAllowSpectators.setSelected(true);
|
||||
|
|
@ -133,7 +126,8 @@ public class NewTournamentDialog extends MageDialog {
|
|||
this.setVisible(true);
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
/**
|
||||
* This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
|
|
@ -213,7 +207,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
|
||||
lblTournamentType.setText("Tournament Type:");
|
||||
|
||||
cbTournamentType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||
cbTournamentType.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"Item 1", "Item 2", "Item 3", "Item 4"}));
|
||||
cbTournamentType.addActionListener(evt -> cbTournamentTypeActionPerformed(evt));
|
||||
|
||||
lbDeckType.setText("Deck Type:");
|
||||
|
|
@ -235,7 +229,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
|
||||
lblDraftCube.setText("Draft Cube:");
|
||||
|
||||
cbDraftCube.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||
cbDraftCube.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"Item 1", "Item 2", "Item 3", "Item 4"}));
|
||||
cbDraftCube.addActionListener(evt -> cbDraftCubeActionPerformed(evt));
|
||||
|
||||
lblNumRounds.setText("Number of Swiss Rounds:");
|
||||
|
|
@ -260,27 +254,27 @@ public class NewTournamentDialog extends MageDialog {
|
|||
|
||||
jLabel6.setText("Timing:");
|
||||
|
||||
cbDraftTiming.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||
cbDraftTiming.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"Item 1", "Item 2", "Item 3", "Item 4"}));
|
||||
cbDraftTiming.addActionListener(evt -> cbDraftTimingActionPerformed(evt));
|
||||
|
||||
javax.swing.GroupLayout pnlDraftOptionsLayout = new javax.swing.GroupLayout(pnlDraftOptions);
|
||||
pnlDraftOptions.setLayout(pnlDraftOptionsLayout);
|
||||
pnlDraftOptionsLayout.setHorizontalGroup(
|
||||
pnlDraftOptionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(pnlDraftOptionsLayout.createSequentialGroup()
|
||||
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(cbDraftTiming, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(19, Short.MAX_VALUE))
|
||||
pnlDraftOptionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(pnlDraftOptionsLayout.createSequentialGroup()
|
||||
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(cbDraftTiming, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(19, Short.MAX_VALUE))
|
||||
);
|
||||
pnlDraftOptionsLayout.setVerticalGroup(
|
||||
pnlDraftOptionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(pnlDraftOptionsLayout.createSequentialGroup()
|
||||
.addGap(3, 3, 3)
|
||||
.addGroup(pnlDraftOptionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cbDraftTiming, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap())
|
||||
pnlDraftOptionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(pnlDraftOptionsLayout.createSequentialGroup()
|
||||
.addGap(3, 3, 3)
|
||||
.addGroup(pnlDraftOptionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cbDraftTiming, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
cbAllowSpectators.setText("Allow spectators");
|
||||
|
|
@ -306,12 +300,12 @@ public class NewTournamentDialog extends MageDialog {
|
|||
javax.swing.GroupLayout pnlPlayersLayout = new javax.swing.GroupLayout(pnlPlayers);
|
||||
pnlPlayers.setLayout(pnlPlayersLayout);
|
||||
pnlPlayersLayout.setHorizontalGroup(
|
||||
pnlPlayersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(pnlOtherPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
pnlPlayersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(pnlOtherPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
);
|
||||
pnlPlayersLayout.setVerticalGroup(
|
||||
pnlPlayersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(pnlOtherPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
pnlPlayersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(pnlOtherPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
btnOk.setText("OK");
|
||||
|
|
@ -333,170 +327,170 @@ public class NewTournamentDialog extends MageDialog {
|
|||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(pnlPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(pnlPacks, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(lblNbrPlayers)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnNumPlayers, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblNbrSeats)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnNumSeats, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(lblPacks)
|
||||
.addComponent(lblPlayer1))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(28, 28, 28)
|
||||
.addComponent(pnlDraftOptions, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(lblNumRounds))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(lblConstructionTime)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(spnConstructTime, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(chkRollbackTurnsAllowed))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(spnNumRounds, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(cbAllowSpectators))))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addComponent(btnOk)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnCancel))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblDraftCube)
|
||||
.addComponent(lblTournamentType)
|
||||
.addComponent(lbDeckType)
|
||||
.addComponent(lblGameType))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(cbDraftCube, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cbDeckType, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cbGameType, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(28, 28, 28)
|
||||
.addComponent(lblNumWins)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblQuitRatio)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnQuitRatio, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(chkRated))
|
||||
.addComponent(cbTournamentType, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(lblName)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lbTimeLimit)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(cbTimeLimit, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(lbSkillLevel)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(cbSkillLevel, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblPassword)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(lblFreeMulligans)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)))))
|
||||
.addComponent(player1Panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(pnlRandomPacks, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(pnlPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(pnlPacks, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(lblNbrPlayers)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnNumPlayers, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblNbrSeats)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnNumSeats, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(lblPacks)
|
||||
.addComponent(lblPlayer1))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(28, 28, 28)
|
||||
.addComponent(pnlDraftOptions, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(lblNumRounds))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(lblConstructionTime)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(spnConstructTime, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(chkRollbackTurnsAllowed))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(spnNumRounds, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(cbAllowSpectators))))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addComponent(btnOk)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnCancel))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblDraftCube)
|
||||
.addComponent(lblTournamentType)
|
||||
.addComponent(lbDeckType)
|
||||
.addComponent(lblGameType))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(cbDraftCube, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cbDeckType, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cbGameType, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(28, 28, 28)
|
||||
.addComponent(lblNumWins)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblQuitRatio)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnQuitRatio, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(chkRated))
|
||||
.addComponent(cbTournamentType, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(lblName)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lbTimeLimit)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(cbTimeLimit, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(lbSkillLevel)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(cbSkillLevel, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblPassword)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(lblFreeMulligans)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)))))
|
||||
.addComponent(player1Panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(pnlRandomPacks, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(4, 4, 4)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblName)
|
||||
.addComponent(lbTimeLimit)
|
||||
.addComponent(cbTimeLimit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblPassword)
|
||||
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lbSkillLevel)
|
||||
.addComponent(cbSkillLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblFreeMulligans)
|
||||
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblNumWins)
|
||||
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblQuitRatio)
|
||||
.addComponent(spnQuitRatio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(chkRated))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cbTournamentType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblTournamentType))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cbDraftCube, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblDraftCube))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cbDeckType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lbDeckType))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblGameType)
|
||||
.addComponent(cbGameType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblPacks)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(pnlPacks, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(pnlRandomPacks, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cbAllowSpectators, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(spnNumRounds, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblNumRounds))
|
||||
.addComponent(lblNbrPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(spnNumPlayers)
|
||||
.addComponent(lblNbrSeats, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(spnNumSeats)
|
||||
.addComponent(pnlDraftOptions, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblPlayer1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(spnConstructTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblConstructionTime)
|
||||
.addComponent(chkRollbackTurnsAllowed)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(player1Panel, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(pnlPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(btnOk)
|
||||
.addComponent(btnCancel))
|
||||
.addContainerGap())
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(4, 4, 4)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblName)
|
||||
.addComponent(lbTimeLimit)
|
||||
.addComponent(cbTimeLimit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblPassword)
|
||||
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lbSkillLevel)
|
||||
.addComponent(cbSkillLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblFreeMulligans)
|
||||
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblNumWins)
|
||||
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblQuitRatio)
|
||||
.addComponent(spnQuitRatio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(chkRated))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cbTournamentType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblTournamentType))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cbDraftCube, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblDraftCube))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cbDeckType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lbDeckType))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblGameType)
|
||||
.addComponent(cbGameType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblPacks)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(pnlPacks, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(pnlRandomPacks, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cbAllowSpectators, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(spnNumRounds, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblNumRounds))
|
||||
.addComponent(lblNbrPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(spnNumPlayers)
|
||||
.addComponent(lblNbrSeats, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(spnNumSeats)
|
||||
.addComponent(pnlDraftOptions, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblPlayer1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(spnConstructTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblConstructionTime)
|
||||
.addComponent(chkRollbackTurnsAllowed)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(player1Panel, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(pnlPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(btnOk)
|
||||
.addComponent(btnCancel))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
bindingGroup.bind();
|
||||
|
|
@ -510,18 +504,18 @@ public class NewTournamentDialog extends MageDialog {
|
|||
|
||||
private void btnOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOkActionPerformed
|
||||
TournamentTypeView tournamentType = (TournamentTypeView) cbTournamentType.getSelectedItem();
|
||||
int numSeats = (Integer)this.spnNumSeats.getValue();
|
||||
int numSeats = (Integer) this.spnNumSeats.getValue();
|
||||
TournamentOptions tOptions = new TournamentOptions(this.txtName.getText(), "", numSeats);
|
||||
tOptions.setTournamentType(tournamentType.getName());
|
||||
tOptions.setPassword(txtPassword.getText());
|
||||
tOptions.getPlayerTypes().add("Human");
|
||||
tOptions.getPlayerTypes().add(PlayerType.HUMAN);
|
||||
tOptions.setWatchingAllowed(cbAllowSpectators.isSelected());
|
||||
tOptions.setQuitRatio((Integer)spnQuitRatio.getValue());
|
||||
for (TournamentPlayerPanel player: players) {
|
||||
tOptions.getPlayerTypes().add((String) player.getPlayerType().getSelectedItem());
|
||||
tOptions.setQuitRatio((Integer) spnQuitRatio.getValue());
|
||||
for (TournamentPlayerPanel player : players) {
|
||||
tOptions.getPlayerTypes().add((PlayerType) player.getPlayerType().getSelectedItem());
|
||||
}
|
||||
if (!tournamentType.isElimination()) {
|
||||
tOptions.setNumberRounds((Integer)spnNumRounds.getValue());
|
||||
tOptions.setNumberRounds((Integer) spnNumRounds.getValue());
|
||||
}
|
||||
if (tournamentType.isDraft()) {
|
||||
DraftOptions options = new DraftOptions();
|
||||
|
|
@ -533,21 +527,21 @@ public class NewTournamentDialog extends MageDialog {
|
|||
tOptions.setLimitedOptions(new LimitedOptions());
|
||||
}
|
||||
if (tournamentType.isLimited()) {
|
||||
tOptions.getLimitedOptions().setConstructionTime((Integer)this.spnConstructTime.getValue() * 60);
|
||||
tOptions.getLimitedOptions().setConstructionTime((Integer) this.spnConstructTime.getValue() * 60);
|
||||
tOptions.getLimitedOptions().setIsRandom(tournamentType.isRandom());
|
||||
if (tournamentType.isCubeBooster()) {
|
||||
tOptions.getLimitedOptions().setDraftCubeName(this.cbDraftCube.getSelectedItem().toString());
|
||||
if (!(cubeFromDeckFilename.isEmpty())) {
|
||||
Deck cubeFromDeck = new Deck();
|
||||
Deck cubeFromDeck = new Deck();
|
||||
try {
|
||||
cubeFromDeck = Deck.load(DeckImporterUtil.importDeck(cubeFromDeckFilename), true, true);
|
||||
} catch (GameException e1) {
|
||||
JOptionPane.showMessageDialog(MageFrame.getDesktop(), e1.getMessage(), "Error loading deck", JOptionPane.ERROR_MESSAGE);
|
||||
JOptionPane.showMessageDialog(MageFrame.getDesktop(), e1.getMessage(), "Error loading deck", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
if (cubeFromDeck != null) {
|
||||
cubeFromDeck.clearLayouts();
|
||||
tOptions.getLimitedOptions().setCubeFromDeck(cubeFromDeck);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (tournamentType.isRandom() || tournamentType.isRichMan()) {
|
||||
this.isRandom = tournamentType.isRandom();
|
||||
|
|
@ -558,18 +552,18 @@ public class NewTournamentDialog extends MageDialog {
|
|||
if (tournamentType.isRichMan()) {
|
||||
maxPacks = 36;
|
||||
}
|
||||
if (selected.size() > maxPacks ){
|
||||
if (selected.size() > maxPacks) {
|
||||
StringBuilder infoString = new StringBuilder("More sets were selected than needed. ");
|
||||
infoString.append(maxPacks);
|
||||
infoString.append(" sets will be randomly chosen.");
|
||||
JOptionPane.showMessageDialog(MageFrame.getDesktop(), infoString, "Information", JOptionPane.INFORMATION_MESSAGE);
|
||||
Collections.shuffle(selected);
|
||||
tOptions.getLimitedOptions().getSetCodes().addAll(selected.subList(0, maxPacks));
|
||||
}else{
|
||||
tOptions.getLimitedOptions().getSetCodes().addAll(selected);
|
||||
} else {
|
||||
tOptions.getLimitedOptions().getSetCodes().addAll(selected);
|
||||
}
|
||||
} else {
|
||||
for (JComboBox pack: packs) {
|
||||
for (JComboBox pack : packs) {
|
||||
tOptions.getLimitedOptions().getSetCodes().add(((ExpansionInfo) pack.getSelectedItem()).getCode());
|
||||
}
|
||||
}
|
||||
|
|
@ -588,8 +582,8 @@ public class NewTournamentDialog extends MageDialog {
|
|||
|
||||
tOptions.getMatchOptions().setMatchTimeLimit((MatchTimeLimit) this.cbTimeLimit.getSelectedItem());
|
||||
tOptions.getMatchOptions().setSkillLevel((SkillLevel) this.cbSkillLevel.getSelectedItem());
|
||||
tOptions.getMatchOptions().setWinsNeeded((Integer)this.spnNumWins.getValue());
|
||||
tOptions.getMatchOptions().setFreeMulligans((Integer)this.spnFreeMulligans.getValue());
|
||||
tOptions.getMatchOptions().setWinsNeeded((Integer) this.spnNumWins.getValue());
|
||||
tOptions.getMatchOptions().setFreeMulligans((Integer) this.spnFreeMulligans.getValue());
|
||||
tOptions.getMatchOptions().setAttackOption(MultiplayerAttackOption.LEFT);
|
||||
tOptions.getMatchOptions().setRange(RangeOfInfluence.ALL);
|
||||
tOptions.getMatchOptions().setRollbackTurnsAllowed(this.chkRollbackTurnsAllowed.isSelected());
|
||||
|
|
@ -605,10 +599,10 @@ public class NewTournamentDialog extends MageDialog {
|
|||
roomId,
|
||||
table.getTableId(),
|
||||
this.player1Panel.getPlayerName(),
|
||||
"Human", 1,
|
||||
PlayerType.HUMAN, 1,
|
||||
DeckImporterUtil.importDeck(this.player1Panel.getDeckFile()),
|
||||
tOptions.getPassword())) {
|
||||
for (TournamentPlayerPanel player: players) {
|
||||
for (TournamentPlayerPanel player : players) {
|
||||
if (!player.getPlayerType().toString().equals("Human")) {
|
||||
if (!player.joinTournamentTable(roomId, table.getTableId(), DeckImporterUtil.importDeck(this.player1Panel.getDeckFile()))) {
|
||||
// error message must be send by sever
|
||||
|
|
@ -633,8 +627,8 @@ public class NewTournamentDialog extends MageDialog {
|
|||
}//GEN-LAST:event_btnCancelActionPerformed
|
||||
|
||||
private void updateNumSeats() {
|
||||
int numPlayers = (Integer)this.spnNumPlayers.getValue();
|
||||
int numSeats = (Integer)this.spnNumSeats.getValue();
|
||||
int numPlayers = (Integer) this.spnNumPlayers.getValue();
|
||||
int numSeats = (Integer) this.spnNumSeats.getValue();
|
||||
|
||||
if (numSeats > 2) {
|
||||
TournamentTypeView tournamentType = (TournamentTypeView) cbTournamentType.getSelectedItem();
|
||||
|
|
@ -652,16 +646,16 @@ public class NewTournamentDialog extends MageDialog {
|
|||
}
|
||||
|
||||
private void spnNumPlayersStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnNumPlayersStateChanged
|
||||
int numPlayers = (Integer)this.spnNumPlayers.getValue();
|
||||
int numPlayers = (Integer) this.spnNumPlayers.getValue();
|
||||
createPlayers(numPlayers - 1);
|
||||
int numSeats = (Integer)this.spnNumSeats.getValue();
|
||||
int numSeats = (Integer) this.spnNumSeats.getValue();
|
||||
if (numSeats > 2 && numPlayers != numSeats) {
|
||||
updateNumSeats();
|
||||
}
|
||||
}//GEN-LAST:event_spnNumPlayersStateChanged
|
||||
|
||||
private void spnNumSeatsStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnNumSeatsStateChanged
|
||||
int numSeats = (Integer)this.spnNumSeats.getValue();
|
||||
int numSeats = (Integer) this.spnNumSeats.getValue();
|
||||
if (numSeats > 2) {
|
||||
this.spnNumPlayers.setEnabled(false);
|
||||
} else {
|
||||
|
|
@ -669,11 +663,11 @@ public class NewTournamentDialog extends MageDialog {
|
|||
}
|
||||
updateNumSeats();
|
||||
}//GEN-LAST:event_spnNumSeatsStateChanged
|
||||
|
||||
|
||||
|
||||
private void spnNumWinsnumPlayersChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnNumWinsnumPlayersChanged
|
||||
int numSeats = (Integer)this.spnNumSeats.getValue();
|
||||
int numWins = (Integer)this.spnNumSeats.getValue();
|
||||
int numSeats = (Integer) this.spnNumSeats.getValue();
|
||||
int numWins = (Integer) this.spnNumSeats.getValue();
|
||||
if (numSeats > 2) {
|
||||
spnNumWins.setValue(1);
|
||||
}
|
||||
|
|
@ -718,6 +712,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
private void cbGameTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbGameTypeActionPerformed
|
||||
setGameOptions();
|
||||
}//GEN-LAST:event_cbGameTypeActionPerformed
|
||||
|
||||
private void setGameOptions() {
|
||||
GameTypeView gameType = (GameTypeView) cbGameType.getSelectedItem();
|
||||
// int oldValue = (Integer) this.spnNumPlayers.getValue();
|
||||
|
|
@ -747,10 +742,10 @@ public class NewTournamentDialog extends MageDialog {
|
|||
|
||||
if (tournamentType.isLimited()) {
|
||||
this.isRandom = tournamentType.isRandom();
|
||||
this.isRichMan = tournamentType.isRichMan();
|
||||
if (this.isRandom || this.isRichMan){
|
||||
this.isRichMan = tournamentType.isRichMan();
|
||||
if (this.isRandom || this.isRichMan) {
|
||||
createRandomPacks();
|
||||
}else{
|
||||
} else {
|
||||
createPacks(tournamentType.getNumBoosters());
|
||||
}
|
||||
}
|
||||
|
|
@ -759,8 +754,8 @@ public class NewTournamentDialog extends MageDialog {
|
|||
|
||||
private void setNumberOfSwissRoundsMin(int numPlayers) {
|
||||
// set the number of minimum swiss rounds related to the number of players
|
||||
int minRounds = (int) Math.ceil(Math.log(numPlayers + 1) / Math.log(2));
|
||||
int newValue = Math.max((Integer)spnNumRounds.getValue(), minRounds);
|
||||
int minRounds = (int) Math.ceil(Math.log(numPlayers + 1) / Math.log(2));
|
||||
int newValue = Math.max((Integer) spnNumRounds.getValue(), minRounds);
|
||||
this.spnNumRounds.setModel(new SpinnerNumberModel(newValue, minRounds, 10, 1));
|
||||
this.pack();
|
||||
this.revalidate();
|
||||
|
|
@ -793,7 +788,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
this.lblPacks.setVisible(false);
|
||||
this.pnlPacks.setVisible(false);
|
||||
this.pnlRandomPacks.setVisible(false);
|
||||
} else if (tournamentType.isRandom() || tournamentType.isRichMan()){
|
||||
} else if (tournamentType.isRandom() || tournamentType.isRichMan()) {
|
||||
this.lblDraftCube.setVisible(false);
|
||||
this.cbDraftCube.setVisible(false);
|
||||
this.lblPacks.setVisible(true);
|
||||
|
|
@ -887,14 +882,13 @@ public class NewTournamentDialog extends MageDialog {
|
|||
private void packActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
boolean start = false;
|
||||
int selectedIndex = 0;
|
||||
for (JComboBox pack: packs) {
|
||||
for (JComboBox pack : packs) {
|
||||
if (!start) {
|
||||
if (evt.getSource().equals(pack)) {
|
||||
start = true;
|
||||
selectedIndex = pack.getSelectedIndex();
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
pack.setSelectedIndex(selectedIndex);
|
||||
}
|
||||
}
|
||||
|
|
@ -909,8 +903,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
|
||||
players.add(playerPanel);
|
||||
}
|
||||
}
|
||||
else if (numPlayers < players.size()) {
|
||||
} else if (numPlayers < players.size()) {
|
||||
while (players.size() != numPlayers) {
|
||||
players.remove(players.size() - 1);
|
||||
}
|
||||
|
|
@ -922,10 +915,9 @@ public class NewTournamentDialog extends MageDialog {
|
|||
}
|
||||
|
||||
|
||||
|
||||
private void drawPlayers() {
|
||||
this.pnlOtherPlayers.removeAll();
|
||||
for (TournamentPlayerPanel panel: players) {
|
||||
for (TournamentPlayerPanel panel : players) {
|
||||
this.pnlOtherPlayers.add(panel);
|
||||
panel.getPlayerType().addActionListener(evt -> {
|
||||
if (!automaticChange) {
|
||||
|
|
@ -942,14 +934,13 @@ public class NewTournamentDialog extends MageDialog {
|
|||
boolean start = false;
|
||||
int selectedIndex = 0;
|
||||
automaticChange = true;
|
||||
for (TournamentPlayerPanel player: players) {
|
||||
for (TournamentPlayerPanel player : players) {
|
||||
if (!start) {
|
||||
if (evt.getSource().equals(player.getPlayerType())) {
|
||||
start = true;
|
||||
selectedIndex = player.getPlayerType().getSelectedIndex();
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
player.getPlayerType().setSelectedIndex(selectedIndex);
|
||||
}
|
||||
}
|
||||
|
|
@ -959,19 +950,19 @@ public class NewTournamentDialog extends MageDialog {
|
|||
/**
|
||||
* set the tournament settings from java prefs
|
||||
*/
|
||||
private void setTournamentSettingsFromPrefs () {
|
||||
private void setTournamentSettingsFromPrefs() {
|
||||
int numPlayers;
|
||||
txtName.setText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_NAME, "Tournament"));
|
||||
txtPassword.setText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PASSWORD, ""));
|
||||
int timeLimit = Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_TIME_LIMIT, "1500"));
|
||||
for (MatchTimeLimit mtl :MatchTimeLimit.values()) {
|
||||
for (MatchTimeLimit mtl : MatchTimeLimit.values()) {
|
||||
if (mtl.getTimeLimit() == timeLimit) {
|
||||
this.cbTimeLimit.setSelectedItem(mtl);
|
||||
break;
|
||||
}
|
||||
}
|
||||
String skillLevelDefault = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_SKILL_LEVEL, "Casual");
|
||||
for (SkillLevel skillLevel :SkillLevel.values()) {
|
||||
for (SkillLevel skillLevel : SkillLevel.values()) {
|
||||
if (skillLevel.toString().equals(skillLevelDefault)) {
|
||||
this.cbSkillLevel.setSelectedItem(skillLevel);
|
||||
break;
|
||||
|
|
@ -1006,7 +997,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
if (tournamentType.isDraft()) {
|
||||
numPlayers = Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PLAYERS_DRAFT, "4"));
|
||||
setTournamentOptions(numPlayers);
|
||||
if (!(tournamentType.isRandom() || tournamentType.isRichMan())){
|
||||
if (!(tournamentType.isRandom() || tournamentType.isRichMan())) {
|
||||
loadBoosterPacks(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_DRAFT, ""));
|
||||
}
|
||||
|
||||
|
|
@ -1028,13 +1019,13 @@ public class NewTournamentDialog extends MageDialog {
|
|||
if (!packString.isEmpty()) {
|
||||
String[] packsArray = packString.substring(1, packString.length() - 1).split(",");
|
||||
int packNumber = 0;
|
||||
for (String pack : packsArray ){
|
||||
for (String pack : packsArray) {
|
||||
packNumber++;
|
||||
if (this.packs.size() >= packNumber - 1) {
|
||||
JComboBox comboBox = this.packs.get(packNumber-1);
|
||||
JComboBox comboBox = this.packs.get(packNumber - 1);
|
||||
ComboBoxModel model = comboBox.getModel();
|
||||
int size = model.getSize();
|
||||
for(int i=0;i<size;i++) {
|
||||
for (int i = 0; i < size; i++) {
|
||||
ExpansionInfo element = (ExpansionInfo) model.getElementAt(i);
|
||||
if (element.getCode().equals(pack.trim())) {
|
||||
comboBox.setSelectedIndex(i);
|
||||
|
|
@ -1051,7 +1042,6 @@ public class NewTournamentDialog extends MageDialog {
|
|||
* Save the settings to java prefs to reload it next time the dialog will be created
|
||||
*
|
||||
* @param tOptions Tournament options
|
||||
|
||||
*/
|
||||
private void saveTournamentSettingsToPrefs(TournamentOptions tOptions) {
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_NAME, tOptions.getName());
|
||||
|
|
@ -1082,18 +1072,18 @@ public class NewTournamentDialog extends MageDialog {
|
|||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_DECK_FILE, deckFile);
|
||||
}
|
||||
|
||||
if (tOptions.getLimitedOptions().getIsRandom()){
|
||||
if (tOptions.getLimitedOptions().getIsRandom()) {
|
||||
// save random boosters to prefs
|
||||
StringBuilder packlist = new StringBuilder();
|
||||
for (String pack : this.randomPackSelector.getSelectedPacks()){
|
||||
for (String pack : this.randomPackSelector.getSelectedPacks()) {
|
||||
packlist.append(pack);
|
||||
packlist.append(';');
|
||||
}
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_RANDOM_DRAFT, packlist.toString());
|
||||
}
|
||||
}
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_ALLOW_SPECTATORS, (tOptions.isWatchingAllowed()?"Yes":"No"));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_ALLOW_ROLLBACKS, (tOptions.getMatchOptions().isRollbackTurnsAllowed()?"Yes":"No"));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_ALLOW_SPECTATORS, (tOptions.isWatchingAllowed() ? "Yes" : "No"));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_ALLOW_ROLLBACKS, (tOptions.getMatchOptions().isRollbackTurnsAllowed() ? "Yes" : "No"));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_RATED, (tOptions.getMatchOptions().isRated() ? "Yes" : "No"));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,14 +34,16 @@
|
|||
|
||||
package mage.client.table;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import mage.cards.decks.importer.DeckImporterUtil;
|
||||
import mage.client.SessionHandler;
|
||||
import mage.client.util.Config;
|
||||
import mage.client.util.Event;
|
||||
import mage.client.util.Listener;
|
||||
import mage.players.PlayerType;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -58,7 +60,7 @@ public class TablePlayerPanel extends javax.swing.JPanel {
|
|||
this.newPlayerPanel.setVisible(false);
|
||||
}
|
||||
|
||||
public void init(int playerNum, String playerType) {
|
||||
public void init(int playerNum, PlayerType playerType) {
|
||||
cbPlayerType.setModel(new DefaultComboBoxModel(SessionHandler.getPlayerTypes()));
|
||||
this.lblPlayerNum.setText("Player " + playerNum);
|
||||
if (Config.defaultOtherPlayerIndex != null) {
|
||||
|
|
@ -77,13 +79,13 @@ public class TablePlayerPanel extends javax.swing.JPanel {
|
|||
|
||||
public boolean joinTable(UUID roomId, UUID tableId) throws IOException, ClassNotFoundException {
|
||||
if (!this.cbPlayerType.getSelectedItem().equals("Human")) {
|
||||
return SessionHandler.joinTable(roomId, tableId, this.newPlayerPanel.getPlayerName(), (String)this.cbPlayerType.getSelectedItem(), this.newPlayerPanel.getLevel(), DeckImporterUtil.importDeck(this.newPlayerPanel.getDeckFile()),"");
|
||||
return SessionHandler.joinTable(roomId, tableId, this.newPlayerPanel.getPlayerName(), (PlayerType) this.cbPlayerType.getSelectedItem(), this.newPlayerPanel.getLevel(), DeckImporterUtil.importDeck(this.newPlayerPanel.getDeckFile()),"");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getPlayerType() {
|
||||
return (String) this.cbPlayerType.getSelectedItem();
|
||||
public PlayerType getPlayerType() {
|
||||
return PlayerType.getByDescription(this.cbPlayerType.getSelectedItem().toString());
|
||||
}
|
||||
|
||||
public void addPlayerTypeEventListener(Listener<Event> listener) {
|
||||
|
|
|
|||
|
|
@ -33,69 +33,21 @@
|
|||
*/
|
||||
package mage.client.table;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.HeadlessException;
|
||||
import java.awt.Image;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.beans.PropertyVetoException;
|
||||
import java.io.File;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JDesktopPane;
|
||||
import javax.swing.JInternalFrame;
|
||||
import javax.swing.JLayeredPane;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JToggleButton;
|
||||
import javax.swing.RowFilter;
|
||||
import javax.swing.SwingWorker;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import mage.cards.decks.importer.DeckImporterUtil;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.SessionHandler;
|
||||
import mage.client.chat.ChatPanelBasic;
|
||||
import mage.client.components.MageComponents;
|
||||
import mage.client.dialog.JoinTableDialog;
|
||||
import mage.client.dialog.NewTableDialog;
|
||||
import mage.client.dialog.NewTournamentDialog;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_TABLES_COLUMNS_ORDER;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_TABLES_COLUMNS_WIDTH;
|
||||
import mage.client.dialog.TableWaitingDialog;
|
||||
import static mage.client.table.TablesPanel.PASSWORDED;
|
||||
import mage.client.dialog.*;
|
||||
import mage.client.util.ButtonColumn;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.IgnoreList;
|
||||
import mage.client.util.MageTableRowSorter;
|
||||
import mage.client.util.gui.GuiDisplayUtil;
|
||||
import mage.client.util.gui.TableUtil;
|
||||
import mage.constants.MatchTimeLimit;
|
||||
import mage.constants.MultiplayerAttackOption;
|
||||
import mage.constants.PlayerAction;
|
||||
import mage.constants.RangeOfInfluence;
|
||||
import mage.constants.SkillLevel;
|
||||
import mage.constants.*;
|
||||
import mage.game.match.MatchOptions;
|
||||
import mage.players.PlayerType;
|
||||
import mage.remote.MageRemoteException;
|
||||
import mage.view.MatchView;
|
||||
import mage.view.RoomUsersView;
|
||||
|
|
@ -103,6 +55,25 @@ import mage.view.TableView;
|
|||
import mage.view.UserRequestMessage;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.beans.PropertyVetoException;
|
||||
import java.io.File;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_TABLES_COLUMNS_ORDER;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_TABLES_COLUMNS_WIDTH;
|
||||
import static mage.client.table.TablesPanel.PASSWORDED;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -216,7 +187,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
if (PASSWORDED.equals(pwdColumn)) {
|
||||
joinTableDialog.showDialog(roomId, tableId, true, deckType.startsWith("Limited"));
|
||||
} else {
|
||||
SessionHandler.joinTournamentTable(roomId, tableId, SessionHandler.getUserName(), "Human", 1, null, "");
|
||||
SessionHandler.joinTournamentTable(roomId, tableId, SessionHandler.getUserName(), PlayerType.HUMAN, 1, null, "");
|
||||
}
|
||||
} else {
|
||||
joinTableDialog.showDialog(roomId, tableId, true, deckType.startsWith("Limited"));
|
||||
|
|
@ -1188,8 +1159,8 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
MatchOptions options = new MatchOptions("1", "Two Player Duel", false, 2);
|
||||
options.getPlayerTypes().add("Human");
|
||||
options.getPlayerTypes().add("Computer - mad");
|
||||
options.getPlayerTypes().add(PlayerType.HUMAN);
|
||||
options.getPlayerTypes().add(PlayerType.COMPUTER_MAD);
|
||||
options.setDeckType("Limited");
|
||||
options.setAttackOption(MultiplayerAttackOption.LEFT);
|
||||
options.setRange(RangeOfInfluence.ALL);
|
||||
|
|
@ -1203,8 +1174,8 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
options.setBannedUsers(IgnoreList.ignoreList(serverAddress));
|
||||
table = SessionHandler.createTable(roomId, options);
|
||||
|
||||
SessionHandler.joinTable(roomId, table.getTableId(), "Human", "Human", 1, DeckImporterUtil.importDeck("test.dck"), "");
|
||||
SessionHandler.joinTable(roomId, table.getTableId(), "Computer", "Computer - mad", 5, DeckImporterUtil.importDeck("test.dck"), "");
|
||||
SessionHandler.joinTable(roomId, table.getTableId(), "Human", PlayerType.HUMAN, 1, DeckImporterUtil.importDeck("test.dck"), "");
|
||||
SessionHandler.joinTable(roomId, table.getTableId(), "Computer", PlayerType.COMPUTER_MAD, 5, DeckImporterUtil.importDeck("test.dck"), "");
|
||||
SessionHandler.startMatch(roomId, table.getTableId());
|
||||
} catch (HeadlessException ex) {
|
||||
handleError(ex);
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ package mage.client.table;
|
|||
|
||||
import mage.cards.decks.DeckCardLists;
|
||||
import mage.client.SessionHandler;
|
||||
import mage.players.PlayerType;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.UUID;
|
||||
|
|
@ -68,8 +69,8 @@ public class TournamentPlayerPanel extends javax.swing.JPanel {
|
|||
roomId,
|
||||
tableId,
|
||||
this.txtPlayerName.getText(),
|
||||
(String)this.cbPlayerType.getSelectedItem(),
|
||||
(Integer)spnLevel.getValue(),
|
||||
(PlayerType) this.cbPlayerType.getSelectedItem(),
|
||||
(Integer) spnLevel.getValue(),
|
||||
deckCardLists,
|
||||
"");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue