mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Merge remote-tracking branch 'upstream/master' into deck-importer-decks-file-format
This commit is contained in:
@@ -67,6 +67,7 @@ public class Forge implements ApplicationListener {
|
||||
public static float heigtModifier = 0.0f;
|
||||
private static boolean isloadingaMatch = false;
|
||||
public static boolean showFPS = false;
|
||||
public static boolean allowCardBG = false;
|
||||
public static boolean altPlayerLayout = false;
|
||||
public static boolean altZoneTabs = false;
|
||||
public static String enableUIMask = "Crop";
|
||||
@@ -111,6 +112,13 @@ public class Forge implements ApplicationListener {
|
||||
|
||||
GuiBase.setIsAndroid(Gdx.app.getType() == Application.ApplicationType.Android);
|
||||
|
||||
if (!GuiBase.isAndroid() || (androidVersion > 28 && totalDeviceRAM > 7000)) {
|
||||
allowCardBG = true;
|
||||
} else {
|
||||
// don't allow to read and process
|
||||
ForgeConstants.SPRITE_CARDBG_FILE = "";
|
||||
}
|
||||
|
||||
graphics = new Graphics();
|
||||
splashScreen = new SplashScreen();
|
||||
frameRate = new FrameRate();
|
||||
|
||||
@@ -50,7 +50,6 @@ import forge.localinstance.properties.ForgeConstants;
|
||||
import forge.localinstance.properties.ForgePreferences;
|
||||
import forge.model.FModel;
|
||||
import forge.util.ImageUtil;
|
||||
import forge.util.TextUtil;
|
||||
|
||||
/**
|
||||
* This class stores ALL card images in a cache with soft values. this means
|
||||
@@ -113,8 +112,6 @@ public class ImageCache {
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
cache.invalidateAll();
|
||||
cache.cleanUp();
|
||||
missingIconKeys.clear();
|
||||
}
|
||||
|
||||
@@ -158,17 +155,23 @@ public class ImageCache {
|
||||
|
||||
final String prefix = imageKey.substring(0, 2);
|
||||
|
||||
PaperCard paperCard = null;
|
||||
if (prefix.equals(ImageKeys.CARD_PREFIX)) {
|
||||
PaperCard paperCard = ImageUtil.getPaperCardFromImageKey(imageKey);
|
||||
try {
|
||||
paperCard = ImageUtil.getPaperCardFromImageKey(imageKey);
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
if (paperCard == null)
|
||||
return false;
|
||||
|
||||
final boolean backFace = imageKey.endsWith(ImageKeys.BACKFACE_POSTFIX);
|
||||
final String cardfilename = backFace ? paperCard.getCardAltImageKey() : paperCard.getCardImageKey();
|
||||
if (!new File(ForgeConstants.CACHE_CARD_PICS_DIR + "/" + cardfilename + ".jpg").exists())
|
||||
if (!new File(ForgeConstants.CACHE_CARD_PICS_DIR + "/" + cardfilename + ".png").exists())
|
||||
if (!new File(ForgeConstants.CACHE_CARD_PICS_DIR + "/" + TextUtil.fastReplace(cardfilename,".full", ".fullborder") + ".jpg").exists())
|
||||
return false;
|
||||
if (!FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_ENABLE_ONLINE_IMAGE_FETCHER)) {
|
||||
return paperCard.hasImage();
|
||||
} else {
|
||||
final boolean backFace = imageKey.endsWith(ImageKeys.BACKFACE_POSTFIX);
|
||||
final String cardfilename = backFace ? paperCard.getCardAltImageKey() : paperCard.getCardImageKey();
|
||||
return ImageKeys.getCachedCardsFile(cardfilename) != null;
|
||||
}
|
||||
} else if (prefix.equals(ImageKeys.TOKEN_PREFIX)) {
|
||||
final String tokenfilename = imageKey.substring(2) + ".jpg";
|
||||
|
||||
@@ -236,11 +239,10 @@ public class ImageCache {
|
||||
if (image == null) {
|
||||
if (useDefaultIfNotFound) {
|
||||
image = defaultImage;
|
||||
if (useOtherCache)
|
||||
otherCache.put(imageKey, defaultImage);
|
||||
else
|
||||
cache.put(imageKey, defaultImage);
|
||||
if (imageBorder.get(image.toString()) == null)
|
||||
/*fix not loading image file since we intentionally not to update the cache in order for the
|
||||
image fetcher to update automatically after the card image/s are downloaded*/
|
||||
imageLoaded = false;
|
||||
if (image != null && imageBorder.get(image.toString()) == null)
|
||||
imageBorder.put(image.toString(), Pair.of(Color.valueOf("#171717").toString(), false)); //black border
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ public class CardImageRenderer {
|
||||
} else {
|
||||
borderColors = CardDetailUtil.getBorderColors(state, canShow);
|
||||
}
|
||||
Color[] colors = useCardBGTexture ? drawCardBackgroundTexture(state, g, borderColors, x, y, w, h) : fillColorBackground(g, borderColors, x, y, w, h);
|
||||
Color[] colors = useCardBGTexture && Forge.allowCardBG ? drawCardBackgroundTexture(state, g, borderColors, x, y, w, h) : fillColorBackground(g, borderColors, x, y, w, h);
|
||||
|
||||
float artInset = blackBorderThickness * 0.5f;
|
||||
float outerBorderThickness = 2 * blackBorderThickness - artInset;
|
||||
|
||||
@@ -51,7 +51,6 @@ import forge.gui.card.CardDetailUtil;
|
||||
import forge.gui.card.CardDetailUtil.DetailColors;
|
||||
import forge.item.IPaperCard;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.localinstance.properties.ForgeConstants;
|
||||
import forge.localinstance.properties.ForgeConstants.CounterDisplayType;
|
||||
import forge.localinstance.properties.ForgePreferences;
|
||||
import forge.localinstance.properties.ForgePreferences.FPref;
|
||||
|
||||
@@ -27,7 +27,6 @@ import forge.assets.FSkin;
|
||||
import forge.assets.FSkinFont;
|
||||
import forge.assets.FSkinImage;
|
||||
import forge.assets.FTextureRegionImage;
|
||||
import forge.card.CardDb;
|
||||
import forge.card.CardEdition;
|
||||
import forge.deck.io.DeckPreferences;
|
||||
import forge.gamemodes.limited.BoosterDraft;
|
||||
|
||||
@@ -105,11 +105,8 @@ public class LoadGameMenu extends FPopupMenu {
|
||||
protected void buildMenu() {
|
||||
FScreen currentScreen = Forge.getCurrentScreen();
|
||||
for (LoadGameScreen lgs : LoadGameScreen.values()) {
|
||||
//fixes the overlapping menu items when the user suddenly switch from load game screen index to another screen
|
||||
if (HomeScreen.instance.getActiveButtonIndex() == 1) {
|
||||
addItem(lgs.item);
|
||||
lgs.item.setSelected(currentScreen == lgs.screen);
|
||||
}
|
||||
addItem(lgs.item);
|
||||
lgs.item.setSelected(currentScreen == lgs.screen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user