@Override public ParticleEffect getOrLoad(final String id) { final String[] data = Strings.split(id, '$'); if (data.length == 0) { throwUnknownPathException(); } final String path = determinePath(data[0]); getIdsToPaths().put(id, path); final AssetManager assetManager = getAssetManager(); if (assetManager.isLoaded(path)) { return assetManager.get(path, getType()); } if (data.length > 1) { final String atlasName = TextureAtlasProvider.getTextureAtlasPath(data[1]); final ParticleEffectParameter parameters = new ParticleEffectParameter(); parameters.atlasFile = atlasName; assetManager.load(path, ParticleEffect.class, parameters); } else { assetManager.load(path, ParticleEffect.class); } return null; }
@Override public boolean match(FileHandle file) { boolean result = file.extension().equals("p"); if(result) { Engine.getAssetManager().load(file.path().replace("\\", "/"),ParticleEffect.class); return result; } result = file.extension().equals("pp"); if(result) { ParticleEffectParameter parameter = new ParticleEffectParameter(); parameter.atlasFile = file.pathWithoutExtension().replace("\\", "/")+".atlas"; Engine.getAssetManager().load(file.path().replace("\\", "/"),ParticleEffect.class,parameter); return result; } return false; }
public void loadParticleEffect(String name, String atlas) { ParticleEffectParameter param = new ParticleEffectParameter(); param.atlasFile = atlas; assets.load(PARTICLE_FOLDER + FILE_SEPARATOR + name, ParticleEffect.class, param); }