Added the four finalists from You Make the Cube.

This commit is contained in:
fireshoes 2016-10-17 23:41:22 -05:00
parent 1f4c0eb1d9
commit abfcd0ab10

View file

@ -156,6 +156,9 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
case NAME:
Collections.sort(sortedCards, new CardNameComparator());
break;
case CARD_TYPE:
Collections.sort(sortedCards, new CardTypeComparator());
break;
case RARITY:
Collections.sort(sortedCards, new CardRarityComparator());
break;
@ -183,6 +186,12 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
curRow = 0;
}
break;
case CARD_TYPE:
if (!cardImg.getOriginal().getCardTypes().equals(lastCard.getOriginal().getCardTypes())) {
curColumn++;
curRow = 0;
}
break;
case RARITY:
if (!cardImg.getOriginal().getRarity().equals(lastCard.getOriginal().getRarity())) {
curColumn++;
@ -438,3 +447,17 @@ class CardColorDetailedIdentity implements Comparator<MageCard> {
}
}
class CardTypeComparator implements Comparator<MageCard> {
@Override
public int compare(MageCard o1, MageCard o2) {
int val = o1.getOriginal().getCardTypes().toString().compareTo(o2.getOriginal().getCardTypes().toString());
if (val == 0) {
return o1.getOriginal().getName().compareTo(o2.getOriginal().getName());
} else {
return val;
}
}
}