cc.Class({ extends: cc.Component, properties: { AudioArr: { //音频 type: cc.AudioClip, default: [], }, ProgressBar: cc.Sprite, }, // LIFE-CYCLE CALLBACKS: onLoad() { cc.audioEngine.playMusic(this.AudioArr[0]); this.startGame(); }, start() { }, /**开始游戏 */ startGame() { //let bundle = cc.assetManager.getBundle('01_graphics'); this.ProgressBar.node.parent.active = true; //开始加载远程资源 for (let i = 0; i < 100; i++) { this.schedule(function() { //对Sprite组件上的属性修改 this.ProgressBar.fillRange += 0.01; cc.resources.loadDir("assets", (completeCount, totalCount) => { }, () => { cc.director.loadScene('Game'); }); }, (4 / 100) * i); } // cc.resources.loadDir("assets", (completeCount, totalCount) => { // this.ProgressBar.fillRange = completeCount / totalCount; // }, () => { // cc.director.loadScene('Game'); // }); // cc.loader.loadResDir('assets', cc.Asset, (completeCount, totalCount) => { // this.ProgressBar.fillRange = completeCount / totalCount; // }, () => { // cc.director.loadScene('Game'); // }); } // update (dt) {}, });