forked from External/mage
GUI: Card Viewer - added support of xmage inner images like morph, blessing, etc (look in XMAGE set, related to #11622);
This commit is contained in:
parent
f5a43d9115
commit
38c71cfeed
7 changed files with 81 additions and 17 deletions
|
|
@ -76,7 +76,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
// prepare search dialog with checkboxes
|
||||
listCodeSelected = new CheckBoxList();
|
||||
List<String> checkboxes = new ArrayList<>();
|
||||
for (String item : ConstructedFormats.getTypes()) {
|
||||
for (String item : ConstructedFormats.getTypes(false)) {
|
||||
if (!item.equals(ConstructedFormats.ALL_SETS)) {
|
||||
checkboxes.add(item);
|
||||
}
|
||||
|
|
@ -540,7 +540,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
}
|
||||
|
||||
private void reloadSetsCombobox() {
|
||||
DefaultComboBoxModel model = new DefaultComboBoxModel<>(ConstructedFormats.getTypes());
|
||||
DefaultComboBoxModel model = new DefaultComboBoxModel<>(ConstructedFormats.getTypes(false).toArray());
|
||||
cbExpansionSet.setModel(model);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public final class CollectionViewerPanel extends JPanel {
|
|||
}
|
||||
|
||||
private void reloadFormatCombobox() {
|
||||
DefaultComboBoxModel model = new DefaultComboBoxModel<>(ConstructedFormats.getTypes());
|
||||
DefaultComboBoxModel model = new DefaultComboBoxModel<>(ConstructedFormats.getTypes(true).toArray());
|
||||
formats.setModel(model);
|
||||
formats.setSelectedItem(ConstructedFormats.getDefault());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import mage.cards.RateCard;
|
|||
import mage.game.permanent.PermanentToken;
|
||||
import mage.game.permanent.token.Token;
|
||||
import mage.game.permanent.token.TokenImpl;
|
||||
import mage.game.permanent.token.custom.XmageToken;
|
||||
import mage.view.*;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.mage.card.arcane.ManaSymbols;
|
||||
|
|
@ -230,13 +231,22 @@ public class MageBook extends JComponent {
|
|||
public List<Object> loadTokens() {
|
||||
List<Object> res = new ArrayList<>();
|
||||
|
||||
// tokens
|
||||
List<TokenInfo> allTokens = TokenRepository.instance.getByType(TokenType.TOKEN)
|
||||
.stream()
|
||||
.filter(token -> token.getSetCode().equals(currentSet))
|
||||
.collect(Collectors.toList());
|
||||
// tokens (official and xmage's inner)
|
||||
List<TokenInfo> allTokens = new ArrayList<>(TokenRepository.instance.getByType(TokenType.TOKEN));
|
||||
allTokens.addAll(TokenRepository.instance.getByType(TokenType.XMAGE));
|
||||
allTokens.removeIf(token -> !token.getSetCode().equals(currentSet));
|
||||
allTokens.forEach(token -> {
|
||||
TokenImpl newToken = TokenImpl.createTokenByClassName(token.getFullClassFileName());
|
||||
TokenImpl newToken;
|
||||
switch (token.getTokenType()) {
|
||||
case XMAGE:
|
||||
newToken = new XmageToken(token.getName());
|
||||
break;
|
||||
|
||||
case TOKEN:
|
||||
default:
|
||||
newToken = TokenImpl.createTokenByClassName(token.getFullClassFileName());
|
||||
break;
|
||||
}
|
||||
if (newToken != null) {
|
||||
newToken.setExpansionSetCode(currentSet);
|
||||
newToken.setImageNumber(token.getImageNumber());
|
||||
|
|
@ -456,15 +466,22 @@ public class MageBook extends JComponent {
|
|||
private void updateCardStats(String setCode, boolean isCardsShow) {
|
||||
// sets do not have total cards number, it's a workaround
|
||||
|
||||
// inner set
|
||||
if (setCode.equals(TokenRepository.XMAGE_TOKENS_SET_CODE)) {
|
||||
setCaption.setText("Inner Xmage images");
|
||||
setInfo.setText("");
|
||||
return;
|
||||
};
|
||||
|
||||
// normal set
|
||||
ExpansionSet set = Sets.findSet(setCode);
|
||||
if (set != null) {
|
||||
setCaption.setText(set.getCode() + " - " + set.getName());
|
||||
} else {
|
||||
if (set == null) {
|
||||
setCaption.setText("ERROR");
|
||||
setInfo.setText("ERROR");
|
||||
return;
|
||||
}
|
||||
|
||||
setCaption.setText(set.getCode() + " - " + set.getName());
|
||||
if (!isCardsShow) {
|
||||
// tokens or emblems, stats not need
|
||||
setInfo.setText("");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue