Commit 9eb13bc0 authored by 范雪寒's avatar 范雪寒

fix: addServerListener

parent 572ae4f2
......@@ -64,8 +64,8 @@ cc.Class({
getData((data, aspect) => {
console.log('data:', data);
if (window['air']?.airClassInfo?.user?.classRole == 'tea') {
this.isTeacher = true;
}
this.isTeacher = true;
}
this.data = data || this.getDefaultData();
this.data = JSON.parse(JSON.stringify(this.data))
......@@ -117,7 +117,7 @@ cc.Class({
addPreloadImage() {
const arr = this.data.options;
if (arr) {
for (let i=0; i<arr.length; i++) {
for (let i = 0; i < arr.length; i++) {
this._imageResList.push({ url: arr[i].image });
}
}
......@@ -134,47 +134,43 @@ cc.Class({
addServerListener() {
const c = window.courseware;
if (!c) {
return;
}
c.onEvent('course-in-screen', (data, next) => {
window.air.onCourseInScreen = (next) => {
cc.find('Canvas').opacity = 255;
this.showTemplateStartAnima();
this.loadEnd();
next();
});
}
},
showTemplateStartAnima() {
const resDragonBone = cc.find("Canvas/res/anima/pageturn")
const pageturn = cc.instantiate(resDragonBone)
const pageturn = cc.instantiate(resDragonBone)
const canvas = cc.find('Canvas');
canvas.addChild(pageturn, 100);
const dragonDisplay = pageturn.getComponent(dragonBones.ArmatureDisplay);
dragonDisplay.on(dragonBones.EventObject.COMPLETE, () => {
pageturn.removeFromParent();
pageturn.removeFromParent();
})
dragonDisplay.playAnimation('pageturn2', 1);
},
showTemplateEndAnima() {
const resDragonBone = cc.find("Canvas/res/anima/pageturn")
const pageturn = cc.instantiate(resDragonBone)
const pageturn = cc.instantiate(resDragonBone)
const canvas = cc.find('Canvas');
canvas.addChild(pageturn, 100);
const dragonDisplay = pageturn.getComponent(dragonBones.ArmatureDisplay);
dragonDisplay.on(dragonBones.EventObject.COMPLETE, () => {
cc.tween({})
.delay(1)
.call(() => {
if (window && window.courseware && this.isTeacher) {
window.courseware.nextPage();
}
})
.start();
cc.tween({})
.delay(1)
.call(() => {
if (window && window.courseware && this.isTeacher) {
window.courseware.nextPage();
}
})
.start();
})
dragonDisplay.playAnimation('pageturn', 1);
},
......@@ -299,12 +295,12 @@ cc.Class({
if (!window.courseware) {
return;
}
window.courseware.onEvent('clickOption', (data, next) => {
this.showOption(data.data.idx);
window.courseware.onEvent('clickOption', async (data, next) => {
await this.showOption(data.data.idx);
next();
});
window.courseware.onEvent('clickQuestion', (data, next) => {
this.showQuestion();
window.courseware.onEvent('clickQuestion', async (data, next) => {
await this.showQuestion();
next();
});
window.courseware.onEvent('hideOption', (data, next) => {
......@@ -445,7 +441,7 @@ cc.Class({
async showOption(idx) {
console.log("idx:", idx);
const optionNode = cc.find(`Canvas/bg/book/option/option_${idx}`);
if (!optionNode) {
console.log("!optionNode:");
......@@ -592,7 +588,7 @@ cc.Class({
questionNode.hideAction = null;
})
.start();
}
}
},
playAudioByNodeName(name) {
......
{"ios":{"sceneName":"AK09","version":"fcbf3"},"android":{"sceneName":"AK09","version":"fcbf3"}}
\ No newline at end of file
{"ios":{"sceneName":"AK09","version":"2a5a4"},"android":{"sceneName":"AK09","version":"2a5a4"}}
\ No newline at end of file
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