Cocos Creator API

1.0.0

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

Asset

Extends RawAsset
Module: cc

Base class for handling assets used in Fireball. This class can be instantiate.

You may want to override:

  • createNode
  • cc.Object._serialize
  • cc.Object._deserialize

Properties

rawUrl String readOnly

Returns the url of this asset's first raw file, if none of rawFile exists, it will returns an empty string.

rawUrls String[] readOnly

Returns the url of this asset's raw files, if none of rawFile exists, it will returns an empty array.

_rawFiles String[] private

在 lite 版的 Fireball 里,raw asset 并不仅仅是在 properties 里声明了 rawType 才有, 而是每个 asset 都能指定自己的 raw file url。这些 url 就存在 _rawFiles 字段中。 AssetLibrary 并不会帮你加载这些 url,除非你声明了 rawType。

_uuid String private

Inherited from RawAsset:

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

deserialize
(
  • data
)
Asset private static

应 AssetDB 要求提供这个方法

name type description
data String

returns:

type: Asset

serialize ( ) String private

应 AssetDB 要求提供这个方法

returns:

type: String

createNode
(
  • callback
)

Create a new node using this asset in the scene.
If this type of asset dont have its corresponding node type, this method should be null.

name type description
callback Function
  • error String

    null or the error info

  • node Object

    the created node or null

_setRawFiles
(
  • rawFiles
)
private

Set raw file names for this asset.

name type description
rawFiles String[]

createNodeByInfo
(
  • Info
  • callback
)

Inherited from RawAsset:

Create a new node in the scene.
If this type of asset dont have its corresponding node type, this method should be null.

name type description
Info Object
callback Function
  • error String

    null or the error info

  • node Object

    the created node or null

isRawAssetType
(
  • ctor
)
Boolean private

Inherited from RawAsset:

name type description
ctor Function

returns:

type: Boolean

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