@Override public Array<AssetDescriptor> getDependencies (String fileName, FileHandle file, SkinParameter parameter) { Array<AssetDescriptor> deps = new Array(); if (parameter == null || parameter.textureAtlasPath == null) deps.add(new AssetDescriptor(file.pathWithoutExtension() + ".atlas", TextureAtlas.class)); else if (parameter.textureAtlasPath != null) deps.add(new AssetDescriptor(parameter.textureAtlasPath, TextureAtlas.class)); return deps; }
@Override public Array<AssetDescriptor> getDependencies (String fileName, FileHandle file, SkinParameter parameter) { Array<AssetDescriptor> deps = new Array(); if (parameter == null || parameter.textureAtlasPath == null) deps.add(new AssetDescriptor(file.pathWithoutExtension() + ".atlas", TextureAtlas.class)); else if (parameter.textureAtlasPath != null) deps.add(new AssetDescriptor(parameter.textureAtlasPath, TextureAtlas.class)); return deps; }
@Override public Skin loadSync (AssetManager manager, String fileName, FileHandle file, SkinParameter parameter) { String textureAtlasPath = file.pathWithoutExtension() + ".atlas"; ObjectMap<String, Object> resources = null; if (parameter != null) { if (parameter.textureAtlasPath != null) { textureAtlasPath = parameter.textureAtlasPath; } if (parameter.resources != null) { resources = parameter.resources; } } TextureAtlas atlas = manager.get(textureAtlasPath, TextureAtlas.class); Skin skin = newSkin(atlas); if (resources != null) { for (Entry<String, Object> entry : resources.entries()) { skin.add(entry.key, entry.value); } } skin.load(file); return skin; }
@Override public Skin loadSync (AssetManager manager, String fileName, FileHandle file, SkinParameter parameter) { String textureAtlasPath = file.pathWithoutExtension() + ".atlas"; ObjectMap<String, Object> resources = null; if (parameter != null) { if (parameter.textureAtlasPath != null) { textureAtlasPath = parameter.textureAtlasPath; } if (parameter.resources != null) { resources = parameter.resources; } } TextureAtlas atlas = manager.get(textureAtlasPath, TextureAtlas.class); Skin skin = newSkin(atlas); if (resources != null) { for (Entry<String, Object> entry : resources.entries()) { skin.add(entry.key, entry.value); } } skin.load(file); return skin; }
private void printHandleInfo(FileHandle handle) { System.out.println(handle.isDirectory() ? "Directory info" : "File info"); System.out.println("Name: " + handle.name()); System.out.println("Name without extension: " + handle.nameWithoutExtension()); System.out.println("Extension: " + handle.extension()); System.out.println("Last modified in ms " + handle.lastModified()); System.out.println("Path " + handle.path()); System.out.println("Path without extension " + handle.pathWithoutExtension()); if (!handle.isDirectory()) { System.out.println("Size: " + handle.length() + " bytes"); } System.out.println(); }
@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; } }
@Override public Array<AssetDescriptor> getDependencies (String fileName, FileHandle file, SkinParameter parameter) { Array<AssetDescriptor> deps = new Array(); if (parameter == null || parameter.textureAtlasPath == null) deps.add(new AssetDescriptor(file.pathWithoutExtension() + ".atlas", TextureAtlas.class)); else if (parameter.textureAtlasPath != null) deps.add(new AssetDescriptor(parameter.textureAtlasPath, TextureAtlas.class)); return deps; }
@Override public void selected (Array<FileHandle> files) { FileHandle file = files.first(); if (file.name().endsWith(".9")) { String path = file.path() + ".png"; file = Gdx.files.getFileHandle(path, file.type()); } if (!file.name().endsWith(".9.png")) { String path = file.pathWithoutExtension() + ".9.png"; file = Gdx.files.getFileHandle(path, file.type()); } PixmapIO.writePNG(file, ninePatchPixmap); ninePatchPixmap.dispose(); }
@Override public Skin loadSync (AssetManager manager, String fileName, FileHandle file, SkinParameter parameter) { String textureAtlasPath = file.pathWithoutExtension() + ".atlas"; ObjectMap<String, Object> resources = null; if (parameter != null) { if (parameter.textureAtlasPath != null) { textureAtlasPath = parameter.textureAtlasPath; } if (parameter.resources != null) { resources = parameter.resources; } } TextureAtlas atlas = manager.get(textureAtlasPath, TextureAtlas.class); Skin skin = newSkin(atlas); if (resources != null) { for (Entry<String, Object> entry : resources.entries()) { skin.add(entry.key, entry.value); } } skin.load(file); return skin; }
name = fontFile.pathWithoutExtension(); int fileSize = (int)fontFile.length();