Constructor
new NodeBlueprint(type, name)
定义一个节点
| Name | Type | Description |
|---|---|---|
type | NodeType | 节点类型 |
name | string | 节点名称,可重复 |
- Source
Members
name :string
节点的名称,可重复
对应UiNode.name
- string
- Source
type :NodeType
节点的类型
- NodeType
- Source
anchor :Vector2
节点的锚点
- Vector2
- Source
position :Coord2
节点的位置
- Coord2
- Source
size :Coord2
节点的大小
- Coord2
- Source
children :Array.<NodeBlueprint>
节点的子节点
- Array.<NodeBlueprint>
- Source
style :NodeStyle
节点的样式
- NodeStyle
- Source
content :string
节点的内容 若不是文本/图片/输入框,保留该属性,但不生效
对于文本,为文本内容textContent
对于图片,为图片路径image
对于输入框,为输入的文本内容textContent
- string
- Source
placeholder :string
若节点是输入框,表示占位文本内容
若不是输入框,保留该属性,但不生效
- string
- Source
data :object
节点的自定义数据
会传到客户端中
- object
- Source
visible
节点的可见性
- Source
tags :Array.<string>
节点的标签
- Array.<string>
- Source
autoResize
节点自动调整尺寸的方式
- Source
pointerEventBehavior
表示界面元素对指针事件的行为方式
- Source
_event :EntityNodeEvent
节点的事件
- EntityNodeEvent
- Source
name :string
节点的名称,可重复
对应UiNode.name
- string
- Source
type :NodeType
节点的类型
- NodeType
- Source
anchor :Vector2
节点的锚点
- Vector2
- Source
position :Coord2
节点的位置
- Coord2
- Source
size :Coord2
节点的大小
- Coord2
- Source
children :Array.<NodeBlueprint>
节点的子节点
- Array.<NodeBlueprint>
- Source
style :NodeStyle
节点的样式
- NodeStyle
- Source
content :string
节点的内容 若不是文本/图片/输入框,保留该属性,但不生效
对于文本,为文本内容textContent
对于图片,为图片路径image
对于输入框,为输入的文本内容textContent
- string
- Source
placeholder :string
若节点是输入框,表示占位文本内容
若不是输入框,保留该属性,但不生效
- string
- Source
data :object
节点的自定义数据
会传到客户端中
- object
- Source
visible
节点的可见性
- Source
tags :Array.<string>
节点的标签
- Array.<string>
- Source
autoResize
节点自动调整尺寸的方式
- Source
pointerEventBehavior
表示界面元素对指针事件的行为方式
- Source
_event :EntityNodeEvent
节点的事件
- EntityNodeEvent
- Source
Methods
clone() → {NodeBlueprint}
复制自身
- Source
- Type:
- NodeBlueprint
addEventHandler(eventName, handler, maxTimes)
添加事件监听器
暂时没什么用,因为我还没做
| Name | Type | Description |
|---|---|---|
eventName | EventName | 事件类型 |
handler | EventCallBack | 事件监听器 |
maxTimes | number | 事件监听器最大监听次数,超过此次数,停止监听 |
- Source
_pack(entity, parentId, nodeIdnullable) → {PackedNode}
打包节点,以发送到客户端
会往entity.player写入_lastNodeIndex、_clientEvents属性
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
entity | GameEntity | 要发送的玩家 | ||
parentId | number | 0 | 父节点id | |
nodeId | number | <nullable> | null | 节点id |
- Source
- Type:
- PackedNode
clone() → {NodeBlueprint}
复制自身
- Source
- Type:
- NodeBlueprint
addEventHandler(eventName, handler, maxTimes)
添加事件监听器
暂时没什么用,因为我还没做
| Name | Type | Description |
|---|---|---|
eventName | EventName | 事件类型 |
handler | EventCallBack | 事件监听器 |
maxTimes | number | 事件监听器最大监听次数,超过此次数,停止监听 |
- Source
_pack(entity, parentId, nodeIdnullable) → {PackedNode}
打包节点,以发送到客户端
会往entity.player写入_lastNodeIndex、_clientEvents属性
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
entity | GameEntity | 要发送的玩家 | ||
parentId | number | 0 | 父节点id | |
nodeId | number | <nullable> | null | 节点id |
- Source
- Type:
- PackedNode