mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Merge branch 'master' into master
This commit is contained in:
@@ -54,8 +54,6 @@ import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
|
||||
public class Forge implements ApplicationListener {
|
||||
public static String CURRENT_VERSION = "0.0";
|
||||
|
||||
private static ApplicationListener app = null;
|
||||
static Scene currentScene = null;
|
||||
static Array<Scene> lastScene = new Array<>();
|
||||
@@ -127,11 +125,10 @@ public class Forge implements ApplicationListener {
|
||||
public static boolean createNewAdventureMap = false;
|
||||
private static Localizer localizer;
|
||||
|
||||
public static ApplicationListener getApp(Clipboard clipboard0, IDeviceAdapter deviceAdapter0, String assetDir0, boolean propertyConfig, boolean androidOrientation, int totalRAM, boolean isTablet, int AndroidAPI, String AndroidRelease, String deviceName, String versionString) {
|
||||
public static ApplicationListener getApp(Clipboard clipboard0, IDeviceAdapter deviceAdapter0, String assetDir0, boolean propertyConfig, boolean androidOrientation, int totalRAM, boolean isTablet, int AndroidAPI, String AndroidRelease, String deviceName) {
|
||||
if (app == null) {
|
||||
app = new Forge();
|
||||
if (GuiBase.getInterface() == null) {
|
||||
CURRENT_VERSION = versionString;
|
||||
clipboard = clipboard0;
|
||||
deviceAdapter = deviceAdapter0;
|
||||
GuiBase.setUsingAppDirectory(assetDir0.contains("forge.app")); //obb directory on android uses the package name as entrypoint
|
||||
|
||||
@@ -54,7 +54,7 @@ public class GuiMobile implements IGuiBase {
|
||||
|
||||
@Override
|
||||
public String getCurrentVersion() {
|
||||
return Forge.CURRENT_VERSION;
|
||||
return Forge.getDeviceAdapter().getVersionString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,7 +27,7 @@ public class StartScene extends UIScene {
|
||||
private static StartScene object;
|
||||
Dialog exitDialog, backupDialog, zipDialog, unzipDialog;
|
||||
TextraButton saveButton, resumeButton, continueButton;
|
||||
TypingLabel version = Controls.newTypingLabel("{GRADIENT}[%80]" + Forge.CURRENT_VERSION + "{ENDGRADIENT}");
|
||||
TypingLabel version = Controls.newTypingLabel("{GRADIENT}[%80]v." + Forge.getDeviceAdapter().getVersionString() + "{ENDGRADIENT}");
|
||||
|
||||
|
||||
public StartScene() {
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import forge.gui.GuiBase;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@@ -75,6 +76,19 @@ public class AssetsDownloader {
|
||||
}
|
||||
|
||||
//see if assets need updating
|
||||
if (GuiBase.isAndroid()) {
|
||||
FileHandle resDir = Gdx.files.absolute(ForgeConstants.RES_DIR);
|
||||
FileHandle assetsDir = Gdx.files.absolute(ForgeConstants.ASSETS_DIR);
|
||||
FileHandle advBG = Gdx.files.absolute(ForgeConstants.DEFAULT_SKINS_DIR).child(ForgeConstants.ADV_TEXTURE_BG_FILE);
|
||||
if (!advBG.exists()) {
|
||||
FileHandle deleteVersion = assetsDir.child("version.txt");
|
||||
if (deleteVersion.exists())
|
||||
deleteVersion.delete();
|
||||
FileHandle deleteBuild = resDir.child("build.txt");
|
||||
if (deleteBuild.exists())
|
||||
deleteBuild.delete();
|
||||
}
|
||||
}
|
||||
File versionFile = new File(ForgeConstants.ASSETS_DIR + "version.txt");
|
||||
if (!versionFile.exists()) {
|
||||
try {
|
||||
|
||||
@@ -815,13 +815,12 @@ public class CardRenderer {
|
||||
g.drawRect(BORDER_THICKNESS, Color.MAGENTA, cx, cy, cw, ch);
|
||||
}
|
||||
//Ability Icons
|
||||
boolean onbattlefield = ZoneType.Battlefield.equals(card.getZone());
|
||||
if (unselectable) {
|
||||
g.setAlphaComposite(0.6f);
|
||||
}
|
||||
if (onbattlefield && onTop) {
|
||||
if (ZoneType.Battlefield.equals(card.getZone()) && onTop) {
|
||||
drawAbilityIcons(g, card, cx, cy, cw, ch, cx + ((cw * 2) / 2.3f), cy, cw / 5.5f, cw / 5.7f, showAbilityIcons(card));
|
||||
} else if (canShow && !onbattlefield && showAbilityIcons(card)) {
|
||||
} else if (canShow && !ZoneType.Battlefield.equals(card.getZone()) && showAbilityIcons(card)) {
|
||||
//draw indicator for flash or can be cast at instant speed, enabled if show ability icons is enabled
|
||||
String keywordKey = card.getCurrentState().getKeywordKey();
|
||||
String abilityText = card.getCurrentState().getAbilityText();
|
||||
|
||||
@@ -157,7 +157,7 @@ public class SplashScreen extends FContainer {
|
||||
float w2 = Forge.isLandscapeMode() ? Forge.getScreenWidth() / 2f : Forge.getScreenHeight() / 2f;
|
||||
float h2 = 57f / 450f * (w2/2);
|
||||
|
||||
String version = "v. " + Forge.CURRENT_VERSION;
|
||||
String version = "v." + Forge.getDeviceAdapter().getVersionString();
|
||||
g.drawText(version, disclaimerFont, FProgressBar.SEL_FORE_COLOR, x, getHeight() - disclaimerHeight, w, disclaimerHeight, false, Align.center, true);
|
||||
progressBar.setBounds((Forge.getScreenWidth() - w2)/2, Forge.getScreenHeight() - h2 * 2f, w2, h2);
|
||||
g.draw(progressBar);
|
||||
@@ -381,7 +381,7 @@ public class SplashScreen extends FContainer {
|
||||
progressBar.setBounds(x + padding, y, w - 2 * padding, pbHeight);
|
||||
g.draw(progressBar);
|
||||
|
||||
String version = "v. " + Forge.CURRENT_VERSION;
|
||||
String version = "v." + Forge.getDeviceAdapter().getVersionString();
|
||||
g.drawText(version, disclaimerFont, FProgressBar.SEL_FORE_COLOR, x, getHeight() - disclaimerHeight, w, disclaimerHeight, false, Align.center, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,11 @@ public class AudioClip implements IAudioClip {
|
||||
catch (InterruptedException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
clip.play(value);
|
||||
try {
|
||||
clip.play(value);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public final void loop() {
|
||||
@@ -65,13 +69,21 @@ public class AudioClip implements IAudioClip {
|
||||
catch (InterruptedException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
clip.loop();
|
||||
try {
|
||||
clip.loop();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
if (clip != null) {
|
||||
clip.dispose();
|
||||
try {
|
||||
clip.dispose();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
clip = null;
|
||||
}
|
||||
}
|
||||
@@ -80,7 +92,11 @@ public class AudioClip implements IAudioClip {
|
||||
if (clip == null) {
|
||||
return;
|
||||
}
|
||||
clip.stop();
|
||||
try {
|
||||
clip.stop();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public final boolean isDone() {
|
||||
|
||||
Reference in New Issue
Block a user