Cc. Loader. LoadJson (" res/configs/res. Json ", function (error, data) {
Cc. The log (data);//data by the json object
});
But if there are multiple json file, how to do it at the same time to load and download all files after the callback?
Although constantly nested a load can be fixed number file callback, but always feel bad ~ everyone a great god is there any solution?
CodePudding user response:
Problem solving, and use cc. Loader. The load like this is ok, like:Var jsons=[" res/configs/res. Json ", "res/configs/roles. Json"].
Cc. Loader. The load (jsons,
Function (the result of the count, loadedCount) {
Var percent=(loadedCount/count * 100) | 0;
Percent=Math. Min (percent, 100);
The console. The log (percent + "==================");
}, function () {
The console. The log (333333333333);
});
In the first callback method, the result will be in order to obtain access to the data in the json structure