Commit 31c655ad authored by Li MingZhe's avatar Li MingZhe

fix: online bug

parent 97b53cba
No preview for this file type
...@@ -184,14 +184,20 @@ cc.Class({ ...@@ -184,14 +184,20 @@ cc.Class({
addServerListener() { addServerListener() {
console.log(' in addServerListener');
const c = window.courseware; const c = window.courseware;
if (!c) { if (!c) {
return; return;
} }
console.log(' in addServerListener 2 : ', this.isTeacher);
if (this.isTeacher) { if (this.isTeacher) {
c.onEvent('show_cap', (data, next) => { c.onEvent('show_cap', (data, next) => {
console.log('in show_cap event', data);
this.showCapAnima(data.index); this.showCapAnima(data.index);
next(); next();
}); });
...@@ -204,6 +210,7 @@ cc.Class({ ...@@ -204,6 +210,7 @@ cc.Class({
}); });
c.onEvent('show_answer', (data, next) => { c.onEvent('show_answer', (data, next) => {
console.log('in show_answer event', data);
this.showStudentPanelLabel(data.isRight); this.showStudentPanelLabel(data.isRight);
next(); next();
}); });
...@@ -516,7 +523,10 @@ cc.Class({ ...@@ -516,7 +523,10 @@ cc.Class({
const resDragonBone = cc.find("Canvas/res/anima/role") const resDragonBone = cc.find("Canvas/res/anima/role")
const role = cc.instantiate(resDragonBone) const role = cc.instantiate(resDragonBone)
role.scale = this._mapScaleMin; role.scale = this._mapScaleMin;
this.layer1.addChild(role, 5);
if (!this.isTeacher) {
this.layer1.addChild(role, 5);
}
this.role = role; this.role = role;
role.x = -500 * this._mapScaleMin; role.x = -500 * this._mapScaleMin;
...@@ -724,6 +734,7 @@ cc.Class({ ...@@ -724,6 +734,7 @@ cc.Class({
this.roleBack(); this.roleBack();
this.setLayer2ByData(); this.setLayer2ByData();
this.hideSpeakIcon();
this.layer1.active = false; this.layer1.active = false;
...@@ -866,9 +877,20 @@ cc.Class({ ...@@ -866,9 +877,20 @@ cc.Class({
showSpeakIcon() { showSpeakIcon() {
if (this.isTeacher) {
return;
}
this.speakIcon.active = true; this.speakIcon.active = true;
this.appear(this.speakIcon, 0.5) this.appear(this.speakIcon, 0.5)
playAudio(this.speakClip); playAudio(this.speakClip);
const tmpBottle = this.curBottle;
this.delayCall(3, () => {
if (tmpBottle == this.curBottle) {
this.hideSpeakIcon();
}
})
}, },
hideSpeakIcon() { hideSpeakIcon() {
...@@ -907,9 +929,9 @@ cc.Class({ ...@@ -907,9 +929,9 @@ cc.Class({
this.initPic(); this.initPic();
this.initTeacherPanel(); this.initTeacherPanel();
this.initStudentPanel(); this.initStudentPanel();
// if (this.isTeacher) { if (this.isTeacher) {
this.initTeacherBtn(); this.initTeacherBtn();
// } }
this.initSpeakIcon(); this.initSpeakIcon();
this.initWrongAndRightAnima(); this.initWrongAndRightAnima();
}, },
......
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