mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
Tweak how skin reloaded after assets downloaded
This commit is contained in:
@@ -44,7 +44,7 @@ public class AssetsDownloader {
|
|||||||
Gdx.app.exit(); //can't continue if this fails
|
Gdx.app.exit(); //can't continue if this fails
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Forge.CURRENT_VERSION.equals(TextUtil.join(FileUtil.readFile(versionFile), "\n")) && !FSkin.assetsDownloadNeeded()) {
|
else if (Forge.CURRENT_VERSION.equals(TextUtil.join(FileUtil.readFile(versionFile), "\n")) && FSkin.getFontDir() != null) {
|
||||||
return; //if version matches what had been previously saved and FSkin isn't requesting assets download, no need to download assets
|
return; //if version matches what had been previously saved and FSkin isn't requesting assets download, no need to download assets
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ public class AssetsDownloader {
|
|||||||
FThreads.invokeInEdtAndWait(new Runnable() {
|
FThreads.invokeInEdtAndWait(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
FSkin.reloadAfterAssetsDownload(splashScreen);
|
FSkin.loadLight(FSkin.getName(), splashScreen);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ public class FSkin {
|
|||||||
private static FileHandle preferredFontDir;
|
private static FileHandle preferredFontDir;
|
||||||
private static String preferredName;
|
private static String preferredName;
|
||||||
private static boolean loaded = false;
|
private static boolean loaded = false;
|
||||||
private static boolean needReloadAfterAssetsDownloaded = false;
|
|
||||||
|
|
||||||
public static void changeSkin(final String skinName) {
|
public static void changeSkin(final String skinName) {
|
||||||
final ForgePreferences prefs = FModel.getPreferences();
|
final ForgePreferences prefs = FModel.getPreferences();
|
||||||
@@ -66,7 +65,6 @@ public class FSkin {
|
|||||||
//if skins directory doesn't exist, point to internal assets/skin directory instead for the sake of the splash screen
|
//if skins directory doesn't exist, point to internal assets/skin directory instead for the sake of the splash screen
|
||||||
preferredDir = Gdx.files.internal("fallback_skin");
|
preferredDir = Gdx.files.internal("fallback_skin");
|
||||||
preferredFontDir = null;
|
preferredFontDir = null;
|
||||||
needReloadAfterAssetsDownloaded = true; //flag that skins need to be reloaded after assets downloaded
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (splashScreen != null) {
|
if (splashScreen != null) {
|
||||||
@@ -244,16 +242,6 @@ public class FSkin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean assetsDownloadNeeded() {
|
|
||||||
return needReloadAfterAssetsDownloaded;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void reloadAfterAssetsDownload(SplashScreen splashScreen) {
|
|
||||||
needReloadAfterAssetsDownloaded = false;
|
|
||||||
allSkins = null;
|
|
||||||
loadLight(preferredName, splashScreen);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the name.
|
* Gets the name.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user