update Achievement Trophies

- use PaperCard images as overlay if available for Achievement Trophies
This commit is contained in:
Anthony Calosa
2023-03-15 00:27:49 +08:00
parent 4576efc52f
commit a41a3916de
9 changed files with 30 additions and 11 deletions

View File

@@ -144,15 +144,22 @@ public class GuiDesktop implements IGuiBase {
}
@Override
public ISkinImage createLayeredImage(final FSkinProp background, final String overlayFilename, final float opacity) {
public ISkinImage createLayeredImage(final PaperCard paperCard, final FSkinProp background, final String overlayFilename, final float opacity) {
final BufferedImage image = new BufferedImage(background.getWidth(), background.getHeight(), BufferedImage.TYPE_INT_ARGB);
final Graphics2D g = image.createGraphics();
final FSkin.SkinImage backgroundImage = FSkin.getImage(background);
FSkin.drawImage(g, backgroundImage, 0, 0, background.getWidth(), background.getHeight());
final int cardImageWidth = 90;
final int cardImageHeight = 128;
BufferedImage cardImage = null;
if (paperCard != null)
cardImage = ImageCache.scaleImage(paperCard.getCardImageKey(), cardImageWidth, cardImageHeight, false, null);
if (FileUtil.doesFileExist(overlayFilename)) {
if (FileUtil.doesFileExist(overlayFilename) && cardImage == null) {
final ImageIcon overlay = new ImageIcon(overlayFilename);
g.drawImage(overlay.getImage(), (background.getWidth() - overlay.getIconWidth()) / 2, (background.getHeight() - overlay.getIconHeight()) / 2, overlay.getIconWidth(), overlay.getIconHeight(), null);
} else if (cardImage != null) {
g.drawImage(cardImage, (background.getWidth() - cardImageWidth) / 2, (background.getHeight() - cardImageHeight) / 4, cardImageWidth, cardImageHeight, null);
}
return new FSkin.UnskinnedIcon(image, opacity);
}