Commit c30f1a6c authored by 范雪寒's avatar 范雪寒

fix: 重音问题

parent eef99449
...@@ -30,15 +30,6 @@ cc.Class({ ...@@ -30,15 +30,6 @@ cc.Class({
} }
}, },
log(str) {
const middleLayerNode = cc.find('middleLayer')
if (middleLayerNode) {
middleLayerNode.getComponent('middleLayer').log(str);
} else {
console.log(str);
}
},
onTouchEnd(event) { onTouchEnd(event) {
this.scheduleOnce(() => { this.scheduleOnce(() => {
if (GameData._isPageTurning) { if (GameData._isPageTurning) {
...@@ -179,7 +170,7 @@ cc.Class({ ...@@ -179,7 +170,7 @@ cc.Class({
this.dragonBone.node.scale = bgHeight / size.height; this.dragonBone.node.scale = bgHeight / size.height;
} }
} }
console.log( this.dragonBone.node.scale) console.log(this.dragonBone.node.scale)
mask.width = this.dragonBone.node.scale * size.width; mask.width = this.dragonBone.node.scale * size.width;
mask.height = this.dragonBone.node.scale * size.height; mask.height = this.dragonBone.node.scale * size.height;
...@@ -222,16 +213,30 @@ cc.Class({ ...@@ -222,16 +213,30 @@ cc.Class({
} }
}, },
async asyncDelay(time) {
return new Promise((resolve, reject) => {
cc.tween(this.node)
.delay(time)
.call(() => {
resolve();
})
.start();
});
},
playAudio() { playAudio() {
// this.data.shortAudio_url = 'http://127.0.0.1/iamflying.mp3'; // this.data.shortAudio_url = 'http://127.0.0.1/iamflying.mp3';
cc.assetManager.loadRemote(this.data.shortAudio_url, null, (err, clip) => { cc.assetManager.loadRemote(this.data.shortAudio_url, null, async (err, clip) => {
this.audioID = cc.audioEngine.play(clip, false, 1); this.audioID = cc.audioEngine.play(clip, false, 1);
await asyncDelay(0.01);
this.audioDuration = cc.audioEngine.getDuration(this.audioID); this.audioDuration = cc.audioEngine.getDuration(this.audioID);
this.textDuration = this.audioDuration / this.layoutText.childrenCount; this.textDuration = this.audioDuration / this.layoutText.childrenCount;
this.textIndex = 0; this.textIndex = 0;
if (this.textDuration == -1) { await asyncDelay(0.01);
this.textDuration = 1; if (this.textDuration <= 0) {
this.textDuration = 1
} }
this.schedule(this.chengeTextColor, this.textDuration, this.layoutText.childrenCount, 0.01) this.schedule(this.chengeTextColor, this.textDuration, this.layoutText.childrenCount, 0.01)
...@@ -308,5 +313,13 @@ cc.Class({ ...@@ -308,5 +313,13 @@ cc.Class({
.start() .start()
}, },
log(str) {
const middleLayerNode = cc.find('middleLayer');
if (middleLayerNode) {
middleLayerNode.getComponent('middleLayer').log(str);
}
console.log(str);
},
// update (dt) {}, // update (dt) {},
}); });
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