Commit f5dceaa0 authored by liujiangnan's avatar liujiangnan

feat: 进度条

parent 46d72cee
...@@ -38,6 +38,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -38,6 +38,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
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);
bar.progress = 1;
try { try {
await Promise.all([ await Promise.all([
this.asyncCountDown(progress, 3), this.asyncCountDown(progress, 3),
...@@ -46,9 +48,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -46,9 +48,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.step = 1; this.step = 1;
} catch (error) { } catch (error) {
// TODO 三秒内没有检测到对应页码的后续处理; 先加个提示框然后重新检测 // TODO 三秒内没有检测到对应页码的后续处理; 先加个提示框然后重新检测
const bar = progress.getComponent(cc.ProgressBar); this.showTips(`未检测到对应页面`);
this.showTips(`未检测到对应页面 ${bar.progress}`);
bar.progress = 1;
circle.active = false; circle.active = false;
await this.startStep1(); await this.startStep1();
} }
...@@ -80,7 +80,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -80,7 +80,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
// 定时三秒检测 // 定时三秒检测
const timeout = new Promise((resolve, reject) => { const timeout = new Promise((resolve, reject) => {
this.schedule(() => reject(new Error('checkpage timeout')), 3000) setTimeout(() => reject(new Error('checkpage timeout')), 3000)
}); });
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