Helper Class

Module: cc.AssetManager

Provide some helpful function, it is a singleton. All member can be accessed with cc.assetManager.utils

Index

Methods

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
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
  • uuid string The uuid of asset
  • options Object Some optional parameters
    • isNative Boolean Indicates whether the path you want is a native resource path
    • nativeExt string Extension of the native resource path, it is required when isNative is true
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

results matching ""

    No results matching ""