GFDecisionScore¶
API Reference / Decision / 类索引
- 路径:
addons/gf/extensions/decision/runtime/gf_decision_score.gd - 模块:
Decision - 继承:
RefCounted - API:
public - 类别:值对象 (
value_object) - 首次版本:
4.3.0
单个候选决策的评分结果。 保存候选 ID、最终分数、考虑项明细、排序序号和元数据,便于测试、调试面板或导演系统审计。
成员概览¶
| 类型 | 名称 | 签名 |
|---|---|---|
| 属性 | decision_id |
var decision_id: StringName = &"" |
| 属性 | decision_order |
var decision_order: int = -1 |
| 属性 | score |
var score: float = 0.0 |
| 属性 | accepted |
var accepted: bool = false |
| 属性 | consideration_scores |
var consideration_scores: Array[Dictionary] = [] |
| 属性 | metadata |
var metadata: Dictionary = {} |
| 方法 | to_dictionary |
func to_dictionary() -> Dictionary: |
| 方法 | get_debug_snapshot |
func get_debug_snapshot() -> Dictionary: |
| 方法 | to_report_dictionary |
func to_report_dictionary(options: Dictionary = {}) -> Dictionary: |
属性¶
decision_id¶
- API:
public - 首次版本:
7.0.0
候选决策标识。
decision_order¶
- API:
public - 首次版本:
7.0.0
候选在所属集合中的原始顺序。独立候选评分时为 -1。
score¶
- API:
public
最终分数。
accepted¶
- API:
public
该候选是否可被选择。
consideration_scores¶
- API:
public
考虑项评分明细。
结构:
consideration_scores: Array[Dictionary],每项包含 consideration_id、score、weight 和 weighted_score 字段。
metadata¶
- API:
public
候选决策元数据副本。
结构:
metadata: Dictionary[StringName, Variant] copied from the scored decision option.
方法¶
to_dictionary¶
- API:
public - 首次版本:
7.0.0
转换为字典。
返回:评分结果字典。
结构:
return: 包含 decision_id、decision_order、score、accepted、consideration_scores 和 metadata 字段的 Dictionary。
get_debug_snapshot¶
- API:
public - 首次版本:
4.3.0
获取调试快照。
返回:调试快照字典。
结构:
return: 基于 to_dictionary() 编码的 JSON-safe 评分结果 Dictionary。
to_report_dictionary¶
- API:
public - 首次版本:
8.0.0
转换为 JSON-safe 报告字典。
参数:
| 名称 | 说明 |
|---|---|
options |
传给 GFReportValueCodec 的编码选项。 |
返回:评分报告字典。
结构:
options: Dictionary with GFReportValueCodec encoding options.return: JSON-safe Dictionary based on to_dictionary().