本文整理汇总了Java中com.esotericsoftware.spine.SkeletonData类的典型用法代码示例。如果您正苦于以下问题:Java SkeletonData类的具体用法?Java SkeletonData怎么用?Java SkeletonData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SkeletonData类属于com.esotericsoftware.spine包,在下文中一共展示了SkeletonData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDependencies
import com.esotericsoftware.spine.SkeletonData; //导入依赖的package包/类
@Override
public Array<AssetDescriptor> getDependencies(String fileName,
FileHandle file, Parameter parameter) {
JsonValue root = reader.parse(file);
String spineFile = root.getString("spine");
Array<AssetDescriptor> dependencies = new Array<AssetDescriptor>();
dependencies.add(new AssetDescriptor(
spineFile,
SkeletonData.class,
getSkeletonParameters(spineFile)
));
return dependencies;
}
示例2: loadSource
import com.esotericsoftware.spine.SkeletonData; //导入依赖的package包/类
private void loadSource(String source, String atlas) {
EngineLogger.debug("Loading: " + source);
SkeletonCacheEntry entry = (SkeletonCacheEntry) sourceCache.get(source);
if (entry == null) {
entry = new SkeletonCacheEntry();
entry.atlas = atlas == null ? source : atlas;
sourceCache.put(source, entry);
}
if (entry.refCounter == 0) {
if (EngineAssetManager.getInstance().getLoader(SkeletonData.class) == null) {
EngineAssetManager.getInstance().setLoader(SkeletonData.class,
new SkeletonDataLoader(EngineAssetManager.getInstance().getFileHandleResolver()));
}
SkeletonDataLoaderParameter parameter = new SkeletonDataLoaderParameter(
EngineAssetManager.ATLASES_DIR + entry.atlas + EngineAssetManager.ATLAS_EXT,
EngineAssetManager.getInstance().getScale());
EngineAssetManager.getInstance().load(getFileName(source), SkeletonData.class, parameter);
}
entry.refCounter++;
}
示例3: retrieveSource
import com.esotericsoftware.spine.SkeletonData; //导入依赖的package包/类
private void retrieveSource(String source, String atlas) {
EngineLogger.debug("Retrieving: " + source);
SkeletonCacheEntry entry = (SkeletonCacheEntry) sourceCache.get(source);
if (entry == null || entry.refCounter < 1) {
loadSource(source, atlas);
EngineAssetManager.getInstance().finishLoading();
entry = (SkeletonCacheEntry) sourceCache.get(source);
}
if (entry.skeleton == null) {
SkeletonData skeletonData = EngineAssetManager.getInstance().get(getFileName(source), SkeletonData.class);
entry.skeleton = new Skeleton(skeletonData);
AnimationStateData stateData = new AnimationStateData(skeletonData); // Defines
// mixing
// between
// animations.
stateData.setDefaultMix(0f);
entry.animation = new AnimationState(stateData);
entry.animation.addListener(animationListener);
}
}
示例4: getData
import com.esotericsoftware.spine.SkeletonData; //导入依赖的package包/类
public SkeletonData getData (FileHandle atlasFile, FileHandle skeletonFile, float scale) {
SkeletonData data = sizeMaps.get(scale);
if (data == null) {
if (skeletonFile.extension().equals("json")) {
SkeletonJson json = new SkeletonJson(getAtlas(atlasFile));
json.setScale(scale);
data = json.readSkeletonData(skeletonFile);
sizeMaps.put(scale, data);
}
if (skeletonFile.extension().equals("skel")) {
SkeletonBinary binary = new SkeletonBinary(getAtlas(atlasFile));
binary.setScale(scale);
data = binary.readSkeletonData(skeletonFile);
sizeMaps.put(scale, data);
}
}
return data;
}
示例5: SkeletonActorPool
import com.esotericsoftware.spine.SkeletonData; //导入依赖的package包/类
public SkeletonActorPool (SkeletonRenderer renderer, SkeletonData skeletonData, AnimationStateData stateData,
int initialCapacity, int max) {
super(initialCapacity, max);
this.renderer = renderer;
this.skeletonData = skeletonData;
this.stateData = stateData;
obtained = new Array(false, initialCapacity);
skeletonPool = new Pool<Skeleton>(initialCapacity, max) {
protected Skeleton newObject () {
return new Skeleton(SkeletonActorPool.this.skeletonData);
}
protected void reset (Skeleton skeleton) {
skeleton.setColor(Color.WHITE);
skeleton.setFlip(false, false);
skeleton.setSkin((Skin)null);
skeleton.setSkin(SkeletonActorPool.this.skeletonData.getDefaultSkin());
skeleton.setToSetupPose();
}
};
statePool = new Pool<AnimationState>(initialCapacity, max) {
protected AnimationState newObject () {
return new AnimationState(SkeletonActorPool.this.stateData);
}
protected void reset (AnimationState state) {
state.clearTracks();
state.clearListeners();
}
};
}
示例6: loadData
import com.esotericsoftware.spine.SkeletonData; //导入依赖的package包/类
private void loadData(AssetManager manager, String fileName,
FileHandle file, Parameter parameter) {
JsonValue root = reader.parse(file);
skeleton = manager.get(root.getString("spine"), SkeletonData.class);
loadTagGroups(root.get("tags"));
loadLayers(root.get("layers"));
loadTransitions(root.get("transitions"));
}
示例7: findSpineAnims
import com.esotericsoftware.spine.SkeletonData; //导入依赖的package包/类
private void findSpineAnims(JsonValue value, Array<AssetDescriptor> dependencies)
{
if (value.has("composite"))
{
findSpineAnims(value.get("composite"), dependencies);
}
if (value.has("sComposites"))
{
JsonValue composites = value.get("sComposites");
for (int i = 0; i < composites.size; ++i)
{
findSpineAnims(composites.get(i), dependencies);
}
}
if (value.has("sSpineAnimations"))
{
JsonValue animations = value.get("sSpineAnimations");
for (int i = 0; i < animations.size; ++i)
{
String animationName = animations.get(i).getString("animationName");
logger.info("-- Found spine animation: " + animationName);
String fileWithoutExtension = SPINE_ANIMS_DIR + animationName + "/" + animationName;
SkeletonDataLoaderParameter skeletonParams = new SkeletonDataLoaderParameter();
skeletonParams.atlasName = fileWithoutExtension + ".atlas";
dependencies.add(new AssetDescriptor(
fileWithoutExtension + ".json",
SkeletonData.class,
skeletonParams
));
}
}
}
示例8: load
import com.esotericsoftware.spine.SkeletonData; //导入依赖的package包/类
@Override
public void load(OverlapScene scene, Entity entity, ObjectMap<String, String> map) {
CCTvComponent cctv = new CCTvComponent();
SizeComponent size = new SizeComponent();
SpineComponent spine = new SpineComponent();
AnimationControlComponent control = new AnimationControlComponent();
ObserverComponent observer = new ObserverComponent();
AssetManager assetManager = Env.getGame().getAssetManager();
// Load cctv properties
cctv.angularVelocity = Float.parseFloat(map.get("angularVelocity", "0.0"));
cctv.maxAngle = Float.parseFloat(map.get("maxAngle", "0.0"));
cctv.minAngle = Float.parseFloat(map.get("minAngle", "0.0"));
cctv.waitTimeMaxAngle = Float.parseFloat(map.get("waitTimeMaxAngle", "0.0"));
cctv.waitTimeMinAngle = Float.parseFloat(map.get("waitTimeMinAngle", "0.0"));
// Load spine animation
SkeletonData skeletonData = assetManager.get("spine/Beholder.json", SkeletonData.class);
spine.skeleton = new Skeleton(skeletonData);
AnimationStateData stateData = new AnimationStateData(skeletonData);
spine.state = new AnimationState(stateData);
size.width = 0.5f;
size.height = 0.5f;
control.data = assetManager.get("anims/cctv.json", AnimationControl.class);
observer.fovAngle = 20.0f;
observer.distance = 4.5f;
entity.add(size);
entity.add(spine);
entity.add(cctv);
entity.add(control);
entity.add(observer);
}
示例9: load
import com.esotericsoftware.spine.SkeletonData; //导入依赖的package包/类
@Override
public void load(OverlapScene scene, Entity entity, ObjectMap<String, String> value) {
PhysicsComponent physics = new PhysicsComponent();
PlayerComponent player = new PlayerComponent();
SpineComponent spine = new SpineComponent();
SizeComponent size = new SizeComponent();
AnimationControlComponent animControl = new AnimationControlComponent();
ObservableComponent observable = new ObservableComponent();
AssetManager assetManager = Env.getGame().getAssetManager();
SkeletonData skeletonData = assetManager.get("spine/Player.json", SkeletonData.class);
spine.skeleton = new Skeleton(skeletonData);
AnimationStateData stateData = new AnimationStateData(skeletonData);
spine.state = new AnimationState(stateData);
animControl.data = assetManager.get("anims/player.json", AnimationControl.class);
size.width = 0.5f;
size.height = 1.4f;
entity.add(physics);
entity.add(player);
entity.add(spine);
entity.add(size);
entity.add(animControl);
entity.add(observable);
cameraSystem.setTarget(entity);
}
示例10: loadAsync
import com.esotericsoftware.spine.SkeletonData; //导入依赖的package包/类
@Override
public void loadAsync(AssetManager manager, String fileName, FileHandle file, AnimationStateDataLoaderParameter parameter) {
logger.info("loading " + fileName);
data = new AnimationStateData(manager.get(parameter.skeletonName, SkeletonData.class));
try {
JsonReader reader = new JsonReader();
JsonValue root = reader.parse(file);
float defaultBlend = root.get("defaultBlend").asFloat();
logger.info("default blend: " + defaultBlend + "s");
data.setDefaultMix(defaultBlend);
JsonIterator blendIt = root.get("blends").iterator();
while (blendIt.hasNext()) {
JsonValue blendValue = blendIt.next();
String from = blendValue.get("from").asString();
String to = blendValue.get("to").asString();
float duration = blendValue.get("duration").asFloat();
data.setMix(from, to , duration);
logger.info("blend: " + from + " -> " + to + " [" + duration + "s]");
}
}
catch (Exception e) {
logger.error("error loading " + fileName + " " + e.getMessage());
}
}
示例11: getDependencies
import com.esotericsoftware.spine.SkeletonData; //导入依赖的package包/类
@Override
public Array<AssetDescriptor> getDependencies(String fileName, FileHandle file, AnimationStateDataLoaderParameter parameter) {
SkeletonDataLoaderParameter skeletonParam = new SkeletonDataLoaderParameter();
skeletonParam.atlasName = parameter.atlasName;
skeletonParam.scale = Env.pixelsToMetres * parameter.scale;
Array<AssetDescriptor> deps = new Array<AssetDescriptor>();
deps.add(new AssetDescriptor(parameter.skeletonName, SkeletonData.class, skeletonParam));
return deps;
}
示例12: Assets
import com.esotericsoftware.spine.SkeletonData; //导入依赖的package包/类
public Assets(String assetFile) {
logger = new Logger(TAG, Env.debugLevel);
logger.info("initialising");
manager = new AssetManager();
// manager.setErrorListener(this);
manager.setLoader(TiledMap.class, new TmxMapLoader(new InternalFileHandleResolver()));
manager.setLoader(PhysicsData.class, new PhysicsLoader(new InternalFileHandleResolver()));
manager.setLoader(SpriteAnimationData.class, new SpriteAnimationLoader(new InternalFileHandleResolver()));
manager.setLoader(SkeletonData.class, new SkeletonDataLoader(new InternalFileHandleResolver()));
manager.setLoader(AnimationStateData.class, new AnimationStateDataLoader(new InternalFileHandleResolver()));
loadGroups(assetFile);
}
示例13: get
import com.esotericsoftware.spine.SkeletonData; //导入依赖的package包/类
private SkeletonData get (FileHandle atlasFile, FileHandle skeletonFile, float scale) {
SkeletonCache cache = skeletonsData.get(skeletonFile);
if (cache == null) {
cache = new SkeletonCache();
skeletonsData.put(skeletonFile, cache);
}
return cache.getData(atlasFile, skeletonFile, scale);
}
示例14: VisSpine
import com.esotericsoftware.spine.SkeletonData; //导入依赖的package包/类
public VisSpine (VisSpine other, SkeletonData skeletonData) {
this.playOnStart = other.playOnStart;
this.defaultAnimation = other.defaultAnimation;
init(skeletonData);
setFlip(other.isFlipX(), other.isFlipY());
}
示例15: init
import com.esotericsoftware.spine.SkeletonData; //导入依赖的package包/类
private void init (SkeletonData skeletonData) {
skeleton = new Skeleton(skeletonData);
stateData = new AnimationStateData(skeletonData);
state = new AnimationState(stateData);
defaultAnimation = skeleton.getData().getAnimations().get(0).getName();
}