Commit deb21346 authored by liujiangnan's avatar liujiangnan

feat: 未创建的页面处理

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