Commit 112eb3c0 authored by Chen Jiping's avatar Chen Jiping

feat:调整逻辑,增加引导音频

parent 0ad8a900
......@@ -71,6 +71,7 @@
<tr>
<th>序号</th>
<th>字母</th>
<th>引导音频</th>
<th>音频</th>
<th>操作</th>
</tr>
......@@ -79,6 +80,11 @@
<tr *ngFor="let row of wordTable.data;let j = index">
<td>{{ j+1 }}</td>
<td><input type="text" nz-input [(ngModel)]="row.val" (blur)="save()" maxlength="1"></td>
<td>
<app-audio-recorder [audioUrl]="row.guideAudioUrl"
(audioUploaded)="onAudioUploadSuccess($event, row, 'guideAudioUrl')">
</app-audio-recorder>
</td>
<td>
<app-audio-recorder [audioUrl]="row.audioUrl"
(audioUploaded)="onAudioUploadSuccess($event, row, 'audioUrl')">
......
......@@ -116,6 +116,9 @@ cc.Class({
this._audioResList.push({ url: wordArr[i].audioUrl });
}
if(wordArr[i].guideAudioUrl){
this._audioResList.push({ url: wordArr[i].guideAudioUrl });
}
}
}
......@@ -216,13 +219,15 @@ cc.Class({
this._cantouch = false;
//播放动
//播放动
this.playAni('begin', 0);
const begin = () => {
this.playAni('begin', 0);
this._cantouch = true;
this._canClickCat = true;
this.begin();
}
......@@ -264,15 +269,16 @@ cc.Class({
//有空格,取2 * index节点值
let wordNode = textNode.wordNodeArr[2 * index];
//播放音频
this.playAudioByUrl(word.audioUrl, ()=>{
this.begin(index + 1);
})
this.playAudioByUrl(word.guideAudioUrl, () => {
//播放音频
this.playAudioByUrl(word.audioUrl, ()=>{
//显示文本动画
this.textTwinkle(wordNode);
this.begin(index + 1);
})
//显示文本动画
this.textTwinkle(wordNode);
})
},
maskNode: null,
......@@ -357,19 +363,21 @@ cc.Class({
this._cantouch = false;
const state = this.playAni('begin', 0);
//播放音频
this.playAudioByUrl(wordArr[i].audioUrl, ()=>{
this._cantouch = true;
state.stop();
this.playAni('normal', 0);
})
this.playAudioByUrl(wordArr[i].guideAudioUrl, () => {
//播放音频
this.playAudioByUrl(wordArr[i].audioUrl, ()=>{
//显示文本动画
this.textTwinkle(label);
this._cantouch = true;
state.stop();
this.playAni('normal', 0);
})
//显示文本动画
this.textTwinkle(label);
})
})
//其余字母
......@@ -396,6 +404,25 @@ cc.Class({
let wordArr = this.data.exercises.word2Arr;
const play = () => {
if (!this._cantouch) {
return;
}
this._cantouch = false;
const state = this.playAni('begin', 0);
//播放单词音频
this.playTextAutio(() => {
state.stop();
this.playAni('normal', 0);
});
}
for (let i = 0; i < wordArr.length; ++i) {
if (!wordArr[i].val) {
......@@ -407,12 +434,19 @@ cc.Class({
let label = this.getWord(initial, 80, true);
label.isInitial = true;
wordNodeArr.push(label);
label.addComponent(cc.Button);
label.on('click', () => {
play();
});
//其余字母
let last = wordArr[i].val.substr(1);
let lastLabel = this.getWord(last, 80, false);
wordNodeArr.push(lastLabel);
lastLabel.addComponent(cc.Button);
lastLabel.on('click', () => {
play();
});
}
......@@ -427,6 +461,8 @@ cc.Class({
_showStandby: null,
initBtn() {
this._canClickCat = false;
const catBtn = cc.find('Canvas/Main Camera/catFrame/cat/ClickBtn');
catBtn.addComponent(cc.Button);
......@@ -635,11 +671,6 @@ cc.Class({
}
}, (audioId) => {
//显示完成,不再播放动画
if (this._shown) {
return;
}
//设置可播放动画
this._stopAni = false;
......
......@@ -3,11 +3,13 @@ export const defaultData = {
"wordArr":[
{
"val":"A",
"audioUrl":"http://staging-teach.cdn.ireadabc.com/8b5ecca5d4509e1b8a7e81e69d8db615.mp3"
"audioUrl":"http://staging-teach.cdn.ireadabc.com/8b5ecca5d4509e1b8a7e81e69d8db615.mp3",
"guideAudioUrl":"http://staging-teach.cdn.ireadabc.com/8b5ecca5d4509e1b8a7e81e69d8db615.mp3"
},
{
"val":"a",
"audioUrl":"http://staging-teach.cdn.ireadabc.com/607af37644501e678de6cbafee555948.mp3"
"audioUrl":"http://staging-teach.cdn.ireadabc.com/607af37644501e678de6cbafee555948.mp3",
"guideAudioUrl":"http://staging-teach.cdn.ireadabc.com/8b5ecca5d4509e1b8a7e81e69d8db615.mp3"
}
],
"word2Arr":[
......
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