Files
loneseDocument/Content/Blueprints/BP_SayHello.md
meishibiezb 29a3f77908 init
2026-06-04 21:44:13 +08:00

44 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# BP_SayHello
## 基本信息
- **类型**: Blueprint (ActorComponent)
- **父类**: UEndpointComponent
- **源文件**: /Game/Blueprints/Component/BP_SayHello.BP_SayHello
- **模块**: Content
## 功能概述
BP_SayHello 是一个简单的测试/调试端点组件,用于验证 CharacterControl 指令路由系统是否正常工作。它没有任何自定义变量,仅覆盖 OnCommandReceived 事件输出 Hello 日志或消息。
## 设计用意
作为 CharacterControl 插件的最小化端点实现示例BP_SayHello 验证了从 EnhancedInput 到端点响应的全链路EnhancedInput 产生输入动作UCommandInputComponent 生成 FCommandPacketUCommandRouter 进行标签匹配路由,最终到达 BP_SayHello 的 OnCommandReceived 并执行响应。它同时也可作为新端点的参考实现模板。
## 职责范围
BP_SayHello 负责验证指令路由系统的端到端工作流程,并作为新端点的参考实现。它的处理逻辑极简(输出日志),不涉及任何业务逻辑。
## 项目内依赖
| 依赖项 | 关系 | 源文件 |
|--------|------|--------|
| UEndpointComponent | 父类 | CharacterControl 插件 |
## 对外接口
- **继承自 UEndpointComponent 的接口**
- `EndpointState` (FEndpointState) -- 端点状态,含 `InterestedTags` 配置关注的指令标签
- `OnCommandReceived(const FCommandPacket& Command)` (BlueprintImplementableEvent) -- 收到匹配指令时调用,在 EventGraph 中实现4 个事件、27 个节点)
- `OnEndpointStateChanged` -- 状态变化委托
- `OnCommandOutput` -- 命令输出委托
- **无自定义蓝图变量**:纯行为型组件,不暴露状态数据
## 使用方法
- 作为 ActorComponent 添加到 BP_TestChar用作测试端点
- 配置 `EndpointState.InterestedTags` 添加测试用 GameplayTag如 "Command.SayHello"
- `OnCommandReceived` 事件在蓝图 EventGraph 中实现:收到指令后输出调试日志或 Hello 消息
- 配合 EnhancedInput 的测试输入动作使用:
1. EnhancedInput 产生输入 -> UCommandInputComponent 生成 FCommandPacket
2. UCommandRouterComponent 按标签匹配路由到本组件
3. OnCommandReceived 触发,输出日志
- 可作为新端点的实现模板:仅需在蓝图 EventGraph 中覆盖 `OnCommandReceived` 实现自定义行为
## 用例
- BP_TestChar 的组件,验证 CharacterControl 指令路由系统的端到端工作流程
- 当 EnhancedInput 绑定到 "Command.SayHello" 指令时,输出响应消息