update
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
- **类型**: Blueprint (ActorComponent)
|
||||
- **父类**: UEndpointComponent
|
||||
- **源文件**: /Game/Blueprints/Component/BP_SayHello.BP_SayHello
|
||||
- **模块**: Content
|
||||
- **模块**: Content/Blueprints/Component
|
||||
|
||||
## 功能概述
|
||||
BP_SayHello 是一个简单的测试/调试端点组件,用于验证 CharacterControl 指令路由系统是否正常工作。它没有任何自定义变量,仅覆盖 OnCommandReceived 事件输出 Hello 日志或消息。
|
||||
@@ -20,24 +20,39 @@ BP_SayHello 负责验证指令路由系统的端到端工作流程,并作为
|
||||
|--------|------|--------|
|
||||
| UEndpointComponent | 父类 | CharacterControl 插件 |
|
||||
|
||||
## 对外接口
|
||||
- **继承自 UEndpointComponent 的接口**:
|
||||
- `EndpointState` (FEndpointState) -- 端点状态,含 `InterestedTags` 配置关注的指令标签
|
||||
- `OnCommandReceived(const FCommandPacket& Command)` (BlueprintImplementableEvent) -- 收到匹配指令时调用,在 EventGraph 中实现(4 个事件、27 个节点)
|
||||
- `OnEndpointStateChanged` -- 状态变化委托
|
||||
- `OnCommandOutput` -- 命令输出委托
|
||||
- **无自定义蓝图变量**:纯行为型组件,不暴露状态数据
|
||||
## 外部视角
|
||||
|
||||
BP_SayHello 是 UEndpointComponent 的蓝图子类,从外部调用者视角:
|
||||
|
||||
**接口概览**
|
||||
- 无自定义变量或公开函数
|
||||
- 继承 UEndpointComponent 的 OnCommandReceived(BlueprintImplementableEvent),收到指令时输出日志
|
||||
- 纯测试/演示用途,不暴露可供外部调用的 API
|
||||
|
||||
**EventGraph 事件**
|
||||
|
||||
| 事件 | 类型 | 触发时机 | 行为 |
|
||||
|------|------|----------|------|
|
||||
| `事件开始运行` | 原生覆盖 (BeginPlay) | 组件创建时由引擎自动触发 | 预留(当前无连线逻辑) |
|
||||
| `事件Tick` | 原生覆盖 | 每帧 | 预留(当前无连线逻辑) |
|
||||
| `事件OnCommandReceived` | 委托事件 (EndpointComponent) | 收到指令路由系统派发的 CommandPacket | 预留(当前无连线逻辑) |
|
||||
| `Server RPC` | 自定义事件 (RPC, Server) | 客户端触发时 | 获取 Owner → 按类获取 BP_InventoryComp → 读取 ItemCount → 获取 ItemViews → 遍历输出物品信息到屏幕 |
|
||||
|
||||
**外部交互方式**
|
||||
- 作为 BP_TestChar 的组件自动创建
|
||||
- 指令系统通过 UCommandRouter 将匹配标签的指令路由到该组件
|
||||
- 外部系统无需直接与 BP_SayHello 交互
|
||||
|
||||
## 使用方法
|
||||
- 作为 ActorComponent 添加到 BP_TestChar,用作测试端点
|
||||
- 配置 `EndpointState.InterestedTags` 添加测试用 GameplayTag(如 "Command.SayHello")
|
||||
- `OnCommandReceived` 事件在蓝图 EventGraph 中实现:收到指令后输出调试日志或 Hello 消息
|
||||
- 配合 EnhancedInput 的测试输入动作使用:
|
||||
1. EnhancedInput 产生输入 -> UCommandInputComponent 生成 FCommandPacket
|
||||
2. UCommandRouterComponent 按标签匹配路由到本组件
|
||||
3. OnCommandReceived 触发,输出日志
|
||||
- 可作为新端点的实现模板:仅需在蓝图 EventGraph 中覆盖 `OnCommandReceived` 实现自定义行为
|
||||
|
||||
BP_SayHello 在项目中的典型调用流程:
|
||||
|
||||
- **指令路由验证流程** — 测试输入触发 → UCommandRouter 路由指令到 BP_SayHello → OnCommandReceived 响应(当前未连线,为后续实现预留)
|
||||
- **库存调试流程** — 客户端触发 Server RPC 事件 → 获取 Owner → 按类查找 BP_InventoryComp → 读取 ItemCount 和 ItemViews → 逐条打印物品 ID、类型、名称到屏幕
|
||||
|
||||
## 用例
|
||||
- BP_TestChar 的组件,验证 CharacterControl 指令路由系统的端到端工作流程
|
||||
- 当 EnhancedInput 绑定到 "Command.SayHello" 指令时,输出响应消息
|
||||
|
||||
| 引用方 | 路径 | 用途 |
|
||||
|--------|------|------|
|
||||
| BP_TestChar | `/Game/Blueprints/BP_TestChar` | 作为端点组件添加到角色,验证路由链路 |
|
||||
| BP_NewChar | `/Game/Blueprints/BP_NewChar` | 引用该组件参与指令系统测试 |
|
||||
|
||||
Reference in New Issue
Block a user