Search in sources :

Example 1 with SpineDrawableLogic

use of games.rednblack.h2d.extension.spine.SpineDrawableLogic in project HyperLap2D by rednblackgames.

the class ResourceManager method loadCurrentProjectSpineAnimations.

private void loadCurrentProjectSpineAnimations(String path) {
    spineAnimAtlases.clear();
    FileHandle sourceDir = new FileHandle(path);
    SpineDrawableLogic spineDrawableLogic = (SpineDrawableLogic) Sandbox.getInstance().sceneControl.sceneLoader.getExternalItemType(SpineItemType.SPINE_TYPE).getDrawable();
    for (FileHandle entry : sourceDir.list()) {
        if (entry.file().isDirectory()) {
            String animName = FilenameUtils.removeExtension(entry.file().getName());
            FileHandle animJsonFile = Gdx.files.internal(entry.file().getAbsolutePath() + File.separator + animName + ".json");
            SpineDataObject spineDataObject = new SpineDataObject();
            spineDataObject.skeletonJson = new SkeletonJson(new ResourceRetrieverAttachmentLoader(animName, this, spineDrawableLogic));
            spineDataObject.skeletonData = spineDataObject.skeletonJson.readSkeletonData(animJsonFile);
            spineAnimAtlases.put(animName, spineDataObject);
        }
    }
}
Also used : SpineDrawableLogic(games.rednblack.h2d.extension.spine.SpineDrawableLogic) ResourceRetrieverAttachmentLoader(games.rednblack.h2d.extension.spine.ResourceRetrieverAttachmentLoader) FileHandle(com.badlogic.gdx.files.FileHandle) SkeletonJson(com.esotericsoftware.spine.SkeletonJson) SpineDataObject(games.rednblack.h2d.extension.spine.SpineDataObject)

Aggregations

FileHandle (com.badlogic.gdx.files.FileHandle)1 SkeletonJson (com.esotericsoftware.spine.SkeletonJson)1 ResourceRetrieverAttachmentLoader (games.rednblack.h2d.extension.spine.ResourceRetrieverAttachmentLoader)1 SpineDataObject (games.rednblack.h2d.extension.spine.SpineDataObject)1 SpineDrawableLogic (games.rednblack.h2d.extension.spine.SpineDrawableLogic)1