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 childId
String params
StateConfig -
destroy( [fromScene])
-
destroy all child GameObjects and child clips recursively
Parameters:
Name Type Argument Default Description fromScene
Boolean <optional>
false -
getChildClip(key)
-
returns current active component child view instance
Parameters:
Name Type Description key
String child key
Returns:
- Type
- PhaserComps.ComponentClip | Phaser.GameObjects.GameObject
-
getChildText(key)
-
returns current active component child text instance
Parameters:
Name Type Description key
String 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 stateId
String 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 stateId
String state id to switch to
force
Boolean <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 type
String supported types are
image
,component
,text
,tileSprite
,polygon
,zone
children
Array.<PhaserComps.ComponentClip.ComponentConfig> <optional>
component children list
childId
String <optional>
unique component id, used by
StateManager
key
String <optional>
key of component to find it with
UIComponentPrototype
. Must be unique inside one stateimage
String <optional>
Texture frame name. Only for component types
image
andtileSprite
style
Phaser.GameObjects.TextStyle <optional>
text style object, used only for
text
typestates
Object.<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
masking
Array.<String> List of component ids, that will be masked by this component. Currently only polygon masks available.
x
Number <optional>
0 x coordinate of component
y
Number <optional>
0 y coordinate of component
scaleX
Number <optional>
1 x scale of component
scaleY
Number <optional>
1 y scale of component
angle
Number <optional>
0 angle of component in degrees
alpha
Number <optional>
1 Opacity of component (
0
to1
).width
Number <optional>
Component width. only for
zone
typeheight
Number <optional>
Component height. only for
zone
typevertices
Array.<Number> <optional>
Array of polygon vertices coords,
x
andy
interleaving. Only forpolygon
typecolor
int <optional>
polygon color. Only for
polygon
type -
StateConfig
-
Component state config object, generated by jsfl exporter
Type:
- Object
Properties:
Name Type Argument Default Description x
number <optional>
0 x coordinate of component
y
number <optional>
0 y coordinate of component
scaleX
number <optional>
1 x scale of component
scaleY
number <optional>
1 y scale of component
angle
number <optional>
0 angle of component
alpha
Number <optional>
1 Opacity of component (
0
to1
).