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

feat:

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