Helper
Class
Module: cc.AssetManager
Provide some helpful function, it is a singleton. All member can be accessed with cc.assetManager.utils
Index
Methods
decodeUuid
Decode uuid, returns the original uuidgetUuidFromURL
Extract uuid from urlgetUrlWithUuid
Transform uuid to urlisScene
Check if the type of asset is scenenormalize
Normalize 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
base64
String 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
url
String 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
asset
Any asset
normalize
Normalize url, strip './' and '/'
meta | description |
---|---|
Returns | string |
Defined in | cocos2d/core/asset-manager/helper.js:148 |
Parameters
url
string url