const fs=require('fs'); const path=require('path'); const utils=require('./js/spine-utils.js'); const render=require('./js/spine-render.js'); const base='/Users/tianmokeji/Desktop/特效/特效.library/images'; // 找一个有效的 json const j=base+'/MTS9A4QKK0ALE.info/spineboy-pro.json'; const a=utils.discoverAssets(j); if(!a.skeletonPath){console.log('未找到骨骼');process.exit(1);} console.log('使用骨骼:', a.skeletonPath); console.log('图集:', a.atlasPath); (async()=>{ const v=utils.detectVersion(a.skeletonPath); const rd=utils.chooseRuntimeDir(v,a.isBinary); console.log('version:', v, 'runtimeDir:', rd); const spine=render.loadRuntime(rd); const atlas=await render.buildTextureAtlas(spine, fs.readFileSync(a.atlasPath,'utf8'), path.dirname(a.skeletonPath), a.texturePaths); const sd=render.readSkeletonData(spine, a.skeletonPath, atlas, a.isBinary); console.log('动画数量:', sd.animations.length); for(const anim of sd.animations){ console.log(' - '+anim.name+' duration='+anim.duration+'s'); } if(sd.animations[0]){ console.log('第一个动画名:', sd.animations[0].name, ' duration:', sd.animations[0].duration); } })();