mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 19:11:59 -08: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"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnClearActionPerformed"/>
|
||||||
</Events>
|
</Events>
|
||||||
</Component>
|
</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>
|
</SubComponents>
|
||||||
</Container>
|
</Container>
|
||||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
||||||
|
|
|
||||||
|
|
@ -70,10 +70,11 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
jScrollPane1.getViewport().setOpaque(false);
|
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.bigCard = bigCard;
|
||||||
this.btnBooster.setVisible(false);
|
this.btnBooster.setVisible(false);
|
||||||
this.btnClear.setVisible(false);
|
this.btnClear.setVisible(false);
|
||||||
|
this.btnAddLand.setVisible(construct);
|
||||||
this.cbExpansionSet.setVisible(false);
|
this.cbExpansionSet.setVisible(false);
|
||||||
this.cards.clear();
|
this.cards.clear();
|
||||||
for (Card card: sideboard) {
|
for (Card card: sideboard) {
|
||||||
|
|
@ -87,6 +88,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
this.bigCard = bigCard;
|
this.bigCard = bigCard;
|
||||||
this.btnBooster.setVisible(true);
|
this.btnBooster.setVisible(true);
|
||||||
this.btnClear.setVisible(true);
|
this.btnClear.setVisible(true);
|
||||||
|
this.btnAddLand.setVisible(false);
|
||||||
this.cbExpansionSet.setVisible(true);
|
this.cbExpansionSet.setVisible(true);
|
||||||
Object[] l = Sets.getInstance().values().toArray();
|
Object[] l = Sets.getInstance().values().toArray();
|
||||||
Arrays.sort(l, new Comparator<Object>() {
|
Arrays.sort(l, new Comparator<Object>() {
|
||||||
|
|
@ -186,6 +188,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
cbExpansionSet = new javax.swing.JComboBox();
|
cbExpansionSet = new javax.swing.JComboBox();
|
||||||
btnBooster = new javax.swing.JButton();
|
btnBooster = new javax.swing.JButton();
|
||||||
btnClear = new javax.swing.JButton();
|
btnClear = new javax.swing.JButton();
|
||||||
|
btnAddLand = new javax.swing.JButton();
|
||||||
jScrollPane1 = new javax.swing.JScrollPane();
|
jScrollPane1 = new javax.swing.JScrollPane();
|
||||||
cardGrid = new mage.client.cards.CardGrid();
|
cardGrid = new mage.client.cards.CardGrid();
|
||||||
tbTypes = new javax.swing.JToolBar();
|
tbTypes = new javax.swing.JToolBar();
|
||||||
|
|
@ -302,6 +305,17 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
});
|
});
|
||||||
tbColor.add(btnClear);
|
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);
|
jScrollPane1.setViewportView(cardGrid);
|
||||||
|
|
||||||
tbTypes.setFloatable(false);
|
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
|
private void btnClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearActionPerformed
|
||||||
cards.clear();
|
cards.clear();
|
||||||
filterCards();
|
filterCards();
|
||||||
// this.cardGrid.loadCards(new CardsView(cards), bigCard, null);
|
|
||||||
}//GEN-LAST:event_btnClearActionPerformed
|
}//GEN-LAST:event_btnClearActionPerformed
|
||||||
|
|
||||||
private void btnBoosterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBoosterActionPerformed
|
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);
|
cards.add(card);
|
||||||
}
|
}
|
||||||
filterCards();
|
filterCards();
|
||||||
// this.cardGrid.loadCards(new CardsView(cards), bigCard, null);
|
|
||||||
}//GEN-LAST:event_btnBoosterActionPerformed
|
}//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
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
|
private javax.swing.JButton btnAddLand;
|
||||||
private javax.swing.JButton btnBooster;
|
private javax.swing.JButton btnBooster;
|
||||||
private javax.swing.JButton btnClear;
|
private javax.swing.JButton btnClear;
|
||||||
private mage.client.cards.CardGrid cardGrid;
|
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) {
|
public void showDeckEditor(DeckEditorMode mode, Deck deck, UUID tableId) {
|
||||||
if (deck != null) {
|
if (deck != null)
|
||||||
this.deck = deck;
|
this.deck = deck;
|
||||||
this.tableId = tableId;
|
this.tableId = tableId;
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
this.btnSubmit.setVisible(mode == DeckEditorMode.Sideboard || mode == DeckEditorMode.Limited);
|
switch (mode) {
|
||||||
this.cardSelector.loadCards(new ArrayList<Card>(deck.getSideboard()), this.bigCard);
|
case Limited:
|
||||||
this.deckArea.showSideboard(false);
|
case Sideboard:
|
||||||
}
|
this.btnSubmit.setVisible(true);
|
||||||
else {
|
this.cardSelector.loadCards(new ArrayList<Card>(deck.getSideboard()), this.bigCard, mode == DeckEditorMode.Limited);
|
||||||
this.cardSelector.loadCards(this.bigCard);
|
this.btnExit.setVisible(false);
|
||||||
this.deckArea.showSideboard(true);
|
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();
|
init();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue