Commit 428c3602 authored by 范雪寒's avatar 范雪寒

feat:

parent ed4ae492
......@@ -7,11 +7,18 @@ const { ccclass, property } = cc._decorator;
export default class SceneComponent extends MyCocosSceneComponent {
addPreloadImage() {
this._imageResList.push({ url: this.data.havePic });
this.data.pageArr.forEach(page => {
this._imageResList.push({ url: page.bgItem.url });
this._imageResList.push({ url: page.startBg });
});
return new Promise<void>((resolve, reject) => {
this._imageResList.push({ url: this.data.havePic });
this.data.pageArr.forEach(page => {
this._imageResList.push({ url: page.bgItem.url });
this._imageResList.push({ url: page.startBg });
});
const bgNode = cc.find('Canvas/bg');
bgNode.color = cc.color(255, 255, 255);
const startBg = this.data.pageArr[this.currentPageIdx].startBg;
this.setNodeSpirteFrameByUrl(startBg, bgNode, resolve);
})
}
async onLoadEnd() {
......@@ -20,6 +27,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.initListener();
await this.startStep1();
this.updateView();
await this.startStep2();
}
......@@ -32,6 +40,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
await this.asyncCountDown(progress, 3);
await asyncDelay(0.3);
await this.checkPage();
this.step = 1;
}
async startStep2() {
await this.asyncPlayAudioByUrl(this.data.pageArr[this.currentPageIdx].hotZoneItemArr[this.currentPartIdx].audio_url);
......
......@@ -69,10 +69,10 @@ export class MyCocosSceneComponent extends cc.Component {
return defaultData;
}
preloadItem() {
this.addPreloadImage();
this.addPreloadAudio();
this.addPreloadAnima();
async preloadItem() {
await this.addPreloadImage();
await this.addPreloadAudio();
await this.addPreloadAnima();
this.preload();
}
......
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