Skip to main content

DragonBone Class

Description:

  A class for creating instances of the 'DragonBone' record.

getLooks

Type: Function.

Description:

  Returns a list of available looks for the specified DragonBone file string.

Signature:

getLooks: function(self: DragonBoneClass, boneStr: string): {string}

Parameters:

ParameterTypeDescription
boneStrstringThe DragonBone file string to get the looks for.

Returns:

Return TypeDescription
{string}A table of strings representing the available looks.

getAnimations

Type: Function.

Description:

  Returns a list of available animations for the specified DragonBone file string.

Signature:

getAnimations: function(self: DragonBoneClass, boneStr: string): {string}

Parameters:

ParameterTypeDescription
boneStrstringThe DragonBone file string to get the animations for.

Returns:

Return TypeDescription
{string}A table of strings representing the available animations.

__call

Type: Metamethod.

Description:

  Creates a new instance of 'DragonBone' using the specified bone string.

Signature:

metamethod __call: function(self: DragonBoneClass, boneStr: string): DragonBone | nil

Parameters:

ParameterTypeDescription
boneStrstringThe DragonBone file string for the new instance.
A DragonBone file string can be a file path with the target file extention like "DragonBone/item" or file paths with all the related files like "DragonBone/item_ske.json

Returns:

Return TypeDescription
DragonBoneA new instance of 'DragonBone'. Returns nil if the bone file or atlas file is not found.

__call

Type: Metamethod.

Description:

  Creates a new instance of 'DragonBone' using the specified bone file and atlas file. This function only loads the first armature.

Signature:

metamethod __call: function(self: DragonBoneClass, boneFile: string, atlasFile: string): DragonBone | nil

Parameters:

ParameterTypeDescription
boneFilestringthe filename of the bone file to load.
atlasFilestringthe filename of the atlas file to load.

Returns:

Return TypeDescription
DragonBonea new instance of 'DragonBone' with the specified bone file and atlas file. Returns nil if the bone file or atlas file is not found.