mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 03:22:00 -08:00
Added card# to deck pool area.
This commit is contained in:
parent
f92e827d3b
commit
e46895420e
2 changed files with 66 additions and 57 deletions
|
|
@ -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,13 +183,11 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void cleanUp() {
|
public void cleanUp() {
|
||||||
deckList.cleanUp();
|
deckList.cleanUp();
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
case 0:
|
||||||
aCom = 1;
|
aCom = 1;
|
||||||
bCom = 1;
|
bCom = 1;
|
||||||
} else if (column == 1)// Name
|
break;
|
||||||
{
|
// Name
|
||||||
|
case 1:
|
||||||
aCom = a.getName();
|
aCom = a.getName();
|
||||||
bCom = b.getName();
|
bCom = b.getName();
|
||||||
if (aCom.equals(bCom) && a.getExpansionSetCode().equals(b.getExpansionSetCode())) {
|
if (aCom.equals(bCom) && a.getExpansionSetCode().equals(b.getExpansionSetCode())) {
|
||||||
aCom = a.getCardNumber();
|
aCom = a.getCardNumber();
|
||||||
bCom = b.getCardNumber();
|
bCom = b.getCardNumber();
|
||||||
}
|
}
|
||||||
} else if (column == 2)// Cost
|
break;
|
||||||
{
|
// Cost
|
||||||
|
case 2:
|
||||||
aCom = a.getConvertedManaCost();
|
aCom = a.getConvertedManaCost();
|
||||||
bCom = b.getConvertedManaCost();
|
bCom = b.getConvertedManaCost();
|
||||||
} else if (column == 3)// Color
|
break;
|
||||||
{
|
// Color
|
||||||
|
case 3:
|
||||||
aCom = CardHelper.getColor(a);
|
aCom = CardHelper.getColor(a);
|
||||||
bCom = CardHelper.getColor(b);
|
bCom = CardHelper.getColor(b);
|
||||||
} else if (column == 4)// Type
|
break;
|
||||||
{
|
// Type
|
||||||
|
case 4:
|
||||||
aCom = CardHelper.getType(a);
|
aCom = CardHelper.getType(a);
|
||||||
bCom = CardHelper.getType(b);
|
bCom = CardHelper.getType(b);
|
||||||
} else if (column == 5)// Stats, attack and defense
|
break;
|
||||||
{
|
// Stats, attack and defense
|
||||||
|
case 5:
|
||||||
aCom = (float) -1;
|
aCom = (float) -1;
|
||||||
bCom = (float) -1;
|
bCom = (float) -1;
|
||||||
|
|
||||||
if (CardHelper.isCreature(a)) {
|
if (CardHelper.isCreature(a)) {
|
||||||
aCom = new Float(a.getPower() + "." + (a.getToughness().startsWith("-") ? "0" : a.getToughness()));
|
aCom = new Float(a.getPower() + "." + (a.getToughness().startsWith("-") ? "0" : a.getToughness()));
|
||||||
}
|
}
|
||||||
if (CardHelper.isCreature(b)) {
|
if (CardHelper.isCreature(b)) {
|
||||||
bCom = new Float(b.getPower() + "." + (b.getToughness().startsWith("-") ? "0" : b.getToughness()));
|
bCom = new Float(b.getPower() + "." + (b.getToughness().startsWith("-") ? "0" : b.getToughness()));
|
||||||
}
|
}
|
||||||
} else if (column == 6)// Rarity
|
break;
|
||||||
{
|
// Rarity
|
||||||
|
case 6:
|
||||||
aCom = a.getRarity().toString();
|
aCom = a.getRarity().toString();
|
||||||
bCom = b.getRarity().toString();
|
bCom = b.getRarity().toString();
|
||||||
} else if (column == 7)// Set name
|
break;
|
||||||
{
|
// Set name
|
||||||
|
case 7:
|
||||||
aCom = a.getExpansionSetCode();
|
aCom = a.getExpansionSetCode();
|
||||||
bCom = b.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) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue