fix backface not generating if art is missing

This commit is contained in:
Anthony Calosa
2023-08-01 19:24:24 +08:00
parent 5384d26fce
commit afb5307502

View File

@@ -203,7 +203,8 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
}
ImageCache.updateSynqCount(frontFace, count);
//preload card back for performance
if (hasbackface && ImageCache.imageKeyFileExists(reward.getCard().getImageKey(true))) {
if (hasbackface) {
if (ImageCache.imageKeyFileExists(reward.getCard().getImageKey(true))) {
PaperCard cardBack = ImageUtil.getPaperCardFromImageKey(reward.getCard().getImageKey(true));
File backFace = ImageKeys.getImageFile(cardBack.getCardAltImageKey());
if (backFace != null) {
@@ -238,6 +239,21 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
System.err.println("Failed to load image: " + backFace.getPath());
}
}
} else {
try {
if (holdTooltip != null) {
if (Talt == null)
Talt = renderPlaceholder(new Graphics(), reward.getCard(), true);
if (holdTooltip.tooltip_actor.getChildren().size <= 2) {
holdTooltip.tooltip_actor.altcImage = new RewardImage(processDrawable(Talt));
holdTooltip.tooltip_actor.addActorAt(2, holdTooltip.tooltip_actor.altcImage);
holdTooltip.tooltip_actor.swapActor(holdTooltip.tooltip_actor.altcImage, holdTooltip.tooltip_actor.cImage);
}
}
} catch (Exception e) {
System.err.println("Failed to load alternate image: " + reward.getCard());
}
}
}
} else {
String imagePath = ImageUtil.getImageRelativePath(reward.getCard(), "", true, false);