Commit 29638ee1 authored by asdf's avatar asdf

骨骼播放第一个动画,背景音乐降低声音

parent 698cc0e8
...@@ -68,9 +68,9 @@ cc.Class({ ...@@ -68,9 +68,9 @@ cc.Class({
var imageUrl = this.data.tex_png; var imageUrl = this.data.tex_png;
var skeUrl = this.data.ske_json; var skeUrl = this.data.ske_json;
var atlasUrl = this.data.tex_json; var atlasUrl = this.data.tex_json;
// imageUrl = 'http://127.0.0.1/walkingfish_tex.png'; imageUrl = 'http://127.0.0.1/walkingfish_tex.png';
// skeUrl = 'http://127.0.0.1/walkingfish_ske.json'; skeUrl = 'http://127.0.0.1/walkingfish_ske.json';
// atlasUrl = 'http://127.0.0.1/walkingfish_tex.json'; atlasUrl = 'http://127.0.0.1/walkingfish_tex.json';
cc.assetManager.loadAny([{ url: atlasUrl, ext: '.txt' }, { url: skeUrl, ext: '.txt' }], (error, assets) => { cc.assetManager.loadAny([{ url: atlasUrl, ext: '.txt' }, { url: skeUrl, ext: '.txt' }], (error, assets) => {
if (error) { if (error) {
console.log(error) console.log(error)
...@@ -92,8 +92,12 @@ cc.Class({ ...@@ -92,8 +92,12 @@ cc.Class({
this.dragonBone.dragonAtlasAsset = atlas; this.dragonBone.dragonAtlasAsset = atlas;
this.dragonBone.dragonAsset = asset; this.dragonBone.dragonAsset = asset;
let data = asset._dragonBonesJsonData.armature[0];
this.dragonBone.armatureName = 'Armature'; if(!data){
return;
}
this.dragonBone.armatureName = data.name;
this.animationName = data.animation[0].name;
} }
}); });
} }
...@@ -190,7 +194,7 @@ cc.Class({ ...@@ -190,7 +194,7 @@ cc.Class({
this.stopSpine(); this.stopSpine();
}, },
playSpine() { playSpine() {
this.dragonBone.playAnimation('normal', 1); this.dragonBone.playAnimation(this.animationName, 1);
}, },
stopSpine() { stopSpine() {
this.loadSpine(); this.loadSpine();
......
...@@ -202,7 +202,7 @@ cc.Class({ ...@@ -202,7 +202,7 @@ cc.Class({
return; return;
} }
cc.assetManager.loadRemote(this.data.contentObj.bgm_url, null, (err, clip) => { cc.assetManager.loadRemote(this.data.contentObj.bgm_url, null, (err, clip) => {
this.bgAudioId = cc.audioEngine.play(clip, true, 1); this.bgAudioId = cc.audioEngine.play(clip, true, 0.5);
}); });
}, },
stopBgm() { stopBgm() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment