am making fb instant game and i wonder if there is anyway to show a progress of downloading files when calling cc.director.preloadScene
i found only a way to show a progress of loading scene by this method cc.loader.onProgress
preloadScene(sceneName: string, onProgress?: (completedCount: number, totalCount: number, item: any) => void, onLoaded?: (error: Error, asset: SceneAsset) => void): void;
use onProgress
callback, it can help you to know a progress of scene loading, the same as use cc.loader.load
to load assets.
use it like
var progress = 0;// a progress of scene loading,0 ~ 1;
cc.director.preloadScene('SceneA', (completedCount: number, totalCount: number, item: any) => {
progress = completedCount / totalCount;
}, (error: Error, asset: cc.SceneAsset) => {
//do something after preloaded scene
});