Commit c5566c29 authored by Matyáš Latner's avatar Matyáš Latner

#30 Assets existence check fix for application assets loaders

parent 7a4cf141
......@@ -139,9 +139,13 @@ public abstract class TablexiaAbstractFileManager extends AssetManager {
}
public <T> void loadAsset(String assetFileName, Class<T> clazz) {
loadAsset(assetFileName, clazz, true);
}
public <T> void loadAsset(String assetFileName, Class<T> clazz, boolean checkFileExistence) {
if (assetFileName != null) {
String filePath = storageType.getStoragePath() + assetFileName;
if (storageType.getResolver().resolve(filePath).exists()) {
if (!checkFileExistence || storageType.getResolver().resolve(filePath).exists()) {
load(filePath, clazz);
return;
}
......
......@@ -19,7 +19,11 @@ public class TablexiaAtlasManager extends TablexiaAbstractFileManager {
}
public void loadAtlas(String atlasName) {
loadAsset(atlasName, TextureAtlas.class);
loadAtlas(atlasName, true);
}
public void loadAtlas(String atlasName, boolean checkAtlasExistence) {
loadAsset(atlasName, TextureAtlas.class, checkAtlasExistence);
}
public TextureRegion getTextureRegionFromAtlas(String atlasName, String regionName) {
......
......@@ -13,7 +13,11 @@ public class TablexiaSoundManager extends TablexiaAbstractFileManager {
}
public void loadSound(String soundName) {
loadAsset(soundName, Sound.class);
loadSound(soundName, true);
}
public void loadSound(String soundName, boolean checkSoundExistence) {
loadAsset(soundName, Sound.class, checkSoundExistence);
}
public Sound getSound(String soundName) {
......
......@@ -60,7 +60,8 @@ public class ApplicationAtlasManager extends TablexiaAtlasManager implements IAp
public static final String BACKGROUND_WOODEN = UNIVERSAL_PATH + "background_wooden";
public void load() {
loadAtlas(APPLICATION_ATLAS);
// don't check atlas file -> all assets needn't be unzipped yet
loadAtlas(APPLICATION_ATLAS, false);
}
public TextureRegion getTextureRegion(String textureName) {
......
......@@ -43,7 +43,8 @@ public class ApplicationSoundManager extends TablexiaSoundManager implements IAp
@Override
public void loadSound(String soundName) {
super.loadSound(createAssetPath(soundName));
// don't check sound file -> all assets needn't be unzipped yet
super.loadSound(createAssetPath(soundName), false);
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment