mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
more deck editor changes
This commit is contained in:
parent
86025f4748
commit
f5fa87036c
3 changed files with 52 additions and 13 deletions
|
@ -151,6 +151,17 @@
|
|||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnClearActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnAddLand">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Add Land"/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="0"/>
|
||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnAddLandActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
||||
|
|
|
@ -70,10 +70,11 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
jScrollPane1.getViewport().setOpaque(false);
|
||||
}
|
||||
|
||||
public void loadCards(List<Card> sideboard, BigCard bigCard) {
|
||||
public void loadCards(List<Card> sideboard, BigCard bigCard, boolean construct) {
|
||||
this.bigCard = bigCard;
|
||||
this.btnBooster.setVisible(false);
|
||||
this.btnClear.setVisible(false);
|
||||
this.btnAddLand.setVisible(construct);
|
||||
this.cbExpansionSet.setVisible(false);
|
||||
this.cards.clear();
|
||||
for (Card card: sideboard) {
|
||||
|
@ -87,6 +88,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
this.bigCard = bigCard;
|
||||
this.btnBooster.setVisible(true);
|
||||
this.btnClear.setVisible(true);
|
||||
this.btnAddLand.setVisible(false);
|
||||
this.cbExpansionSet.setVisible(true);
|
||||
Object[] l = Sets.getInstance().values().toArray();
|
||||
Arrays.sort(l, new Comparator<Object>() {
|
||||
|
@ -186,6 +188,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
cbExpansionSet = new javax.swing.JComboBox();
|
||||
btnBooster = new javax.swing.JButton();
|
||||
btnClear = new javax.swing.JButton();
|
||||
btnAddLand = new javax.swing.JButton();
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
cardGrid = new mage.client.cards.CardGrid();
|
||||
tbTypes = new javax.swing.JToolBar();
|
||||
|
@ -302,6 +305,17 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
});
|
||||
tbColor.add(btnClear);
|
||||
|
||||
btnAddLand.setText("Add Land");
|
||||
btnAddLand.setFocusable(false);
|
||||
btnAddLand.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
btnAddLand.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
btnAddLand.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnAddLandActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
tbColor.add(btnAddLand);
|
||||
|
||||
jScrollPane1.setViewportView(cardGrid);
|
||||
|
||||
tbTypes.setFloatable(false);
|
||||
|
@ -507,7 +521,6 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
private void btnClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearActionPerformed
|
||||
cards.clear();
|
||||
filterCards();
|
||||
// this.cardGrid.loadCards(new CardsView(cards), bigCard, null);
|
||||
}//GEN-LAST:event_btnClearActionPerformed
|
||||
|
||||
private void btnBoosterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBoosterActionPerformed
|
||||
|
@ -516,11 +529,15 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
cards.add(card);
|
||||
}
|
||||
filterCards();
|
||||
// this.cardGrid.loadCards(new CardsView(cards), bigCard, null);
|
||||
}//GEN-LAST:event_btnBoosterActionPerformed
|
||||
|
||||
private void btnAddLandActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddLandActionPerformed
|
||||
|
||||
}//GEN-LAST:event_btnAddLandActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton btnAddLand;
|
||||
private javax.swing.JButton btnBooster;
|
||||
private javax.swing.JButton btnClear;
|
||||
private mage.client.cards.CardGrid cardGrid;
|
||||
|
|
|
@ -89,17 +89,28 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
public void showDeckEditor(DeckEditorMode mode, Deck deck, UUID tableId) {
|
||||
if (deck != null) {
|
||||
if (deck != null)
|
||||
this.deck = deck;
|
||||
this.tableId = tableId;
|
||||
this.mode = mode;
|
||||
this.btnSubmit.setVisible(mode == DeckEditorMode.Sideboard || mode == DeckEditorMode.Limited);
|
||||
this.cardSelector.loadCards(new ArrayList<Card>(deck.getSideboard()), this.bigCard);
|
||||
this.deckArea.showSideboard(false);
|
||||
}
|
||||
else {
|
||||
this.cardSelector.loadCards(this.bigCard);
|
||||
this.deckArea.showSideboard(true);
|
||||
this.tableId = tableId;
|
||||
this.mode = mode;
|
||||
switch (mode) {
|
||||
case Limited:
|
||||
case Sideboard:
|
||||
this.btnSubmit.setVisible(true);
|
||||
this.cardSelector.loadCards(new ArrayList<Card>(deck.getSideboard()), this.bigCard, mode == DeckEditorMode.Limited);
|
||||
this.btnExit.setVisible(false);
|
||||
this.btnImport.setVisible(false);
|
||||
this.btnLoad.setVisible(false);
|
||||
this.deckArea.showSideboard(false);
|
||||
break;
|
||||
case Constructed:
|
||||
this.btnSubmit.setVisible(false);
|
||||
this.cardSelector.loadCards(this.bigCard);
|
||||
this.btnExit.setVisible(true);
|
||||
this.btnImport.setVisible(true);
|
||||
this.btnLoad.setVisible(true);
|
||||
this.deckArea.showSideboard(true);
|
||||
break;
|
||||
}
|
||||
init();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue