Commit 1853fd32 authored by 范雪寒's avatar 范雪寒

feat:

parent bb8de8e6
...@@ -149,24 +149,22 @@ cc.Class({ ...@@ -149,24 +149,22 @@ cc.Class({
this.loadSpriteByUrl(bg, this.data.bgItem.url, () => { this.loadSpriteByUrl(bg, this.data.bgItem.url, () => {
bg.scale = Math.min((canvas.width / bg.width), (canvas.height / bg.height)); bg.scale = Math.min((canvas.width / bg.width), (canvas.height / bg.height));
this.itemList = []; this.itemList = this.data.hotZoneItemArr.map(async itemData => await this.createItem(itemData, bg));
this.data.hotZoneItemArr.forEach(async itemData => { this.itemList.forEach(item => {
const item = await this.createItem(itemData, bg);
item.on('click', () => { item.on('click', () => {
playAudioByUrl(itemData.audio_url);
const time = 0.05;
item.clicked = true; item.clicked = true;
if (this.itemList.every(item => item.clicked)) { if (this.itemList.every(tmpItem => tmpItem.clicked)) {
this.coolCatSpeakEnd(); this.coolCatSpeakEnd();
} }
playAudioByUrl(itemData.audio_url);
const time = 0.05;
cc.tween(item) cc.tween(item)
.to(time, { angle: 10 }) .to(time, { angle: 10 })
.to(time * 2, { angle: -10 }) .to(time * 2, { angle: -10 })
.to(time, { angle: 0 }) .to(time, { angle: 0 })
.start(); .start();
}); });
this.itemList.push(item); })
});
}); });
}, },
......
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