new ComponentClip(scene, config, textures)
Parameters:
| Name | Type | Description |
|---|---|---|
scene |
Phaser.Scene | Phaser scene to create component at |
config |
ComponentConfig | jsfl-generated config object |
textures |
Array.<String> | String | texure name or Array of texture names, where component should find its texture frames |
Extends
- Phaser.GameObjects.Container
Classes
Methods
-
applyChildParams(childId, params)
-
Apply child params
Parameters:
Name Type Description childIdString paramsStateConfig -
destroy( [fromScene])
-
destroy all child GameObjects and child clips recursively
Parameters:
Name Type Argument Default Description fromSceneBoolean <optional>
false -
getChildClip(key)
-
returns current active component child view instance
Parameters:
Name Type Description keyString child key
Returns:
- Type
- PhaserComps.ComponentClip | Phaser.GameObjects.GameObject
-
getChildText(key)
-
returns current active component child text instance
Parameters:
Name Type Description keyString child text field key
Returns:
- Type
- Phaser.GameObjects.Text
-
getStateConfig(stateId)
-
Get raw state config object by state id, if exists
Parameters:
Name Type Description stateIdString state id
-
getStateIds()
-
Component state ids list.
Returns:
- Type
- Array.<String>
-
setState(stateId [, force])
-
Switch component view to specified stateId, if such stateId exists. Do not use it manually, if you are using UIComponentPrototype to control the view
Parameters:
Name Type Argument Default Description stateIdString state id to switch to
forceBoolean <optional>
false if true, state will be setup again even if stateId was not changed
Type Definitions
-
ComponentConfig
-
Component Config object, generated by jsfl exporter
Type:
- Object
Properties:
Name Type Argument Default Description typeString supported types are
image,component,text,tileSprite,polygon,zonechildrenArray.<PhaserComps.ComponentClip.ComponentConfig> <optional>
component children list
childIdString <optional>
unique component id, used by
StateManagerkeyString <optional>
key of component to find it with
UIComponentPrototype. Must be unique inside one stateimageString <optional>
Texture frame name. Only for component types
imageandtileSpritestylePhaser.GameObjects.TextStyle <optional>
text style object, used only for
texttypestatesObject.<String, PhaserComps.ComponentClip.StateConfig> <optional>
object keys are component ids to be enabled at the specified state, and the StateConfig is position and scale params to setup for component
maskingArray.<String> List of component ids, that will be masked by this component. Currently only polygon masks available.
xNumber <optional>
0 x coordinate of component
yNumber <optional>
0 y coordinate of component
scaleXNumber <optional>
1 x scale of component
scaleYNumber <optional>
1 y scale of component
angleNumber <optional>
0 angle of component in degrees
alphaNumber <optional>
1 Opacity of component (
0to1).widthNumber <optional>
Component width. only for
zonetypeheightNumber <optional>
Component height. only for
zonetypeverticesArray.<Number> <optional>
Array of polygon vertices coords,
xandyinterleaving. Only forpolygontypecolorint <optional>
polygon color. Only for
polygontype -
StateConfig
-
Component state config object, generated by jsfl exporter
Type:
- Object
Properties:
Name Type Argument Default Description xnumber <optional>
0 x coordinate of component
ynumber <optional>
0 y coordinate of component
scaleXnumber <optional>
1 x scale of component
scaleYnumber <optional>
1 y scale of component
anglenumber <optional>
0 angle of component
alphaNumber <optional>
1 Opacity of component (
0to1).