cocos creator 2.09远程加载龙骨
if (cc.find('Canvas/animNode')) {
cc.find('Canvas/animNode').destroy();
}
else {
var animNode = new cc.Node();
animNode.name = 'animNode';
animNode.parent = cc.find('Canvas');
var dragonDisplay = animNode.addComponent(dragonBones.ArmatureDisplay);
var imageUrl = 'https://minigame.61ertongwang.com/resource/mother_skeleton_6_tex.png';
var skeUrl = 'https://minigame.61ertongwang.com/resource/mother_skeleton_6_ske.json';
var atlasUrl = 'https://minigame.61ertongwang.com/resource/mother_skeleton_6_tex.json';
// var imageUrl = 'http://127.0.0.1:5500/assets/resources/Monster/monsterbone001_0_tex.png';
// var skeUrl = 'http://127.0.0.1:5500/assets/resources/Monster/monsterbone001_0_ske.json';
// var atlasUrl = 'http://127.0.0.1:5500/assets/resources/Monster/monsterbone001_0_tex.json';
cc.loader.load(imageUrl, (error, texture) => {
cc.loader.load({ url: atlasUrl, type: 'txt' }, (error, atlasJson) => {
cc.loader.load({ url: skeUrl, type: 'txt' }, (error, dragonBonesJson) => {
var atlas:any = new dragonBones.DragonBonesAtlasAsset();
atlas._uuid = atlasUrl;
atlas.atlasJson = atlasJson;
atlas.texture = texture;
var asset:any = new dragonBones.DragonBonesAsset();
asset._uuid = skeUrl;
asset.dragonBonesJson = dragonBonesJson;
dragonDisplay.dragonAtlasAsset = atlas;
dragonDisplay.dragonAsset = asset;
dragonDisplay.armatureName = 'action_happy';
dragonDisplay.playAnimation('happy', 0);
});
});
});
}