Added card# to deck pool area.

This commit is contained in:
LevelX2 2016-10-09 03:05:10 +02:00
parent f92e827d3b
commit e46895420e
2 changed files with 66 additions and 57 deletions

View file

@ -32,11 +32,13 @@
*/ */
package mage.client.deckeditor; package mage.client.deckeditor;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.*;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.decks.Deck; import mage.cards.decks.Deck;
import mage.cards.decks.DeckCardInfo;
import mage.cards.decks.DeckCardLayout; import mage.cards.decks.DeckCardLayout;
import mage.cards.decks.DeckCardLists;
import mage.client.cards.BigCard; import mage.client.cards.BigCard;
import mage.client.cards.CardEventSource; import mage.client.cards.CardEventSource;
import mage.client.cards.DragCardGrid; import mage.client.cards.DragCardGrid;
@ -46,12 +48,6 @@ import mage.client.util.GUISizeHelper;
import mage.client.util.Listener; import mage.client.util.Listener;
import mage.view.CardView; import mage.view.CardView;
import mage.view.CardsView; import mage.view.CardsView;
import org.apache.log4j.Logger;
import javax.swing.*;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* *
@ -66,7 +62,7 @@ public class DeckArea extends javax.swing.JPanel {
private BigCard lastBigCard = null; private BigCard lastBigCard = null;
private int dividerLocationNormal = 0; private int dividerLocationNormal = 0;
private int dividerLocationLimited = 0; private int dividerLocationLimited = 0;
private boolean isLimitedBuildingOrientation = false; private final boolean isLimitedBuildingOrientation = false;
public DeckCardLayout getCardLayout() { public DeckCardLayout getCardLayout() {
return deckList.getCardLayout(); return deckList.getCardLayout();
@ -77,12 +73,13 @@ public class DeckArea extends javax.swing.JPanel {
} }
public static class Settings { public static class Settings {
public DragCardGrid.Settings maindeckSettings; public DragCardGrid.Settings maindeckSettings;
public DragCardGrid.Settings sideboardSetings; public DragCardGrid.Settings sideboardSetings;
public int dividerLocationLimited; public int dividerLocationLimited;
public int dividerLocationNormal; public int dividerLocationNormal;
private static Pattern parser = Pattern.compile("([^|]*)\\|([^|]*)\\|([^|]*)\\|([^|]*)"); private final static Pattern parser = Pattern.compile("([^|]*)\\|([^|]*)\\|([^|]*)\\|([^|]*)");
public static Settings parse(String s) { public static Settings parse(String s) {
Matcher m = parser.matcher(s); Matcher m = parser.matcher(s);
@ -186,10 +183,8 @@ public class DeckArea extends javax.swing.JPanel {
if (dividerLocationLimited != 0) { if (dividerLocationLimited != 0) {
deckAreaSplitPane.setDividerLocation(s.dividerLocationLimited); deckAreaSplitPane.setDividerLocation(s.dividerLocationLimited);
} }
} else { } else if (dividerLocationNormal != 0) {
if (dividerLocationNormal != 0) { deckAreaSplitPane.setDividerLocation(s.dividerLocationNormal);
deckAreaSplitPane.setDividerLocation(s.dividerLocationNormal);
}
} }
} }
} }

View file

@ -51,49 +51,63 @@ public class MageCardComparator implements Comparator<CardView> {
Comparable aCom = null; Comparable aCom = null;
Comparable bCom = null; Comparable bCom = null;
if (column == 0)// #skip switch (column) {
{ // #skip
aCom = 1; case 0:
bCom = 1; aCom = 1;
} else if (column == 1)// Name bCom = 1;
{ break;
aCom = a.getName(); // Name
bCom = b.getName(); case 1:
if (aCom.equals(bCom) && a.getExpansionSetCode().equals(b.getExpansionSetCode())) { aCom = a.getName();
aCom = a.getCardNumber(); bCom = b.getName();
bCom = b.getCardNumber(); if (aCom.equals(bCom) && a.getExpansionSetCode().equals(b.getExpansionSetCode())) {
} aCom = a.getCardNumber();
} else if (column == 2)// Cost bCom = b.getCardNumber();
{ }
aCom = a.getConvertedManaCost(); break;
bCom = b.getConvertedManaCost(); // Cost
} else if (column == 3)// Color case 2:
{ aCom = a.getConvertedManaCost();
aCom = CardHelper.getColor(a); bCom = b.getConvertedManaCost();
bCom = CardHelper.getColor(b); break;
} else if (column == 4)// Type // Color
{ case 3:
aCom = CardHelper.getType(a); aCom = CardHelper.getColor(a);
bCom = CardHelper.getType(b); bCom = CardHelper.getColor(b);
} else if (column == 5)// Stats, attack and defense break;
{ // Type
aCom = (float) -1; case 4:
bCom = (float) -1; aCom = CardHelper.getType(a);
bCom = CardHelper.getType(b);
if (CardHelper.isCreature(a)) { break;
aCom = new Float(a.getPower() + "." + (a.getToughness().startsWith("-") ? "0" : a.getToughness())); // Stats, attack and defense
} case 5:
if (CardHelper.isCreature(b)) { aCom = (float) -1;
bCom = new Float(b.getPower() + "." + (b.getToughness().startsWith("-") ? "0" : b.getToughness())); bCom = (float) -1;
} if (CardHelper.isCreature(a)) {
} else if (column == 6)// Rarity aCom = new Float(a.getPower() + "." + (a.getToughness().startsWith("-") ? "0" : a.getToughness()));
{ }
aCom = a.getRarity().toString(); if (CardHelper.isCreature(b)) {
bCom = b.getRarity().toString(); bCom = new Float(b.getPower() + "." + (b.getToughness().startsWith("-") ? "0" : b.getToughness()));
} else if (column == 7)// Set name }
{ break;
aCom = a.getExpansionSetCode(); // Rarity
bCom = b.getExpansionSetCode(); case 6:
aCom = a.getRarity().toString();
bCom = b.getRarity().toString();
break;
// Set name
case 7:
aCom = a.getExpansionSetCode();
bCom = b.getExpansionSetCode();
break;
case 8:
aCom = Integer.parseInt(a.getCardNumber().replaceAll("[\\D]", ""));
bCom = Integer.parseInt(b.getCardNumber().replaceAll("[\\D]", ""));
break;
default:
break;
} }
if (ascending) { if (ascending) {