use of games.rednblack.h2d.extension.spine.SpineDataObject in project HyperLap2D by rednblackgames.
the class SpineActor method initSkeletonData.
private void initSkeletonData() {
SpineDataObject spineDataObject = (SpineDataObject) irr.getExternalItemType(SpineItemType.SPINE_TYPE, animationName);
skeletonJson = spineDataObject.skeletonJson;
skeletonData = spineDataObject.skeletonData;
}
use of games.rednblack.h2d.extension.spine.SpineDataObject 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);
}
}
}
use of games.rednblack.h2d.extension.spine.SpineDataObject in project HyperLap2D by rednblackgames.
the class ResourcesManager method getSpineDrawable.
public SpineDrawable getSpineDrawable(String name) {
if (spineDrawableCache.get(name) == null) {
SpineDataObject spineDataObject = (SpineDataObject) tiledPlugin.getAPI().getSceneLoader().getRm().getExternalItemType(SpineItemType.SPINE_TYPE, name);
SkeletonData skeletonData = spineDataObject.skeletonData;
Skeleton skeleton = new Skeleton(skeletonData);
spineDrawableCache.put(name, new SpineDrawable(skeleton, skeletonRenderer));
}
return spineDrawableCache.get(name);
}
use of games.rednblack.h2d.extension.spine.SpineDataObject in project HyperLap2D by rednblackgames.
the class SpineDrawStrategy method updateTile.
@Override
public void updateTile(int entity) {
if (!checkValidTile(entity))
return;
SpineComponent spineComponent = ComponentRetriever.get(entity, SpineComponent.class, tiledPlugin.getAPI().getEngine());
if (!spineComponent.animationName.equals(tiledPlugin.getSelectedTileName())) {
replaceSpineCommandBuilder.begin(entity);
String animName = tiledPlugin.getSelectedTileName();
replaceSpineCommandBuilder.setAnimationName(animName);
SpineDataObject spineDataObject = (SpineDataObject) tiledPlugin.getAPI().getSceneLoader().getRm().getExternalItemType(SpineItemType.SPINE_TYPE, animName);
replaceSpineCommandBuilder.setSkeletonJson(spineDataObject.skeletonJson);
SkeletonData skeletonData = spineDataObject.skeletonData;
replaceSpineCommandBuilder.setSkeleton(new Skeleton(skeletonData));
replaceSpineCommandBuilder.execute(tiledPlugin.facade);
}
}
Aggregations