Search in sources :

Example 1 with AssetData

use of com.badlogic.gdx.graphics.g3d.particles.ResourceData.AssetData in project libgdx by libgdx.

the class ParticleEffectLoader method getDependencies.

@Override
public Array<AssetDescriptor> getDependencies(String fileName, FileHandle file, ParticleEffectLoadParameter parameter) {
    Json json = new Json();
    ResourceData<ParticleEffect> data = json.fromJson(ResourceData.class, file);
    Array<AssetData> assets = null;
    synchronized (items) {
        ObjectMap.Entry<String, ResourceData<ParticleEffect>> entry = new ObjectMap.Entry<String, ResourceData<ParticleEffect>>();
        entry.key = fileName;
        entry.value = data;
        items.add(entry);
        assets = data.getAssets();
    }
    Array<AssetDescriptor> descriptors = new Array<AssetDescriptor>();
    for (AssetData<?> assetData : assets) {
        // If the asset doesn't exist try to load it from loading effect directory
        if (!resolve(assetData.filename).exists()) {
            assetData.filename = file.parent().child(Gdx.files.internal(assetData.filename).name()).path();
        }
        if (assetData.type == ParticleEffect.class) {
            descriptors.add(new AssetDescriptor(assetData.filename, assetData.type, parameter));
        } else
            descriptors.add(new AssetDescriptor(assetData.filename, assetData.type));
    }
    return descriptors;
}
Also used : AssetData(com.badlogic.gdx.graphics.g3d.particles.ResourceData.AssetData) Json(com.badlogic.gdx.utils.Json) Array(com.badlogic.gdx.utils.Array) ObjectMap(com.badlogic.gdx.utils.ObjectMap) AssetDescriptor(com.badlogic.gdx.assets.AssetDescriptor)

Aggregations

AssetDescriptor (com.badlogic.gdx.assets.AssetDescriptor)1 AssetData (com.badlogic.gdx.graphics.g3d.particles.ResourceData.AssetData)1 Array (com.badlogic.gdx.utils.Array)1 Json (com.badlogic.gdx.utils.Json)1 ObjectMap (com.badlogic.gdx.utils.ObjectMap)1