参考了论坛里的这个帖子 https://forum.cocos.com/t/load/69116 但是加载完成并没有显示出来 也没有报任何的错误
creator的版本是:2.0.9最新版
平台是:web(用的加载本地服务器资源)模拟器(加载可写路径下资源)
测试了上述2种情况,都是一样的效果,没有报错,不显示
具体代码如下:
var dragonDisplay = cc.find(“Canvas/animNode”).getComponent(dragonBones.ArmatureDisplay);
// var image = jsb.fileUtils.getWritablePath() + 'DragonBones/敲冰块淘淘_tex.png';
// var ske = jsb.fileUtils.getWritablePath() + 'DragonBones/敲冰块淘淘_ske.json';
// var atlas = jsb.fileUtils.getWritablePath() + 'DragonBones/敲冰块淘淘_tex.json';
var image = 'http://10.10.39.8:3000/appDemo/DragonBones/敲冰块淘淘_tex.png';
var ske = 'http://10.10.39.8:3000/appDemo/DragonBones/敲冰块淘淘_ske.json';
var atlas = 'http://10.10.39.8:3000/appDemo/DragonBones/敲冰块淘淘_tex.json';
cc.loader.load(image, (error, texture) => {
cc.loader.load({ url: atlas, type: 'txt' }, (error, atlasJson) => {
cc.loader.load({ url: ske, type: 'txt' }, (error, dragonBonesJson) => {
var atlas = new dragonBones.DragonBonesAtlasAsset();
atlas.atlasJson = atlasJson;
atlas.texture = texture;
var asset = new dragonBones.DragonBonesAsset();
asset.dragonBonesJson = dragonBonesJson;
dragonDisplay.dragonAtlasAsset = atlas;
dragonDisplay.dragonAsset = asset;
// console.log(atlas);
// console.log(asset);
console.log(dragonDisplay);
console.log(temp == dragonDisplay);
dragonDisplay.armatureName = 'armatureName';
dragonDisplay.playAnimation('idle',0);
});
});
});
有做过这部分的大佬帮帮忙