Commit 95c93499 authored by Tt's avatar Tt

修改

parent 9f6aed56
This diff is collapsed.
...@@ -570,11 +570,13 @@ cc.Class({ ...@@ -570,11 +570,13 @@ cc.Class({
pg.audio.playAudioByUrlCall(this._stageData.sound).then((id) => { pg.audio.playAudioByUrlCall(this._stageData.sound).then((id) => {
audioFinished = true; audioFinished = true;
let time = cc.audioEngine.getDuration(id); let time = cc.audioEngine.getDuration(id);
this.showSliderAction(time).then(() => { this.showCardAction(time + 1).then(() => {
if (aniFinished && audioFinished) { this.showSliderAction(1).then(() => {
this._playing = false; if (aniFinished && audioFinished) {
resolve(''); this._playing = false;
} resolve('');
}
});
}); });
}) })
} else { } else {
...@@ -594,14 +596,16 @@ cc.Class({ ...@@ -594,14 +596,16 @@ cc.Class({
pg.audio.playAudioByUrlCall(this._stageData.sound).then((id) => { pg.audio.playAudioByUrlCall(this._stageData.sound).then((id) => {
audioFinished = true; audioFinished = true;
let time = cc.audioEngine.getDuration(id); let time = cc.audioEngine.getDuration(id);
this.showSliderAction(time).then(() => { this.showCardAction(time + 1).then(() => {
if (aniFinished && audioFinished) { this.showSliderAction(1).then(() => {
this._playing = false; if (aniFinished && audioFinished) {
resolve(''); this._playing = false;
} resolve('');
}); }
});
})
}) })
}, 1000 * 2)); }, 1000));
} }
}); });
}, },
...@@ -696,7 +700,7 @@ cc.Class({ ...@@ -696,7 +700,7 @@ cc.Class({
slider.action = true; slider.action = true;
layout_card.removeAllChildren(); layout_card.removeAllChildren();
layout_normal.removeAllChildren(); layout_normal.removeAllChildren();
layout_card.opacity = 255; layout_card.opacity = 1;
layout_normal.opacity = 0; layout_normal.opacity = 0;
let r = [239, 0, 135]; let r = [239, 0, 135];
let l = [2, 171, 241]; let l = [2, 171, 241];
...@@ -731,11 +735,37 @@ cc.Class({ ...@@ -731,11 +735,37 @@ cc.Class({
laebl.active = true; laebl.active = true;
} }
}) })
layout_card.getComponent(cc.Layout).updateLayout();
setTimeout(() => { setTimeout(() => {
card_bg2.width = layout_card.width; let size = this.node.width;
let lWidth = layout_card.width;
if (lWidth > size - 300) {
layout_card.scale = size / lWidth - 0.05;
}
layout_card.opacity = 255;
// card_bg2.width = layout_card.width;
}, 60); }, 60);
}, },
showCardAction(time) {
return new Promise(async (resolve, reject) => {
let layout_card = cc.find("card_group/layout_card", this.node);
let len = layout_card.children.length
let content = this._stageData.word;
let t = time / content.length;
for (let i = 0; i < len; i++) {
let card = layout_card.children[i];
if (card.name == "add") continue;
await this.cardAction(card, t);
}
return resolve("")
});
},
cardAction(card, time) {
return new Promise((resolve, reject) => {
cc.tween(card).to(time / 2, { scale: 1.1 }).to(time / 2, { scale: 1 }).call(() => { return resolve("") }).start();
});
},
showSliderAction(time) { showSliderAction(time) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let card_group = cc.find("card_group", this.node); let card_group = cc.find("card_group", this.node);
...@@ -756,8 +786,10 @@ cc.Class({ ...@@ -756,8 +786,10 @@ cc.Class({
.to(t, { progress: 0.9 }).call(() => { this.setCardColor(sl.progress); }) .to(t, { progress: 0.9 }).call(() => { this.setCardColor(sl.progress); })
.to(t, { progress: 1 }).call(() => { .to(t, { progress: 1 }).call(() => {
this.setCardColor(sl.progress); this.setCardColor(sl.progress);
this.hideBox(); this._timeoutIds.push(setTimeout(() => {
return resolve("") this.hideBox();
return resolve("")
}, 1000))
}) })
.start(); .start();
}); });
......
...@@ -26,7 +26,15 @@ export const defaultData = { ...@@ -26,7 +26,15 @@ export const defaultData = {
{ {
"card": "le", "card": "le",
"color": 1 "color": 1
} },
{
"card": "pp",
"color": 1
},
{
"card": "le",
"color": 1
},
], ],
"bgImg": "http://staging-teach.cdn.ireadabc.com/97e19da9309e4e5aafca5ea2e9db8f46.png", "bgImg": "http://staging-teach.cdn.ireadabc.com/97e19da9309e4e5aafca5ea2e9db8f46.png",
"wordAudio": "http://staging-teach.cdn.ireadabc.com/ab3538f7d4d57ac1abd740bd32f06b2d.mp3", "wordAudio": "http://staging-teach.cdn.ireadabc.com/ab3538f7d4d57ac1abd740bd32f06b2d.mp3",
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
</div> </div>
</div> </div>
<div> <!-- <div>
<div class="border"> <div class="border">
<div style="width: 100%; align-items:center;"> <div style="width: 100%; align-items:center;">
<div class="item-box" style="width: 50%;height:200px; margin-left: 25%; margin-top: 10%;"> <div class="item-box" style="width: 50%;height:200px; margin-left: 25%; margin-top: 10%;">
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
</div> </div>
</div> </div>
</div> </div> -->
<!-- http://localhost:4200/?type=form <!-- http://localhost:4200/?type=form
一组游戏 一组游戏
一个图片动画 一个图片动画
......
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