Commit df2f76a6 authored by liujiangnan's avatar liujiangnan

feeat: 预加载的更改

parent df15648a
...@@ -21,7 +21,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -21,7 +21,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
onLoadEnd() { async onLoadEnd() {
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考 // TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this.initData(); this.initData();
this.initView(); this.initView();
......
...@@ -87,7 +87,7 @@ export class MyCocosSceneComponent extends cc.Component { ...@@ -87,7 +87,7 @@ export class MyCocosSceneComponent extends cc.Component {
preload() { preload() {
const preloadArr = this._imageResList.concat(this._audioResList).concat(this._animaResList); const preloadArr = this._imageResList.concat(this._audioResList).concat(this._animaResList);
cc.assetManager.loadAny(preloadArr, null, null, (err, data) => { cc.assetManager.preloadAny(preloadArr, null, null, async (err, data) => {
if (window && window["air"]) { if (window && window["air"]) {
// window["air"].onCourseInScreen = (next) => { // window["air"].onCourseInScreen = (next) => {
...@@ -95,10 +95,10 @@ export class MyCocosSceneComponent extends cc.Component { ...@@ -95,10 +95,10 @@ export class MyCocosSceneComponent extends cc.Component {
// this.onLoadEnd(); // this.onLoadEnd();
// next(); // next();
// }; // };
this.onLoadEnd(); await this.onLoadEnd();
window["air"].hideAirClassLoading(); window["air"].hideAirClassLoading();
} else { } else {
this.onLoadEnd(); await this.onLoadEnd();
} }
cc.debug.setDisplayStats(false); cc.debug.setDisplayStats(false);
...@@ -110,11 +110,11 @@ export class MyCocosSceneComponent extends cc.Component { ...@@ -110,11 +110,11 @@ export class MyCocosSceneComponent extends cc.Component {
if(node){ if(node){
node.getComponent('middleLayer').log(str); node.getComponent('middleLayer').log(str);
}else{ }else{
cc.log(str); console.log(str);
} }
} }
onLoadEnd() { async onLoadEnd() {
} }
......
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