Commit 1d9bce0e authored by linzhiguo's avatar linzhiguo

+ 框架统计答案

parent 540e7d98
...@@ -280,6 +280,8 @@ cc.Class({ ...@@ -280,6 +280,8 @@ cc.Class({
this._flyswatter.y = pos.y; this._flyswatter.y = pos.y;
this._touched = false; this._touched = false;
playDragonBoneAnimation(this._flyswatter.children[0], 'normal'); playDragonBoneAnimation(this._flyswatter.children[0], 'normal');
let astr = this.flyVirus[i]._text.string;
item._dizzy_ani = cc.tween(this._flyswatter) item._dizzy_ani = cc.tween(this._flyswatter)
//.delay(0.2) //.delay(0.2)
.call(()=>{ .call(()=>{
...@@ -290,6 +292,7 @@ cc.Class({ ...@@ -290,6 +292,7 @@ cc.Class({
} }
if (i != this._correct_index){ if (i != this._correct_index){
console.log('hit err'); console.log('hit err');
this.sendAnswer(astr);
playDragonBoneAnimation(item, 'dizzy', 1, ()=>{ playDragonBoneAnimation(item, 'dizzy', 1, ()=>{
playDragonBoneAnimation(item, 'normal', -1); playDragonBoneAnimation(item, 'normal', -1);
...@@ -304,6 +307,8 @@ cc.Class({ ...@@ -304,6 +307,8 @@ cc.Class({
} }
else{ else{
console.log('hit ok'); console.log('hit ok');
this.sendAnswer(astr, true);
this._can_hitted = false; this._can_hitted = false;
this.fallCare(); this.fallCare();
...@@ -391,6 +396,7 @@ cc.Class({ ...@@ -391,6 +396,7 @@ cc.Class({
.to(this._current_time, {x: 0}) .to(this._current_time, {x: 0})
.call(()=>{ .call(()=>{
this.flyOut(); this.flyOut();
this.sendAnswer();
}) })
.start(); .start();
...@@ -437,7 +443,15 @@ cc.Class({ ...@@ -437,7 +443,15 @@ cc.Class({
this._index = 0; this._index = 0;
}, },
getTime(){
var date = new Date();
return date.getTime();
},
updateItem(){ updateItem(){
this._startTime = this.getTime();
console.log(this._startTime);
this._tapped = false; this._tapped = false;
this._time_node.x = this._time; this._time_node.x = this._time;
...@@ -540,6 +554,16 @@ cc.Class({ ...@@ -540,6 +554,16 @@ cc.Class({
} }
}, },
sendAnswer(answer="", isRight = false){
if (window && window.courseware) {
if (window.courseware.sendAnwser)
window.courseware.sendAnwser(answer, isRight, this._startTime);
else if (window.courseware.sendAnswer){
window.courseware.sendAnswer(answer, isRight, this._startTime);
}
}
},
flyIn(cb){ flyIn(cb){
this.flyVirus[0].active = true; this.flyVirus[0].active = true;
this.flyVirus[1].active = true; this.flyVirus[1].active = true;
......
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