Commit bb533d70 authored by Li MingZhe's avatar Li MingZhe

feat: 喇叭持续播放

parent 0bcbd4be
No preview for this file type
......@@ -203,6 +203,18 @@ cc.Class({
next();
});
c.onEvent('show_speak', (data, next) => {
this.historyData = data.historyData;
this.showSpeakIconLight();
next();
});
c.onEvent('hide_speak', (data, next) => {
this.historyData = data.historyData;
this.hideSpeakIconLight();;
next();
});
} else {
c.onEvent('show_question', (data, next) => {
......@@ -224,6 +236,12 @@ cc.Class({
next();
});
c.onEvent('hide_speak', (data, next) => {
this.historyData = data.historyData;
this.hideSpeakIcon();//;
next();
});
c.onEvent('back_layer', (data, next) => {
this.historyData = data.historyData;
this.backLayer1();
......@@ -276,7 +294,7 @@ cc.Class({
},
reconnect() {
if (!this.historyData.arrData) {
if (!this.historyData || !this.historyData.arrData) {
return;
}
this.data.groupArr = this.historyData.arrData;
......@@ -400,11 +418,67 @@ cc.Class({
// this.initBtn();
// this.showSoundBtn();
this.test();
// this.curBottle = this.bottleArr[0];
// this.changeLayer();
},
engine: null,
test() {
const engineFirstInitDone = () => {
console.log('引擎初始化成功回调 !');
}
const engineBackResultDone = () => {
console.log('引擎返回结果成功回调');
}
const engineBackResultFail = () => {
console.log('引擎返回结果失败回调');
}
const JSSDKNotSupport = () => {
console.log('sdk不支持当前浏览器回调');
}
const params = {
engineFirstInitDone,
engineBackResultDone,
engineBackResultFail,
JSSDKNotSupport,
applicationId: 'a721',
userId: 'guest'
}
this.engine = new window.EngineEvaluat(params)
},
recordStart() {
console.log(' start record')
const params = {
coreType: 'en.word.score',
refText:'word',
precision:0.5
}
const done = () => {
console.log('~~~~~ done');
}
const fail = () => {
console.log('~~~~ fail');
}
this.engine.startRecord(params, done, fail);
},
recordStop() {
console.log(' stop record')
this.engine.stopRecord();
},
initListener() {
......@@ -470,6 +544,8 @@ cc.Class({
canvas.off(cc.Node.EventType.MOUSE_LEAVE, mouseUp)
}
this.removeHtmlTouchEnd();
this.recordStop();
}
const mouseUp = (e) => {
......@@ -635,6 +711,8 @@ cc.Class({
this._curShowItem = role;
this.role.hand.active = false;
playAudio(this.clickClip);
this.recordStart();
})
},
......@@ -974,6 +1052,17 @@ cc.Class({
},
showSpeakIconLight() {
this.speakBtn.opacity = 100;
this.speakBtn.isSHow = true;
},
hideSpeakIconLight() {
this.speakBtn.opacity = 255;
this.speakBtn.isSHow = false;
},
speakTween: null,
showSpeakIcon() {
......@@ -981,18 +1070,22 @@ cc.Class({
return;
}
if (this.speakIcon.active) {
return;
}
this.speakIcon.active = true;
this.appear(this.speakIcon, 0.5)
playAudio(this.speakClip);
if (this.speakTween) {
this.speakTween.stop();
}
this.speakTween = this.delayCall(3, () => {
this.hideSpeakIcon();
this.speakTween = null;
})
// if (this.speakTween) {
// this.speakTween.stop();
// }
// this.speakTween = this.delayCall(3, () => {
// this.hideSpeakIcon();
// this.speakTween = null;
// })
},
hideSpeakIcon() {
......@@ -1191,6 +1284,7 @@ cc.Class({
},
speakBtn: null,
initTeacherBtn() {
const show = getSprNode('btn_show');
show.parent = this.teacherPanel;
......@@ -1206,14 +1300,19 @@ cc.Class({
})
const speak = getSprNode('btn_speak');
this.speakBtn = speak;
speak.parent = this.studentPanel;
speak.x = -this.studentPanel.width / 2 + speak.width / 2 + 28;
speak.y = this.studentPanel.height / 2 + 2;
this.addBtnClickFunc(speak, () => {
this.showBtnAnima(speak);
this.showSpeakIcon();
// this.showSpeakIcon();
this.sendServerEvent('show_speak', {})
if (speak.isShow) {
this.sendServerEvent('hide_speak', {})
} else {
this.sendServerEvent('show_speak', {})
}
})
let offX = -20 * this._mapScaleMin;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"ver": "1.0.8",
"uuid": "d5071406-7fdf-432c-a9b3-4a7cbcd2e18a",
"isPlugin": true,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
No preview for this file type
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