Commit 595be320 authored by 章红平's avatar 章红平

提示信息

parent b2c8c214
...@@ -744,7 +744,7 @@ ...@@ -744,7 +744,7 @@
"__id__": 10 "__id__": 10
}, },
"_enabled": true, "_enabled": true,
"alignMode": 1, "alignMode": 2,
"_target": null, "_target": null,
"_alignFlags": 9, "_alignFlags": 9,
"_left": 20, "_left": 20,
......
...@@ -96,11 +96,11 @@ export default class cake_class_1 extends MyCocosSceneComponent { ...@@ -96,11 +96,11 @@ export default class cake_class_1 extends MyCocosSceneComponent {
.to(0.3, { x: -550 }) .to(0.3, { x: -550 })
.start(); .start();
} }
moveOutCandle1(cb=null) { moveOutCandle1(cb = null) {
cc.tween(this.candle1) cc.tween(this.candle1)
.to(0.3, { x: -850 }) .to(0.3, { x: -850 })
.call(()=>{ .call(() => {
if(cb)cb(); if (cb) cb();
}) })
.start(); .start();
} }
...@@ -143,7 +143,7 @@ export default class cake_class_1 extends MyCocosSceneComponent { ...@@ -143,7 +143,7 @@ export default class cake_class_1 extends MyCocosSceneComponent {
} }
startTalking() { startTalking() {
console.log("startText:", this.data.questions[this.questionIndex].text) console.log("startText:", this.data.questions[this.questionIndex].text)
if ((<any>window).courseware&&(<any>window).courseware.stopTest) { if ((<any>window).courseware && (<any>window).courseware.stopTest) {
(<any>window).courseware.startTest(this.data.questions[this.questionIndex].text); (<any>window).courseware.startTest(this.data.questions[this.questionIndex].text);
} }
this.talking = true; this.talking = true;
...@@ -157,28 +157,38 @@ export default class cake_class_1 extends MyCocosSceneComponent { ...@@ -157,28 +157,38 @@ export default class cake_class_1 extends MyCocosSceneComponent {
this.initRedBtn(); this.initRedBtn();
this.moveOutCandle2(); this.moveOutCandle2();
this.nowPanel.showBlock(); this.nowPanel.showBlock();
if ((<any>window).courseware&&(<any>window).courseware.stopTest) { let fail = () => {
(<any>window).courseware.stopTest((res) => { this.answerList[this.questionIndex] = -1
res=JSON.parse(res) this.stickers.changOneSticker(this.questionIndex, false)
console.log("res=========",res.scores,res.result)
if(res.result.overall>=80){
console.log("语音测评成功")
this.answerList[this.questionIndex]=1
this.stickers.changOneSticker(this.questionIndex,true)
this.nowPanel.showResult(true)
}else{
console.log("语音测评失败")
this.answerList[this.questionIndex]=-1
this.stickers.changOneSticker(this.questionIndex,false)
this.nowPanel.showResult(false)
}
})
}else{
this.answerList[this.questionIndex]=-1
this.nowPanel.showResult(false) this.nowPanel.showResult(false)
this.stickers.changOneSticker(this.questionIndex,false) }
// let stopTestOut=setTimeout(()=>{
// },3000)
let timeOut=false;
if ((<any>window).courseware && (<any>window).courseware.stopTest) {
let stopTestOut=setTimeout(()=>{
timeOut=true;
fail();
},3000);
(<any>window).courseware.stopTest((res) => {
if(!timeOut){
clearTimeout(stopTestOut);
res = JSON.parse(res)
console.log("res=========", res.scores, res.result)
if (res.result.overall >= 80) {
console.log("语音测评成功")
this.answerList[this.questionIndex] = 1
this.stickers.changOneSticker(this.questionIndex, true)
this.nowPanel.showResult(true)
} else {
fail();
}
}
})
} else {
fail();
} }
this.clearTimeouts() this.clearTimeouts()
} }
...@@ -187,9 +197,9 @@ export default class cake_class_1 extends MyCocosSceneComponent { ...@@ -187,9 +197,9 @@ export default class cake_class_1 extends MyCocosSceneComponent {
this.initData();; this.initData();;
this.initListener(); this.initListener();
} }
dataCallBack(){ dataCallBack() {
super.dataCallBack(); super.dataCallBack();
this.stickers.node.active = false; this.stickers.node.active = false;
this.nowPanel = this.addPanel() this.nowPanel = this.addPanel()
cc.find("bg/topTittle", this.node).getComponentInChildren(cc.Label).string = this.data.title; cc.find("bg/topTittle", this.node).getComponentInChildren(cc.Label).string = this.data.title;
...@@ -244,8 +254,8 @@ export default class cake_class_1 extends MyCocosSceneComponent { ...@@ -244,8 +254,8 @@ export default class cake_class_1 extends MyCocosSceneComponent {
changeFalse(timeOut = false) { changeFalse(timeOut = false) {
this.clearTimeouts(); this.clearTimeouts();
this.answering = false; this.answering = false;
this.answerList[this.questionIndex]=-1 this.answerList[this.questionIndex] = -1
this.stickers.changOneSticker(this.questionIndex,false); this.stickers.changOneSticker(this.questionIndex, false);
this.nowPanel.failPicesAction(timeOut); this.nowPanel.failPicesAction(timeOut);
console.log("选择错误") console.log("选择错误")
...@@ -315,29 +325,29 @@ export default class cake_class_1 extends MyCocosSceneComponent { ...@@ -315,29 +325,29 @@ export default class cake_class_1 extends MyCocosSceneComponent {
} }
} }
nextQuestion(){ nextQuestion() {
if( this.questionIndex<(this.data.questions.length-1)){ if (this.questionIndex < (this.data.questions.length - 1)) {
this.questionIndex++; this.questionIndex++;
this.nextPanel=this.addPanel(); this.nextPanel = this.addPanel();
this.nextPanel.node.x= this.nextPanel.node.width; this.nextPanel.node.x = this.nextPanel.node.width;
cc.tween(this.nowPanel.node) cc.tween(this.nowPanel.node)
.to(1,{x:-this.nowPanel.node.width}) .to(1, { x: -this.nowPanel.node.width })
.call((e)=>{ .call((e) => {
console.log("e=====",e) console.log("e=====", e)
e.destroy(); e.destroy();
}) })
.start(); .start();
this.nowPanel=this.nextPanel; this.nowPanel = this.nextPanel;
this.answerList[this.questionIndex] = 0; this.answerList[this.questionIndex] = 0;
this.updateUi() this.updateUi()
this.showPanel(); this.showPanel();
cc.tween(this.nowPanel.node) cc.tween(this.nowPanel.node)
.to(1,{x:0}) .to(1, { x: 0 })
.call(()=>{ .call(() => {
}) })
.start(); .start();
}else{ } else {
this.nowPanel.over(this.answerList) this.nowPanel.over(this.answerList)
} }
......
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