Commit b2554be0 authored by liujiangnan's avatar liujiangnan

debug

parent f5dceaa0
...@@ -35,24 +35,27 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -35,24 +35,27 @@ 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 circulate = async () => {
const circle = cc.find('Canvas/step1/pad/circle'); const circle = cc.find('Canvas/step1/pad/circle');
circle.active = true; circle.active = true;
const progress = cc.find('Canvas/step1/pad/circle/progress'); const progress = cc.find('Canvas/step1/pad/circle/progress');
const bar = progress.getComponent(cc.ProgressBar); const bar = progress.getComponent(cc.ProgressBar);
bar.progress = 1; bar.progress = 1;
try { try {
await Promise.all([ await Promise.race([
this.asyncCountDown(progress, 3), this.asyncCountDown(progress, 3),
this.checkPage() this.checkPage()
]); ]);
this.step = 1; this.step = 1;
} catch (error) { } catch (error) {
// TODO 三秒内没有检测到对应页码的后续处理; 先加个提示框然后重新检测
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([
this.asyncPlayAudioByUrl(this.data.pageArr[this.currentPageIdx].hotZoneItemArr[this.currentPartIdx].audio_url), this.asyncPlayAudioByUrl(this.data.pageArr[this.currentPageIdx].hotZoneItemArr[this.currentPartIdx].audio_url),
...@@ -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