Commit deb21346 authored by liujiangnan's avatar liujiangnan

feat: 未创建的页面处理

parent 0c730d0d
......@@ -40,6 +40,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
if (this.currentIndex !==0) {
cc.find(`Canvas/bg/L1`).x = -4000;
}
cc.find(`Canvas/bg/right`).active = this.currentIndex < 4;
cc.find(`Canvas/bg/left`).active = this.currentIndex > 0;
const middleLayer = cc.find('middleLayer');
if (!middleLayer) {
......@@ -69,18 +71,23 @@ export default class SceneComponent extends MyCocosSceneComponent {
});
const ballData = JSON.parse(classDataStr).rows;
ballData.forEach((data, idx) => {
if (idx >= 5) {
console.warn('idx >= 5');
return;
}
for (let _index=0; _index<5; _index++) {
const data = ballData[_index];
const idx = _index;
const level = cc.find(`Canvas/bg/L${idx+1}`);
data.children.forEach((book, i) => {
if (i >= 3) {
console.warn('book >= 3');
return;
if (!data) {
cc.find(`book${1}`, level).active = false;
cc.find(`book${2}`, level).active = false;
cc.find(`book${3}`, level).active = false;
continue;
}
for (let j=0; j<3; j++) {
const book = data.children[j];
if (!book) {
cc.find(`book${j+1}`, level).active = false;
continue;
}
const bookNode = cc.find(`book${i+1}`, level);
const bookNode = cc.find(`book${j+1}`, level);
bookNode.attr({syllabus_id: book.id, pid: book.pid});
buttonOnClick(bookNode, async () => {
......@@ -107,8 +114,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
jumpToCourseWare(row.id);
}
});
});
});
}
}
// 播放背景音乐
cc.audioEngine.stopMusic();
......
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