GFValidationRunner¶
API Reference / Standard / 类索引
- 路径:
addons/gf/standard/foundation/validation/gf_validation_runner.gd - 模块:
Standard - 继承:
RefCounted - API:
public - 类别:运行时服务 (
runtime_service) - 首次版本:
3.17.0
通用校验套件执行器。 执行 GFValidationSuite 中的规则,支持直接目标、资源路径和 PackedScene 实例化。 Runner 不调用项目约定方法,只把目标、路径和上下文交给显式注册的规则。
成员概览¶
| 类型 | 名称 | 签名 |
|---|---|---|
| 信号 | validation_started |
signal validation_started(suite_id: StringName) |
| 信号 | target_validated |
signal target_validated(target_id: String, report: GFValidationReport) |
| 信号 | validation_finished |
signal validation_finished(report: GFValidationReport) |
| 常量 | GFValidationSuiteBase |
const GFValidationSuiteBase = preload("res://addons/gf/standard/foundation/validation/gf_validation_suite.gd") |
| 常量 | GFValidationRuleBase |
const GFValidationRuleBase = preload("res://addons/gf/standard/foundation/validation/gf_validation_rule.gd") |
| 属性 | validate_scene_instances |
var validate_scene_instances: bool = true |
| 属性 | free_instantiated_scenes |
var free_instantiated_scenes: bool = true |
| 方法 | run_suite |
func run_suite(suite: GFValidationSuiteBase, options: Dictionary = {}) -> GFValidationReport: |
| 方法 | run_targets |
func run_targets( targets: Array, suite: GFValidationSuiteBase = null, options: Dictionary = {} ) -> GFValidationReport: |
| 方法 | run_paths |
func run_paths( paths: PackedStringArray, suite: GFValidationSuiteBase = null, options: Dictionary = {} ) -> GFValidationReport: |
信号¶
validation_started¶
- API:
public
套件开始执行后发出。
参数:
| 名称 | 说明 |
|---|---|
suite_id |
套件标识。 |
target_validated¶
- API:
public
单个目标完成校验后发出。
参数:
| 名称 | 说明 |
|---|---|
target_id |
目标标识。 |
report |
目标报告。 |
validation_finished¶
- API:
public
套件完成执行后发出。
参数:
| 名称 | 说明 |
|---|---|
report |
聚合报告。 |
常量¶
GFValidationSuiteBase¶
- API:
public
const GFValidationSuiteBase = preload("res://addons/gf/standard/foundation/validation/gf_validation_suite.gd")
校验套件脚本基类。
GFValidationRuleBase¶
- API:
public
const GFValidationRuleBase = preload("res://addons/gf/standard/foundation/validation/gf_validation_rule.gd")
校验规则脚本基类。
属性¶
validate_scene_instances¶
- API:
public
通过路径加载 PackedScene 时是否同时实例化根节点参与 Node 规则校验。
free_instantiated_scenes¶
- API:
public
路径校验时是否释放由 Runner 实例化的场景根节点。
方法¶
run_suite¶
- API:
public
执行套件。
参数:
| 名称 | 说明 |
|---|---|
suite |
校验套件。 |
options |
可选参数,支持 targets、paths、context、treat_warnings_as_errors。 |
返回:聚合报告。
结构:
options: Dictionary runner options with targets, paths, context, and warning policy.
run_targets¶
- API:
public
func run_targets( targets: Array, suite: GFValidationSuiteBase = null, options: Dictionary = {} ) -> GFValidationReport:
校验一组直接目标。
参数:
| 名称 | 说明 |
|---|---|
targets |
目标数组。 |
suite |
可选套件;为空时使用无规则套件。 |
options |
可选参数,支持 context、treat_warnings_as_errors。 |
返回:聚合报告。
结构:
targets: Array of validation targets.options: Dictionary runner options with context and warning policy.
run_paths¶
- API:
public
func run_paths( paths: PackedStringArray, suite: GFValidationSuiteBase = null, options: Dictionary = {} ) -> GFValidationReport:
校验一组资源或场景路径。
参数:
| 名称 | 说明 |
|---|---|
paths |
资源或场景路径列表。 |
suite |
可选套件;为空时使用无规则套件。 |
options |
可选参数,支持 context、treat_warnings_as_errors。 |
返回:聚合报告。
结构:
options: Dictionary runner options with context and warning policy.