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

feat:

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