Core. ClassUtils

ClassUtils Is a class tool class.

Constructor

new ClassUtils()

Member

(static) _classMap :Object

(static) getClass :function

Returns class objects by name.

Methods

addGraphicsToSprite(graphicO, sprite)

Add the graphic object to the Sprite
Parameters:
Name Type Description
graphicO Object Graphic object description
sprite Sprite

addGraphicToSprite(graphicO, sprite)

Add the graphic drawing instructions to the sprite
Parameters:
Name Type Description
graphicO Object Drawing instruction description
sprite Sprite

createByJson(json, nodeopt, rootopt) → {Object}

Creates a node object based on the specified JSON data. Such as: { "Type": "Sprite."", "Props": { "X": 100, "Y": 50, "Name": "Item1."", "Scale."": [2,2] }, "CustomProps": { "X": 100, "Y": 50, "Name": "Item1."", "Scale."": [2,2] }, "Child": { "Type": "Text."", "Props": { "Text": "this, is, a, test."", "Var": "label."", "Rumtime."":"" } } ] }
Parameters:
Name Type Attributes Default Description
json Object JSON string or Object object.
node Object <optional>
null node If the node node is empty, a new one is created.
root Node <optional>
null root Root node is used to set the VaR definition.
Returns:
Type:
Object
Generated nodes.

getInstance(className) → {Object}

Create a Class instance based on the name.
Parameters:
Name Type Description
className String Class name.
Returns:
Type:
Object
Returns an instance of the class.

getRegClass(className)

Returns the registered Class map.
Parameters:
Name Type Description
className String Mapped name.

regClass(className, classDef)

Registered Class mapping.
Parameters:
Name Type Description
className String The name of the map, or the class name, is abbreviated.
classDef Object The full name or class of a class, the full name, such as: "laya.display.Sprite"".