CocosCreator UILoader 升级了

UILoader 2.x 版本

作者 本例 使用的 creater 版本是 2.0.6 版本。 欢迎大家下载测试。

获取当前缓存了多少资源数

bb.UILoader.getCacheCount(): number;

加载资源

bb.UILoader.loadRes(url: string, type: typeof cc.Asset, callback: Function): void

加载静态资源

bb.UILoader.loadStaticRes(url: string, type: typeof cc.Asset, tag: string, callback: Function): void;

加载一组资源

bb.UILoader.loadResArr(paths: Array<string>, callfun: Function);

加载音频资源

bb.UILoader.loadAudioClip(path: string, callfun: Function);

加载一组静态资源

bb.UILoader.loadStaticResArr(paths: Array<string>, tag: string, callfun: Function)

加载 SpriteFrame 资源

bb.UILoader.loadSpriteFrame(path: string, callfun: Function, retainRes: boolean = false)

加载一组 SpriteFrame 资源

bb.loadSpriteFrames(paths: Array<string>, callfun: Function, retainRes: boolean = false)

释放静态资源

bb.UILoader.releaseStaticRes(tag: string): void

释放音乐资源

bb.UILoader.releaseMusicRes(res: string): void

缓存资源 引用计数 +1

bb.UILoader.retatinRes(res: string);

缓存一组资源 引用计数 +1

bb.UILoader.retainArrayRes(res: string[]);

对节点进行引用计数 +1

bb.UILoader.retainNodeRes(node: cc.Node);

对节点进行引用计数 -1

bb.UILoader.releaseNodeRes(node: cc.Node);

释放资源 引用计数 -1

bb.UILoader.releaseRes(res: string);

释放资源 引用计数 -1

bb.UILoader.releaseArrayRes(res: string[]);

更新 sprite 纹理

bb.UILoader.updateSpriteTexture(target: cc.Node, spriteFrame: cc.SpriteFrame): void;

更新 button 纹理

bb.UILoader.updateButtonTexture(target: cc.Node, normalSprite?: cc.SpriteFrame, pressedSprite?: cc.SpriteFrame, hoverSprite?: cc.SpriteFrame, disabledSprite?: cc.SpriteFrame);

回收内存资源

bb.UILoader.gc();

收集更多星星,有更多干货爆料

获取最新资讯,请关注【游戏讲坛】微信公众号

附上开源地址

6赞

mark

插件商店没有找到

1.9.3 使用有什么问题吗楼主

牛鼻这个!