GFDialogueResponse¶
API Reference / Dialogue / 类索引
- 路径:
addons/gf/extensions/dialogue/resources/gf_dialogue_response.gd - 模块:
Dialogue - 继承:
Resource - API:
public - 类别:资源定义 (
resource_definition) - 首次版本:
3.17.0
通用对话响应选项。 响应只描述玩家或系统可选择的一条后继路径,不决定 UI 样式、 输入方式、角色关系或业务副作用。
成员概览¶
| 类型 | 名称 | 签名 |
|---|---|---|
| 属性 | response_id |
var response_id: StringName = &"" |
| 属性 | text |
var text: String = "" |
| 属性 | next_line_id |
var next_line_id: StringName = &"" |
| 属性 | condition_id |
var condition_id: StringName = &"" |
| 属性 | condition_payload |
var condition_payload: Variant = null |
| 属性 | mutation_id |
var mutation_id: StringName = &"" |
| 属性 | mutation_payload |
var mutation_payload: Variant = null |
| 属性 | tags |
var tags: PackedStringArray = PackedStringArray() |
| 属性 | metadata |
var metadata: Dictionary = {} |
| 方法 | is_available |
func is_available(context: GFDialogueContext) -> bool: |
| 方法 | duplicate_response |
func duplicate_response() -> GFDialogueResponse: |
| 方法 | to_dictionary |
func to_dictionary() -> Dictionary: |
属性¶
response_id¶
- API:
public
响应 ID。
text¶
- API:
public
响应文本或项目自定义文本键。
next_line_id¶
- API:
public
选择后跳转到的行 ID。为空时使用当前行的默认后继。
condition_id¶
- API:
public
条件 ID。为空表示不需要条件判断。
condition_payload¶
- API:
public
条件载荷。框架只透传给上下文处理器。
结构:
condition_payload: 条件处理器接收的任意项目载荷;框架只透传,不解释其中结构。
mutation_id¶
- API:
public
选择该响应时请求执行的通用 mutation ID。为空表示无副作用请求。
mutation_payload¶
- API:
public
mutation 载荷。框架只透传给上下文处理器。
结构:
mutation_payload: mutation 处理器接收的任意项目载荷;框架只透传,不解释其中结构。
tags¶
- API:
public
语义标签。框架不解释标签含义。
metadata¶
- API:
public
项目自定义元数据。框架不解释该字段。
结构:
metadata: 项目自定义元数据 Dictionary;框架保留并复制该字段,但不解释其中键值。
方法¶
is_available¶
- API:
public
检查响应是否可用。
参数:
| 名称 | 说明 |
|---|---|
context |
对话上下文。 |
返回:可用时返回 true。
duplicate_response¶
- API:
public
创建深拷贝。
返回:响应副本。
to_dictionary¶
- API:
public
转换为字典。
返回:响应快照。
结构:
return: 包含 response_id、text、next_line_id、condition_id、condition_payload、mutation_id、mutation_payload、tags 和 metadata 字段的 Dictionary。