Merge remote-tracking branch 'origin/master' into decouple-client

Conflicts:
	Mage/src/mage/cards/repository/CardRepository.java
This commit is contained in:
North 2013-06-30 11:26:40 +03:00
commit 1fccbd6b87
339 changed files with 17278 additions and 1002 deletions

View file

@ -65,6 +65,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
public final ScaledImagePanel imagePanel;
public ImagePanel overlayPanel;
public JPanel buttonPanel;
public JPanel iconPanel;
private GlowText titleText;
private GlowText ptText;
@ -94,6 +95,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
private boolean transformed;
private boolean animationInProgress = false;
private JButton dayNightButton;
private JButton tokenButton;
private boolean displayTitleAnyway;
@ -142,6 +144,23 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
}
});
// token icon
iconPanel = new JPanel();
iconPanel.setLayout(null);
iconPanel.setOpaque(false);
add(iconPanel);
tokenButton = new JButton("");
tokenButton.setLocation(2, 2);
tokenButton.setSize(25, 25);
iconPanel.setVisible(this.gameCard.isToken());
BufferedImage tokenIconImage = ImageManagerImpl.getInstance().getTokenIconImage();
tokenButton.setIcon(new ImageIcon(tokenIconImage));
iconPanel.add(tokenButton);
setBackground(Color.black);
setOpaque(false);
@ -411,6 +430,9 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
buttonPanel.setLocation(cardXOffset + borderSize, cardYOffset + borderSize);
buttonPanel.setSize(cardWidth - borderSize * 2, cardHeight - borderSize * 2);
iconPanel.setLocation(cardXOffset + borderSize, cardYOffset + borderSize);
iconPanel.setSize(cardWidth - borderSize * 2, cardHeight - borderSize * 2);
int fontHeight = Math.round(cardHeight * (27f / 680));
boolean showText = (!isAnimationPanel && fontHeight < 12);
titleText.setVisible(showText);

View file

@ -154,12 +154,15 @@ public class CardInfoPaneImpl extends JEditorPane implements CardInfoPane {
} else if (CardUtil.isPlaneswalker(card)) {
pt = card.getLoyalty().toString();
}
if (pt.length() > 0) {
buffer.append("<table cellspacing=0 cellpadding=0 border=0 width='100%' valign='bottom'><tr><td>");
buffer.append("<b>");
buffer.append(pt);
buffer.append("</b>");
buffer.append("</td></tr></table>");
if (pt.length() > 0 || card.isToken()) {
buffer.append("<table cellspacing=0 cellpadding=0 border=0 width='100%' valign='bottom'><tr><td><b>");
buffer.append(pt).append("</b></td>");
if (card.isToken()) {
buffer.append("<td align='right'>Token</td>");
}
buffer.append("</tr></table>");
}
StringBuilder rule = new StringBuilder("<br/>");

View file

@ -11,6 +11,8 @@ public interface ImageManager {
Image getSicknessImage();
Image getDayImage();
Image getNightImage();
Image getTokenIconImage();
Image getDlgAcceptButtonImage();
Image getDlgActiveAcceptButtonImage();

View file

@ -97,6 +97,15 @@ public class ImageManagerImpl implements ImageManager {
return imageNight;
}
@Override
public BufferedImage getTokenIconImage() {
if (imageTokenIcon == null) {
Image image = getImageFromResourceTransparent("/card/token.png", Color.WHITE, new Rectangle(20, 20));
imageTokenIcon = BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB);
}
return imageTokenIcon;
}
@Override
public Image getDlgCancelButtonImage() {
if (imageDlgCancelButton == null) {
@ -216,6 +225,8 @@ public class ImageManagerImpl implements ImageManager {
private static BufferedImage imageDay;
private static BufferedImage imageNight;
private static BufferedImage imageTokenIcon;
private static BufferedImage imageDlgAcceptButton;
private static BufferedImage imageDlgActiveAcceptButton;
private static BufferedImage imageDlgCancelButton;

View file

@ -78,25 +78,12 @@ public class ThemePluginImpl implements ThemePlugin {
background = loadbuffer_default();
}
/*
if(loadimages()){
int it = (int)Math.abs(Math.random()*(flist.getItemCount()));
filename = BackgroundDir + flist.getItem(it);
background = ImageIO.read(new File(filename));
}else{
filename = "/dragon.png";
InputStream is = this.getClass().getResourceAsStream(filename);
if (is == null)
throw new FileNotFoundException("Couldn't find " + filename + " in resources.");
background = ImageIO.read(is);
if (background == null) {
background = loadbuffer_default();
}
if (background == null){
throw new FileNotFoundException("Couldn't find in resources.");
}
*/
if (background == null) {
throw new FileNotFoundException("Couldn't find background file in resources.");
}
if (ui.containsKey("gamePanel") && ui.containsKey("jLayeredPane")) {
ImagePanel bgPanel = new ImagePanel(background, ImagePanel.TILED);
@ -143,9 +130,13 @@ public class ThemePluginImpl implements ThemePlugin {
BufferedImage res;
String path = PreferencesDialog.getCachedValue(PreferencesDialog.
KEY_BATTLEFIELD_IMAGE, "");
if(path != null){
res = ImageIO.read(new File(path));
return res;
if(path != null && !path.equals("")){
try{
res = ImageIO.read(new File(path));
return res;
}catch(Exception e){
res = null;
}
}
return null;
}
@ -176,23 +167,28 @@ public class ThemePluginImpl implements ThemePlugin {
if (is == null)
throw new FileNotFoundException("Couldn't find " + filename + " in resources.");
background = ImageIO.read(is);
}else if(PreferencesDialog.getCachedValue(PreferencesDialog.
KEY_BACKGROUND_IMAGE, "") != null){
}else{
String path = PreferencesDialog.getCachedValue(PreferencesDialog.
KEY_BATTLEFIELD_IMAGE, "");
if(path != null){
background = ImageIO.read(new File(path));
}else{
InputStream is = this.getClass().getResourceAsStream(filename);
if (is == null)
throw new FileNotFoundException("Couldn't find " + filename + " in resources.");
background = ImageIO.read(is);
}
KEY_BACKGROUND_IMAGE, "");
if(path != null && !path.equals("")){
try{
File f = new File(path);
if(f != null)
background = ImageIO.read(f);
}catch(Exception e){
background = null;
}
}
}
if (background == null)
if (background == null){
InputStream is = this.getClass().getResourceAsStream(filename);
if (is == null)
throw new FileNotFoundException("Couldn't find " + filename + " in resources.");
} catch (Exception e) {
background = ImageIO.read(is);
}
if(background == null) throw new
FileNotFoundException("Couldn't find " + filename + " in resources.");
}catch (Exception e) {
log.error(e.getMessage(), e);
return null;
}