mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 02:38:02 +00:00
Added attraction light icons (#5663)
Refactored functional variants to be merged in the card face rather than the card factory Some variant characteristics now show in deck builder columns Fixed loading progress amount "[card] has neither ManaCost nor Color" warning now actually displays when these are missing. Co-authored-by: Jetz <Jetz722@gmail.com> Co-authored-by: tool4ever <therealtoolkit@hotmail.com>
This commit is contained in:
@@ -251,7 +251,7 @@ public class CardDetailPanel extends SkinnedPanel {
|
||||
updateBorder(state, mayView);
|
||||
}
|
||||
|
||||
powerToughnessLabel.setText(CardDetailUtil.formatPrimaryCharacteristic(state, mayView));
|
||||
powerToughnessLabel.setText(FSkin.encodeSymbols(CardDetailUtil.formatPrimaryCharacteristic(state, mayView), false));
|
||||
|
||||
idLabel.setText(mayView ? CardDetailUtil.formatCardId(state) : "");
|
||||
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package forge.itemmanager.views;
|
||||
|
||||
import forge.toolbox.CardFaceSymbols;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.Set;
|
||||
|
||||
public class AttractionLightRenderer extends ItemCellRenderer {
|
||||
private static final int elementWidth = 13;
|
||||
private static final int elementGap = 2;
|
||||
private static final int padding = 2;
|
||||
|
||||
//Can't check for type params via instanceof, but it doesn't really matter since all we're using is .contains()
|
||||
private Set<?> lights;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* javax.swing.table.DefaultTableCellRenderer#getTableCellRendererComponent
|
||||
* (javax.swing.JTable, java.lang.Object, boolean, boolean, int, int)
|
||||
*/
|
||||
@Override
|
||||
public final Component getTableCellRendererComponent(final JTable table, final Object value,
|
||||
final boolean isSelected, final boolean hasFocus, final int row, final int column) {
|
||||
|
||||
if (value instanceof Set) {
|
||||
this.lights = (Set<?>) value;
|
||||
this.setToolTipText(StringUtils.join(this.lights, ", "));
|
||||
}
|
||||
else {
|
||||
this.lights = null;
|
||||
this.setToolTipText(null);
|
||||
}
|
||||
|
||||
return super.getTableCellRendererComponent(table, "", isSelected, hasFocus, row, column);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see javax.swing.JComponent#paint(java.awt.Graphics)
|
||||
*/
|
||||
@Override
|
||||
public final void paint(final Graphics g) {
|
||||
super.paint(g);
|
||||
|
||||
if(this.lights == null)
|
||||
return;
|
||||
|
||||
final int cellWidth = this.getWidth();
|
||||
|
||||
int x = padding;
|
||||
int y = padding + 1;
|
||||
|
||||
final int cntGlyphs = 6;
|
||||
final int offsetIfNoSpace = (cellWidth - padding - elementWidth) / (cntGlyphs - 1);
|
||||
final int dx = Math.min(elementWidth + elementGap, offsetIfNoSpace);
|
||||
|
||||
CardFaceSymbols.drawManaSymbol(lights.contains(1) ? "AL1ON" : "AL1OFF", g, x, y);
|
||||
CardFaceSymbols.drawManaSymbol(lights.contains(2) ? "AL2ON" : "AL2OFF", g, x + (dx), y);
|
||||
CardFaceSymbols.drawManaSymbol(lights.contains(3) ? "AL3ON" : "AL3OFF", g, x + (dx * 2), y);
|
||||
CardFaceSymbols.drawManaSymbol(lights.contains(4) ? "AL4ON" : "AL4OFF", g, x + (dx * 3), y);
|
||||
CardFaceSymbols.drawManaSymbol(lights.contains(5) ? "AL5ON" : "AL5OFF", g, x + (dx * 4), y);
|
||||
CardFaceSymbols.drawManaSymbol(lights.contains(6) ? "AL6ON" : "AL6OFF", g, x + (dx * 5), y);
|
||||
}
|
||||
}
|
||||
@@ -50,6 +50,8 @@ public class ItemCellRenderer extends DefaultTableCellRenderer {
|
||||
return new SetCodeRenderer();
|
||||
case COST:
|
||||
return new ManaCostRenderer();
|
||||
case ATTRACTION_LIGHTS:
|
||||
return new AttractionLightRenderer();
|
||||
case DECK_COLOR:
|
||||
return new ColorSetRenderer();
|
||||
case FAVORITE:
|
||||
|
||||
@@ -1120,7 +1120,7 @@ public class FSkin {
|
||||
private static String preferredName;
|
||||
private static BufferedImage bimDefaultSprite, bimFavIcon, bimPreferredSprite, bimFoils, bimQuestDraftDeck, bimOldFoils,
|
||||
bimDefaultAvatars, bimPreferredAvatars, bimTrophies, bimAbilities, bimManaIcons, bimPhyrexian, bimColorlessHybrid, bimDefaultSleeve,
|
||||
bimDefaultSleeve2, bimDefaultDeckbox, bimPrefferedSetLogo, bimDefaultWatermark, bimDefaultDraftRank;
|
||||
bimDefaultSleeve2, bimDefaultDeckbox, bimPrefferedSetLogo, bimDefaultWatermark, bimDefaultDraftRank, bimAttractionLights;
|
||||
private static int x0, y0, w0, h0, newW, newH, preferredW, preferredH;
|
||||
private static int defaultFontSize = 12;
|
||||
private static boolean loaded = false;
|
||||
@@ -1239,7 +1239,7 @@ public class FSkin {
|
||||
}
|
||||
|
||||
final Localizer localizer = Localizer.getInstance();
|
||||
FView.SINGLETON_INSTANCE.setSplashProgessBarMessage(localizer.getMessage("splash.loading.processingimagesprites") + ": ", 12);
|
||||
FView.SINGLETON_INSTANCE.setSplashProgessBarMessage(localizer.getMessage("splash.loading.processingimagesprites") + ": ", 20);
|
||||
|
||||
// Grab and test various sprite files.
|
||||
final String defaultDir = ForgeConstants.DEFAULT_SKINS_DIR;
|
||||
@@ -1263,6 +1263,7 @@ public class FSkin {
|
||||
final File f18 = new File(defaultDir + ForgeConstants.SPRITE_PHYREXIAN_FILE);
|
||||
final File f19 = new File(defaultDir + ForgeConstants.SPRITE_COLORLESS_HYBRID_FILE);
|
||||
final File f20 = new File(defaultDir + ForgeConstants.SPRITE_DRAFTRANKS_FILE);
|
||||
final File f21 = new File(defaultDir + ForgeConstants.SPRITE_ATTRACTION_LIGHTS_FILE);
|
||||
|
||||
try {
|
||||
int p = 0;
|
||||
@@ -1276,6 +1277,8 @@ public class FSkin {
|
||||
FView.SINGLETON_INSTANCE.incrementSplashProgessBar(++p);
|
||||
bimColorlessHybrid = ImageIO.read(f19);
|
||||
FView.SINGLETON_INSTANCE.incrementSplashProgessBar(++p);
|
||||
bimAttractionLights = ImageIO.read(f21);
|
||||
FView.SINGLETON_INSTANCE.incrementSplashProgessBar(++p);
|
||||
bimPreferredSprite = ImageIO.read(f2);
|
||||
FView.SINGLETON_INSTANCE.incrementSplashProgessBar(++p);
|
||||
bimFoils = ImageIO.read(f3);
|
||||
@@ -1363,6 +1366,9 @@ public class FSkin {
|
||||
case COLORLESS_HYBRID:
|
||||
setImage(prop, bimColorlessHybrid);
|
||||
break;
|
||||
case ATTRACTION_LIGHTS:
|
||||
setImage(prop, bimAttractionLights);
|
||||
break;
|
||||
case DECKBOX:
|
||||
setImage(prop, bimDefaultDeckbox);
|
||||
break;
|
||||
@@ -1407,6 +1413,7 @@ public class FSkin {
|
||||
bimPhyrexian.flush();
|
||||
bimColorlessHybrid.flush();
|
||||
bimManaIcons.flush();
|
||||
bimAttractionLights.flush();
|
||||
|
||||
if (bimPreferredAvatars != null) { bimPreferredAvatars.flush(); }
|
||||
|
||||
@@ -1428,6 +1435,7 @@ public class FSkin {
|
||||
bimPhyrexian = null;
|
||||
bimColorlessHybrid = null;
|
||||
bimManaIcons = null;
|
||||
bimAttractionLights = null;
|
||||
|
||||
//establish encoding symbols
|
||||
final File dir = new File(ForgeConstants.CACHE_SYMBOLS_DIR);
|
||||
|
||||
Reference in New Issue
Block a user