Commit b2554be0 authored by liujiangnan's avatar liujiangnan

debug

parent f5dceaa0
...@@ -35,23 +35,26 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -35,23 +35,26 @@ export default class SceneComponent extends MyCocosSceneComponent {
async startStep1() { async startStep1() {
await this.asyncPlayAudioByUrl(this.data.pageArr[this.currentPageIdx].startAudio); await this.asyncPlayAudioByUrl(this.data.pageArr[this.currentPageIdx].startAudio);
await asyncDelay(0.3); await asyncDelay(0.3);
const circle = cc.find('Canvas/step1/pad/circle'); const circulate = async () => {
circle.active = true; const circle = cc.find('Canvas/step1/pad/circle');
const progress = cc.find('Canvas/step1/pad/circle/progress'); circle.active = true;
const bar = progress.getComponent(cc.ProgressBar); const progress = cc.find('Canvas/step1/pad/circle/progress');
bar.progress = 1; const bar = progress.getComponent(cc.ProgressBar);
try { bar.progress = 1;
await Promise.all([ try {
this.asyncCountDown(progress, 3), await Promise.race([
this.checkPage() this.asyncCountDown(progress, 3),
]); this.checkPage()
this.step = 1; ]);
} catch (error) { this.step = 1;
// TODO 三秒内没有检测到对应页码的后续处理; 先加个提示框然后重新检测 } catch (error) {
this.showTips(`未检测到对应页面`); this.showTips(`未检测到对应页面`);
circle.active = false; circle.active = false;
await this.startStep1(); await circulate();
}
} }
await circulate();
} }
async startStep2() { async startStep2() {
await Promise.all([ await Promise.all([
...@@ -80,7 +83,10 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -80,7 +83,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
// 定时三秒检测 // 定时三秒检测
const timeout = new Promise((resolve, reject) => { const timeout = new Promise((resolve, reject) => {
setTimeout(() => reject(new Error('checkpage timeout')), 3000) setTimeout(() => {
window["courseware"].closeOsmoFingerRead();
reject(new Error('checkpage timeout'));
}, 2800)
}); });
const pageId = this.data.pageArr[this.currentPageIdx].pageIdx; const pageId = this.data.pageArr[this.currentPageIdx].pageIdx;
......
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