Tweak how skin reloaded after assets downloaded

This commit is contained in:
drdev
2014-05-30 19:54:50 +00:00
parent 2c071507da
commit cd84d5e96a
2 changed files with 2 additions and 14 deletions

View File

@@ -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);
} }
}); });

View File

@@ -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.
* *