forked from External/mage
Token refactor
This commit is contained in:
parent
a532368b84
commit
e73e7d8600
20 changed files with 1449 additions and 744 deletions
|
|
@ -146,13 +146,13 @@ public final class CollectionViewerPanel extends JPanel {
|
|||
JLabel label4 = new JLabel("Show cards or tokens:");
|
||||
label3.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
label3.setForeground(Color.white);
|
||||
// spjspj - put back in after reorg of tokens -- jPanel1.add(label4);
|
||||
jPanel1.add(label4);
|
||||
|
||||
JCheckBox cardsOrTokens = new JCheckBox("Display Cards");
|
||||
cardsOrTokens.setSelected(true);
|
||||
cardsOrTokens.setToolTipText("Select to show Cards or Tokens(and emblems) for the chosen set");
|
||||
cardsOrTokens.addActionListener(e -> mageBook.cardsOrTokens(cardsOrTokens.isSelected()));
|
||||
// spjspj - put back in after reorg of tokens -- jPanel1.add(cardsOrTokens);
|
||||
jPanel1.add(cardsOrTokens);
|
||||
|
||||
formats.addActionListener(e -> {
|
||||
if (mageBook != null) {
|
||||
|
|
|
|||
|
|
@ -306,6 +306,7 @@ public class MageBook extends JComponent {
|
|||
}
|
||||
PermanentToken newToken = new PermanentToken(token, null, token.getOriginalExpansionSetCode(), null);
|
||||
PermanentView theToken = new PermanentView(newToken, null, null, null);
|
||||
theToken.setInViewerOnly(true);
|
||||
final MageCard cardImg = Plugins.instance.getMagePermanent(theToken, bigCard, cardDimension, gameId, true);
|
||||
cardImg.setBounds(rectangle);
|
||||
jLayeredPane.add(cardImg, JLayeredPane.DEFAULT_LAYER, 10);
|
||||
|
|
@ -339,6 +340,9 @@ public class MageBook extends JComponent {
|
|||
String className = token.getName();
|
||||
className = className.replaceAll("[^a-zA-Z0-9]", "");
|
||||
className = className + "Token";
|
||||
if (token.getTokenClassName() != null && token.getTokenClassName().length() > 0) {
|
||||
className = token.getTokenClassName();
|
||||
}
|
||||
Class<?> c = Class.forName("mage.game.permanent.token." + className);
|
||||
Constructor<?> cons = c.getConstructor();
|
||||
Object newToken = cons.newInstance();
|
||||
|
|
@ -346,19 +350,19 @@ public class MageBook extends JComponent {
|
|||
tokens.add((Token) newToken);
|
||||
}
|
||||
} catch (ClassNotFoundException ex) {
|
||||
java.util.logging.Logger.getLogger(MageBook.class.getName()).log(Level.SEVERE, null, ex);
|
||||
// Swallow exception
|
||||
} catch (NoSuchMethodException ex) {
|
||||
java.util.logging.Logger.getLogger(MageBook.class.getName()).log(Level.SEVERE, null, ex);
|
||||
// Swallow exception
|
||||
} catch (SecurityException ex) {
|
||||
java.util.logging.Logger.getLogger(MageBook.class.getName()).log(Level.SEVERE, null, ex);
|
||||
// Swallow exception
|
||||
} catch (InstantiationException ex) {
|
||||
java.util.logging.Logger.getLogger(MageBook.class.getName()).log(Level.SEVERE, null, ex);
|
||||
// Swallow exception
|
||||
} catch (IllegalAccessException ex) {
|
||||
java.util.logging.Logger.getLogger(MageBook.class.getName()).log(Level.SEVERE, null, ex);
|
||||
// Swallow exception
|
||||
} catch (IllegalArgumentException ex) {
|
||||
java.util.logging.Logger.getLogger(MageBook.class.getName()).log(Level.SEVERE, null, ex);
|
||||
// Swallow exception
|
||||
} catch (InvocationTargetException ex) {
|
||||
java.util.logging.Logger.getLogger(MageBook.class.getName()).log(Level.SEVERE, null, ex);
|
||||
// Swallow exception
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue