mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
fixed two lines to allow playing human-human tables
This commit is contained in:
parent
a08155341e
commit
fea477dd04
2 changed files with 183 additions and 184 deletions
|
@ -53,7 +53,6 @@ import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
public class NewTableDialog extends MageDialog {
|
public class NewTableDialog extends MageDialog {
|
||||||
|
@ -408,7 +407,7 @@ public class NewTableDialog extends MageDialog {
|
||||||
DeckImporterUtil.importDeck(this.player1Panel.getDeckFile()),
|
DeckImporterUtil.importDeck(this.player1Panel.getDeckFile()),
|
||||||
this.txtPassword.getText())) {
|
this.txtPassword.getText())) {
|
||||||
for (TablePlayerPanel player : players) {
|
for (TablePlayerPanel player : players) {
|
||||||
if (!player.getPlayerType().equals("Human")) {
|
if (player.getPlayerType() != PlayerType.HUMAN) {
|
||||||
if (!player.joinTable(roomId, table.getTableId())) {
|
if (!player.joinTable(roomId, table.getTableId())) {
|
||||||
// error message must be send by the server
|
// error message must be send by the server
|
||||||
SessionHandler.removeTable(roomId, table.getTableId());
|
SessionHandler.removeTable(roomId, table.getTableId());
|
||||||
|
@ -597,7 +596,7 @@ public class NewTableDialog extends MageDialog {
|
||||||
|
|
||||||
String playerTypes = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_PLAYER_TYPES, "Human");
|
String playerTypes = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_PLAYER_TYPES, "Human");
|
||||||
prefPlayerTypes.clear();
|
prefPlayerTypes.clear();
|
||||||
for(String pType : playerTypes.split(",")) {
|
for (String pType : playerTypes.split(",")) {
|
||||||
prefPlayerTypes.add(PlayerType.getByDescription(pType));
|
prefPlayerTypes.add(PlayerType.getByDescription(pType));
|
||||||
}
|
}
|
||||||
this.spnNumPlayers.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_PLAYERS, "2")));
|
this.spnNumPlayers.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_PLAYERS, "2")));
|
||||||
|
|
|
@ -46,7 +46,6 @@ import java.io.IOException;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
public class TablePlayerPanel extends javax.swing.JPanel {
|
public class TablePlayerPanel extends javax.swing.JPanel {
|
||||||
|
@ -54,7 +53,9 @@ public class TablePlayerPanel extends javax.swing.JPanel {
|
||||||
protected final PlayerTypeEventSource playerTypeEventSource = new PlayerTypeEventSource();
|
protected final PlayerTypeEventSource playerTypeEventSource = new PlayerTypeEventSource();
|
||||||
|
|
||||||
|
|
||||||
/** Creates new form TablePlayerPanel */
|
/**
|
||||||
|
* Creates new form TablePlayerPanel
|
||||||
|
*/
|
||||||
public TablePlayerPanel() {
|
public TablePlayerPanel() {
|
||||||
initComponents();
|
initComponents();
|
||||||
this.newPlayerPanel.setVisible(false);
|
this.newPlayerPanel.setVisible(false);
|
||||||
|
@ -66,8 +67,7 @@ public class TablePlayerPanel extends javax.swing.JPanel {
|
||||||
if (Config.defaultOtherPlayerIndex != null) {
|
if (Config.defaultOtherPlayerIndex != null) {
|
||||||
if (Integer.valueOf(Config.defaultOtherPlayerIndex) >= cbPlayerType.getItemCount()) {
|
if (Integer.valueOf(Config.defaultOtherPlayerIndex) >= cbPlayerType.getItemCount()) {
|
||||||
cbPlayerType.setSelectedIndex(cbPlayerType.getItemCount() - 1);
|
cbPlayerType.setSelectedIndex(cbPlayerType.getItemCount() - 1);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Integer index = Integer.parseInt(Config.defaultOtherPlayerIndex);
|
Integer index = Integer.parseInt(Config.defaultOtherPlayerIndex);
|
||||||
cbPlayerType.setSelectedIndex(index);
|
cbPlayerType.setSelectedIndex(index);
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ public class TablePlayerPanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
public boolean joinTable(UUID roomId, UUID tableId) throws IOException, ClassNotFoundException {
|
public boolean joinTable(UUID roomId, UUID tableId) throws IOException, ClassNotFoundException {
|
||||||
if (!this.cbPlayerType.getSelectedItem().equals("Human")) {
|
if (!this.cbPlayerType.getSelectedItem().equals("Human")) {
|
||||||
return SessionHandler.joinTable(roomId, tableId, this.newPlayerPanel.getPlayerName(), (PlayerType) 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;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,8 @@ public class TablePlayerPanel extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** This method is called from within the constructor to
|
/**
|
||||||
|
* This method is called from within the constructor to
|
||||||
* initialize the form.
|
* initialize the form.
|
||||||
* WARNING: Do NOT modify this code. The content of this method is
|
* WARNING: Do NOT modify this code. The content of this method is
|
||||||
* always regenerated by the Form Editor.
|
* always regenerated by the Form Editor.
|
||||||
|
@ -149,10 +150,9 @@ public class TablePlayerPanel extends javax.swing.JPanel {
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
private void cbPlayerTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbPlayerTypeActionPerformed
|
private void cbPlayerTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbPlayerTypeActionPerformed
|
||||||
if (!this.cbPlayerType.getSelectedItem().equals("Human")) {
|
if (getPlayerType() != PlayerType.HUMAN) {
|
||||||
this.newPlayerPanel.setVisible(true);
|
this.newPlayerPanel.setVisible(true);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
this.newPlayerPanel.setVisible(false);
|
this.newPlayerPanel.setVisible(false);
|
||||||
}
|
}
|
||||||
this.revalidate();
|
this.revalidate();
|
||||||
|
|
Loading…
Reference in a new issue