Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cc.loader.loadResArray type supports Array #3312

Merged
merged 2 commits into from Oct 11, 2018
Merged

cc.loader.loadResArray type supports Array #3312

merged 2 commits into from Oct 11, 2018

Conversation

@caochao
Copy link

@caochao caochao commented Sep 26, 2018

如图所示
image

从resources目录动态加载龙骨资源时,因为导出文件中其中两个名字相同,仅仅是后缀类型不同。且由于loadResArray第2个参数资源类型Type只能传一个,导致没法批量加载。建议loadResArray第2个参数能传入类型数组。

Copy link
Member

@pandamicro pandamicro left a comment

感谢贡献,请做一下简单的调整,我们会合并

Loading

@@ -581,12 +581,13 @@ proto.loadResArray = function (urls, type, progressCallback, completeCallback) {
var uuids = [];
for (var i = 0; i < urls.length; i++) {
var url = urls[i];
var uuid = this._getResUuid(url, type);
var assetType = (type instanceof Array) ? type[i] : type;
Copy link
Member

@pandamicro pandamicro Sep 29, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议在 for 循环之外做 instanceof Array 判断,缓存结果,在这里复用

Loading

@pandamicro pandamicro changed the title cc.loader.loadResArray类型参数支持数组 cc.loader.loadResArray type supports Array Sep 29, 2018
@jareguo
Copy link
Member

@jareguo jareguo commented Oct 8, 2018

哈罗,在吗? @caochao

Loading

@caochao
Copy link
Author

@caochao caochao commented Oct 10, 2018

好的,调整过的已提交

Loading

@pandamicro pandamicro merged commit ad35dba into cocos-creator:v2.0-release Oct 11, 2018
1 check passed
Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants