forked from External/mage
detect client version + client changes for AI skill level
This commit is contained in:
parent
0968d4c00a
commit
86f708b17a
46 changed files with 362 additions and 540 deletions
|
|
@ -36,10 +36,8 @@ package mage.client.table;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.deck.generator.DeckGenerator;
|
||||
import mage.client.util.Config;
|
||||
|
|
@ -62,7 +60,7 @@ public class NewPlayerPanel extends javax.swing.JPanel {
|
|||
if (Config.defaultComputerName != null) this.txtPlayerName.setText(Config.defaultComputerName);
|
||||
}
|
||||
|
||||
public void setPlayerName(String playerName) {
|
||||
public void setPlayerName(String playerName) {
|
||||
this.txtPlayerName.setText(playerName);
|
||||
this.txtPlayerName.setEditable(false);
|
||||
this.txtPlayerName.setEnabled(false);
|
||||
|
|
@ -89,7 +87,7 @@ public class NewPlayerPanel extends javax.swing.JPanel {
|
|||
this.txtPlayerDeck.setText(path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getPlayerName() {
|
||||
return this.txtPlayerName.getText();
|
||||
}
|
||||
|
|
@ -98,14 +96,17 @@ public class NewPlayerPanel extends javax.swing.JPanel {
|
|||
return this.txtPlayerDeck.getText();
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return Integer.valueOf((String)this.cbLevel.getSelectedItem());
|
||||
}
|
||||
|
||||
/** 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.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">
|
||||
// </editor-fold>
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
lblPlayerName = new javax.swing.JLabel();
|
||||
|
|
@ -114,11 +115,11 @@ public class NewPlayerPanel extends javax.swing.JPanel {
|
|||
txtPlayerDeck = new javax.swing.JTextField();
|
||||
btnPlayerDeck = new javax.swing.JButton();
|
||||
btnGenerate = new javax.swing.JButton();
|
||||
|
||||
lblPlayerName.setLabelFor(txtPlayerName);
|
||||
lblLevel = new javax.swing.JLabel();
|
||||
cbLevel = new javax.swing.JComboBox();
|
||||
|
||||
lblPlayerName.setText("Name:");
|
||||
|
||||
lblPlayerDeck.setLabelFor(txtPlayerDeck);
|
||||
lblPlayerDeck.setText("Deck:");
|
||||
|
||||
btnPlayerDeck.setText("...");
|
||||
|
|
@ -127,14 +128,18 @@ public class NewPlayerPanel extends javax.swing.JPanel {
|
|||
btnPlayerDeckActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
btnGenerate.setText("Generate deck");
|
||||
|
||||
btnGenerate.setText("Generate");
|
||||
btnGenerate.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnGenerateActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
lblLevel.setText("Skill:");
|
||||
|
||||
cbLevel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" }));
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
|
|
@ -147,50 +152,56 @@ public class NewPlayerPanel extends javax.swing.JPanel {
|
|||
.addComponent(lblPlayerName))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(txtPlayerName, javax.swing.GroupLayout.DEFAULT_SIZE, 405, Short.MAX_VALUE)
|
||||
.addComponent(txtPlayerDeck, javax.swing.GroupLayout.DEFAULT_SIZE, 405, Short.MAX_VALUE))
|
||||
.addComponent(txtPlayerName, javax.swing.GroupLayout.DEFAULT_SIZE, 321, Short.MAX_VALUE)
|
||||
.addComponent(txtPlayerDeck, javax.swing.GroupLayout.DEFAULT_SIZE, 321, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnPlayerDeck, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
)
|
||||
.addComponent(btnGenerate)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(btnPlayerDeck, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnGenerate, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(lblLevel)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(cbLevel, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(txtPlayerName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblPlayerName))
|
||||
.addComponent(lblPlayerName)
|
||||
.addComponent(lblLevel)
|
||||
.addComponent(cbLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(3, 3, 3)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblPlayerDeck)
|
||||
.addComponent(txtPlayerDeck, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(btnPlayerDeck, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(3, 3, 3)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(btnGenerate)
|
||||
)
|
||||
)
|
||||
.addComponent(btnPlayerDeck, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(btnGenerate, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
);
|
||||
}
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void btnPlayerDeckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPlayerDeckActionPerformed
|
||||
playerLoadDeck();
|
||||
}//GEN-LAST:event_btnPlayerDeckActionPerformed
|
||||
}//GEN-LAST:event_btnPlayerDeckActionPerformed
|
||||
|
||||
private void btnGenerateActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
private void btnGenerateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGenerateActionPerformed
|
||||
generateDeck();
|
||||
}
|
||||
}//GEN-LAST:event_btnGenerateActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton btnGenerate;
|
||||
private javax.swing.JButton btnPlayerDeck;
|
||||
private javax.swing.JComboBox cbLevel;
|
||||
private javax.swing.JLabel lblLevel;
|
||||
private javax.swing.JLabel lblPlayerDeck;
|
||||
private javax.swing.JLabel lblPlayerName;
|
||||
private javax.swing.JTextField txtPlayerDeck;
|
||||
private javax.swing.JTextField txtPlayerName;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
private javax.swing.JButton btnGenerate;
|
||||
}
|
||||
|
||||
class DeckFilter extends FileFilter {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue