mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 13:02:06 -08:00
Merge branch 'CardRepository'
This commit is contained in:
commit
f64149971a
79 changed files with 1811 additions and 2686 deletions
|
|
@ -1,6 +1,6 @@
|
|||
package org.mage.card.arcane;
|
||||
|
||||
import mage.client.cards.CardsStorage;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.client.util.ImageHelper;
|
||||
import mage.client.util.gui.BufferedImageBuilder;
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
@ -47,7 +47,8 @@ public class ManaSymbols {
|
|||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
for (String set : CardsStorage.getSetCodes()) {
|
||||
List<String> setCodes = CardRepository.instance.getSetCodes();
|
||||
for (String set : setCodes) {
|
||||
String _set = set.equals("CON") ? "CFX" : set;
|
||||
File file = new File(Constants.RESOURCE_PATH_SET + _set + "-C.jpg");
|
||||
try {
|
||||
|
|
@ -104,7 +105,7 @@ public class ManaSymbols {
|
|||
}
|
||||
|
||||
File file;
|
||||
for (String set : CardsStorage.getSetCodes()) {
|
||||
for (String set : CardRepository.instance.getSetCodes()) {
|
||||
file = new File(Constants.RESOURCE_PATH_SET_SMALL);
|
||||
if (!file.exists()) {
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package org.mage.plugins.card;
|
||||
|
||||
import mage.cards.Card;
|
||||
import mage.cards.MagePermanent;
|
||||
import mage.cards.action.ActionCallback;
|
||||
import mage.interfaces.plugin.CardPlugin;
|
||||
|
|
@ -21,7 +20,6 @@ import org.mage.plugins.card.dl.DownloadJob;
|
|||
import org.mage.plugins.card.dl.Downloader;
|
||||
import org.mage.plugins.card.dl.sources.GathererSets;
|
||||
import org.mage.plugins.card.dl.sources.GathererSymbols;
|
||||
import org.mage.plugins.card.images.DownloadPictures;
|
||||
import org.mage.plugins.card.images.ImageCache;
|
||||
import org.mage.plugins.card.info.CardInfoPaneImpl;
|
||||
|
||||
|
|
@ -421,22 +419,6 @@ public class CardPluginImpl implements CardPlugin {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean newImages(Set<Card> allCards, String imagesPath) {
|
||||
return DownloadPictures.checkForNewCards(allCards, imagesPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Download images.
|
||||
*
|
||||
* @param allCards Set of cards to download images for.
|
||||
* @param imagesPath Path to check in and store images to. Can be null, in such case default path should be used.
|
||||
*/
|
||||
@Override
|
||||
public void downloadImages(Set<Card> allCards, String imagesPath) {
|
||||
DownloadPictures.startDownload(null, allCards, imagesPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Download various symbols (mana, tap, set).
|
||||
*
|
||||
|
|
|
|||
|
|
@ -21,7 +21,9 @@ import javax.imageio.ImageWriteParam;
|
|||
import javax.imageio.ImageWriter;
|
||||
import javax.imageio.stream.FileImageOutputStream;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
|
@ -32,7 +34,7 @@ import java.net.URL;
|
|||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.regex.Pattern;
|
||||
|
|
@ -67,7 +69,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
|
|||
startDownload(null, null, null);
|
||||
}
|
||||
|
||||
public static void startDownload(JFrame frame, Set<Card> allCards, String imagesPath) {
|
||||
public static void startDownload(JFrame frame, List<Card> allCards, String imagesPath) {
|
||||
ArrayList<CardInfo> cards = getNeededCards(allCards, imagesPath);
|
||||
|
||||
/*
|
||||
|
|
@ -207,7 +209,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
|
|||
dlg = new JOptionPane(p0, JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, options[1]);
|
||||
}
|
||||
|
||||
public static boolean checkForNewCards(Set<Card> allCards, String imagesPath) {
|
||||
public static boolean checkForNewCards(List<Card> allCards, String imagesPath) {
|
||||
TFile file;
|
||||
for (Card card : allCards) {
|
||||
if (card.getCardNumber() > 0 && !card.getExpansionSetCode().isEmpty()) {
|
||||
|
|
@ -221,7 +223,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
|
|||
return false;
|
||||
}
|
||||
|
||||
private static ArrayList<CardInfo> getNeededCards(Set<Card> allCards, String imagesPath) {
|
||||
private static ArrayList<CardInfo> getNeededCards(List<Card> allCards, String imagesPath) {
|
||||
|
||||
ArrayList<CardInfo> cardsToDownload = new ArrayList<CardInfo>();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue