Cocos Creator API

1.0.0

Cocos Creator is a highly customizable game development tool that utilizes the power of cocos2d-x.

AssetLibrary

Module: cc

The asset library which managing loading/unloading assets in project.

Properties

_uuidToAsset object private

Caches uuid to all loaded assets in scenes.

There are no properties that match your current filter settings. You can change your filter settings in the index section on this page. index

Methods

loadAsset
(
  • uuid
  • callback
  • options
)
private

name type description
uuid String
callback LoadCallback

the callback function once load finished

  • error String

    null or the error info

  • data Asset

    the loaded asset or null

options Object
  • readMainCache Boolean

    Default is true. If false, the asset and all its depends assets will reload and create new instances from library.

  • writeMainCache Boolean

    Default is true. If true, the result will cache to AssetLibrary, and MUST be unload by user manually.

  • existingAsset Asset

    load to existing asset, this argument is only available in editor

  • deserializeInfo deserialize.Details

    specified a DeserializeInfo object if you want, this parameter is only available in editor.

queryAssetInfo
(
  • uuid
  • callback
)

name type description
uuid String
callback Function
  • error Error
  • url String

    the url of raw asset or imported asset

  • raw Boolean

    indicates whether the asset is raw asset

  • ctorInEditor Function

    the actual type of asset, used in editor only

_loadAssetByUuid
(
  • item
  • callback
)
private

name type description
item Object

loading item including uuid, type and extra infos

callback LoadCallback

the callback to receive the asset, can be null

  • error String

    null or the error info

  • data Asset

    the loaded asset or null

loadJson
(
  • json
  • callback
)
LoadingHandle private

name type description
json String
callback LoadCallback
  • error String

    null or the error info

  • data Asset

    the loaded asset or null

returns:

type: LoadingHandle

getAssetByUuid
(
  • uuid
)
Asset private

Get the exists asset by uuid.

name type description
uuid String

returns:

type: Asset

the existing asset, if not loaded, just returns null.

init
(
  • options
)

init the asset library

name type description
options Object
  • libraryPath String

    能接收的任意类型的路径,通常在编辑器里使用绝对的,在网页里使用相对的。

  • mountPaths Object

    mount point of actual urls for raw assets (only used in editor)

  • rawAssets Object optional

    uuid to raw asset's urls (only used in runtime)

  • rawAssetsBase String optional

    base of raw asset's urls (only used in runtime)

There are no methods that match your current filter settings. You can change your filter settings in the index section on this page. index