Helper Class
Module: cc.AssetManager
Provide some helpful function, it is a singleton. All member can be accessed with cc.assetManager.utils
Index
Methods
decodeUuidDecode uuid, returns the original uuidgetUuidFromURLExtract uuid from urlgetUrlWithUuidTransform uuid to urlisSceneCheck if the type of asset is scenenormalizeNormalize url, strip './' and '/'
Details
Methods
decodeUuid
Decode uuid, returns the original uuid
| meta | description |
|---|---|
| Returns | String |
| Defined in | cocos2d/core/asset-manager/helper.js:42 |
Parameters
base64String the encoded uuid
Examples
var uuid = 'fcmR3XADNLgJ1ByKhqcC5Z';
var originalUuid = decodeUuid(uuid); // fc991dd7-0033-4b80-9d41-c8a86a702e59
getUuidFromURL
Extract uuid from url
| meta | description |
|---|---|
| Returns | String |
| Defined in | cocos2d/core/asset-manager/helper.js:62 |
Parameters
urlString url
Examples
var url = 'assets/main/import/fc/fc991dd7-0033-4b80-9d41-c8a86a702e59.json';
var uuid = getUuidFromURL(url); // fc991dd7-0033-4b80-9d41-c8a86a702e59
getUrlWithUuid
Transform uuid to url
| meta | description |
|---|---|
| Returns | string |
| Defined in | cocos2d/core/asset-manager/helper.js:91 |
Parameters
Examples
// json path, 'assets/main/import/fc/fc991dd7-0033-4b80-9d41-c8a86a702e59.json';
var url = getUrlWithUuid('fcmR3XADNLgJ1ByKhqcC5Z', {isNative: false});
// png path, 'assets/main/native/fc/fc991dd7-0033-4b80-9d41-c8a86a702e59.png';
var url = getUrlWithUuid('fcmR3XADNLgJ1ByKhqcC5Z', {isNative: true, nativeExt: '.png'});
isScene
Check if the type of asset is scene
| meta | description |
|---|---|
| Returns | boolean |
| Defined in | cocos2d/core/asset-manager/helper.js:130 |
Parameters
assetAny asset
normalize
Normalize url, strip './' and '/'
| meta | description |
|---|---|
| Returns | string |
| Defined in | cocos2d/core/asset-manager/helper.js:148 |
Parameters
urlstring url