代码如下,对场景进行加载,相关进度为p(0-1)。
cc.director.preloadScene(sceneName,(completedCount, totalCount, item) => {
let p = completedCount/totalCount;
//this.progress.progress = p;
//this.text.string = parseInt(p*100+"") + '%';
//this.text.string="加载中:"+parseInt(p*100+"")+"%"
// 打印观察
//console.log(this.text.string);
},
() => {
cc.director.loadScene(sceneName);
//this.background.active=false;
// this.scheduleOnce(()=>{
// this.background.active=false;
//},0.5)
}
);