doc: 将CharacterControl模块的文档部分转化为中文
This commit is contained in:
@@ -7,13 +7,13 @@
|
||||
- **模块**: CharacterControl
|
||||
|
||||
## 功能概述
|
||||
Metadata header for every command packet. Carries CommandID (int32, from UInputAction), HopLimit (uint8, mutable, decremented per router hop), bIsContinuous (bool, routing strategy selector), bIsUpward (bool, upward propagation flag).
|
||||
每个命令数据包的元数据头部。携带 CommandID(int32 类型,来自 UInputAction)、HopLimit(uint8 类型,可变,每经过一个路由器跳数递减)、bIsContinuous(布尔值,路由策略选择器)、bIsUpward(布尔值,向上传播标志)。
|
||||
|
||||
## 设计用意
|
||||
Routing envelope - decouples "what the command is" (payload) from "how it travels" (hop limit, direction). HopLimit prevents broadcast storms in router graphs. Upward flag supports parent-child router topologies.
|
||||
R路由信封——将"命令是什么"(有效载荷)与"命令如何传输"(跳数限制、方向)解耦。HopLimit 可防止路由器图结构中的广播风暴。Upward 标志支持父子路由器拓扑结构。
|
||||
|
||||
## 职责范围
|
||||
Carries routing metadata for one command packet. Embedded in FCommandPacket::Meta. Decremented at each router hop.
|
||||
为单个命令数据包携带路由元数据。嵌入在 FCommandPacket::Meta 中。在每个路由器跳数处递减。
|
||||
|
||||
## 项目内依赖
|
||||
| 依赖项 | 关系 | 源文件 |
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
- **模块**: CharacterControl
|
||||
|
||||
## 功能概述
|
||||
Complete unified command message flowing through routing system. Composed of Meta (FCommandMeta), ContinuousPayload (for continuous commands), DiscretePayload (TInstancedStruct<FDiscreteMeta>, for discrete commands).
|
||||
流经路由系统的完整统一命令消息。由 Meta(FCommandMeta)、ContinuousPayload(用于连续命令)、DiscretePayload(TInstancedStruct<FDiscreteMeta>)
|
||||
|
||||
## 设计用意
|
||||
Unified message envelope. All routers and endpoints share single ReceiveCommand(const FCommandPacket&) interface. TInstancedStruct for discrete payload enables future extensibility without changing packet layout.
|
||||
统一的消息信封。所有路由器和端点共享单一的 ReceiveCommand(const FCommandPacket&) 接口。离散载荷使用 TInstancedStruct 可在不改变数据包布局的情况下实现未来扩展。
|
||||
|
||||
## 职责范围
|
||||
Carries ONE command through the routing system. Either continuous or discrete payload is valid (determined by Meta.bIsContinuous).
|
||||
携带一个命令通过路由系统。Continuous 或 Discrete 载荷二者仅有一个有效(由 Meta.bIsContinuous 决定)。
|
||||
|
||||
## 项目内依赖
|
||||
| 依赖项 | 关系 | 源文件 |
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
- **模块**: CharacterControl
|
||||
|
||||
## 功能概述
|
||||
Payload for continuous (analog) commands. Contains CommandTag (FGameplayTag, semantic ID) and ContinuousValue (FVector3f, analog value from input).
|
||||
连续(模拟)命令的载荷。包含 CommandTag(FGameplayTag,语义标识符)和 ContinuousValue(FVector3f,来自输入的模拟值)。
|
||||
|
||||
## 设计用意
|
||||
Separates continuous payload from discrete. FVector3f supports Boolean (0 or 1), Axis1D, Axis2D, Axis3D input types. Tag-based identification means endpoints subscribe by semantics, not input action IDs.
|
||||
将连续载荷与离散载荷分离。FVector3f 支持布尔型(0 或 1)、一维轴、二维轴、三维轴输入类型。基于标签的标识意味着端点按语义订阅,而非输入动作 ID。
|
||||
|
||||
## 职责范围
|
||||
Data container for continuous input values. Used when FCommandMeta::bIsContinuous is true.
|
||||
连续输入值的数据容器。当 FCommandMeta::bIsContinuous 为 true 时使用。
|
||||
|
||||
## 项目内依赖
|
||||
| 依赖项 | 关系 | 源文件 |
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
- **模块**: CharacterControl
|
||||
|
||||
## 功能概述
|
||||
Routing metadata for discrete (one-shot) commands. Contains CommandTags (FGameplayTagContainer, semantic IDs for endpoint matching) and bIsAll (bool, match mode: ALL tags must match vs ANY tag).
|
||||
离散(一次性触发)命令的路由元数据。包含 CommandTags(FGameplayTagContainer,用于端点匹配的语义标识符)和 bIsAll(布尔值,匹配模式:要求匹配全部标签还是任意标签)。
|
||||
|
||||
## 设计用意
|
||||
Bridges raw input events to tag-based subscription model. Defines matching semantics. TInstancedStruct in FCommandPacket allows this to be subclassed for specialized routing logic.
|
||||
将原始输入事件桥接到基于标签的订阅模型。定义匹配语义。FCommandPacket 中的 TInstancedStruct 允许对此进行子类化以实现专门的路由逻辑。
|
||||
|
||||
## 职责范围
|
||||
Defines subscription matching rules for one discrete command. Used by UCommandRouter::IsEndpointMatched for endpoint filtering.
|
||||
定义单个离散命令的订阅匹配规则。由 UCommandRouter::IsEndpointMatched 用于端点过滤。
|
||||
|
||||
## 项目内依赖
|
||||
| 依赖项 | 关系 | 源文件 |
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
- **模块**: CharacterControl
|
||||
|
||||
## 功能概述
|
||||
Full state and identity of a command endpoint. Contains EndpointGuid (FGuid, unique identity), InterestedTags (FGameplayTagContainer, subscription list), bIsActive, bIsContinuousFriendly, bIsAsynchronous flags. Custom operator= preserves GUID on copy while updating config fields. TStructOpsTypeTraits with WithCopy=true forces UE to use C++ copy path instead of memcpy.
|
||||
命令端点的完整状态与身份标识。包含 EndpointGuid(FGuid,唯一身份标识)、InterestedTags(FGameplayTagContainer,订阅列表)、bIsActive、bIsContinuousFriendly、bIsAsynchronous 标志位。自定义 operator= 在拷贝时保留 GUID,同时更新配置字段。TStructOpsTypeTraits 设置 WithCopy=true 强制 UE 使用 C++ 拷贝路径而非 memcpy。
|
||||
|
||||
## 设计用意
|
||||
Solves endpoint identity problem in dynamic routing graph. Custom copy operator prevents CDO/Blueprint default overwriting of runtime-assigned GUID. Tag subscription model enables declarative routing (no hard references between producers/consumers).
|
||||
解决动态路由图中的端点身份标识问题。自定义拷贝运算符可防止 CDO/蓝图默认值覆盖运行时分配的 GUID。基于标签的订阅模型实现声明式路由(生产者与消费者之间无需硬引用)。
|
||||
|
||||
## 职责范围
|
||||
Identity and configuration for one endpoint in the routing graph. GUID serves as registry key in UCommandRouter. Tags determine which commands the endpoint receives.
|
||||
路由图中单个端点的身份标识与配置。GUID 在 UCommandRouter 中作为注册表键值。标签决定端点接收哪些命令。
|
||||
|
||||
## 项目内依赖
|
||||
| 依赖项 | 关系 | 源文件 |
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
- **模块**: CharacterControl
|
||||
|
||||
## 功能概述
|
||||
Data row mapping a UInputAction to command routing parameters. Contains InputAction reference, bIsContinuous flag, ContinousCommandTag (FGameplayTag for continuous), DiscreteCommandMeta (TInstancedStruct<FDiscreteMeta> for discrete).
|
||||
将 UInputAction 映射到命令路由参数的数据行。包含 InputAction 引用、bIsContinuous 标志位、ContinousCommandTag(连续命令的 FGameplayTag)、DiscreteCommandMeta(离散命令的 TInstancedStruct<FDiscreteMeta>
|
||||
|
||||
## 设计用意
|
||||
Designer configuration unit. Answers "When this input fires, what command packet should be generated?" Separates continuous and discrete metadata into distinct fields reflecting different routing semantics.
|
||||
设计者配置单元。回答"当此输入触发时,应生成什么命令数据包?"将连续和离散元数据分离到不同字段中,以反映不同的路由语义。
|
||||
|
||||
## 职责范围
|
||||
Configuration data for one input-to-command mapping. Used by UCommandInputComponent::BuildPacket. Stored in UInputCommandData::InputCommands array.
|
||||
单个输入到命令映射的配置数据。由 UCommandInputComponent::BuildPacket 使用。存储在 UInputCommandData::InputCommands 数组中。
|
||||
|
||||
## 项目内依赖
|
||||
| 依赖项 | 关系 | 源文件 |
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
- **模块**: CharacterControl
|
||||
|
||||
## 功能概述
|
||||
Central abstraction for all nodes in command routing graph. Pure virtual methods: GetEndpointState, GetStateChangedDelegate, GetCommandOutputDelegate, ReceiveCommand. BlueprintNativeEvents: ReceiveCommand_BP, GetEndpointDispatcher_BP. Default C++ implementations route through dispatcher for Blueprint subclasses, while C++ subclasses override directly.
|
||||
命令路由图中所有节点的中央抽象层。纯虚方法:GetEndpointState、GetStateChangedDelegate、GetCommandOutputDelegate、ReceiveCommand。BlueprintNativeEvent:ReceiveCommand_BP、GetEndpointDispatcher_BP。默认 C++ 实现通过调度器为蓝图子类提供路由,而 C++ 子类直接重写。
|
||||
|
||||
## 设计用意
|
||||
Uniform interface enabling heterogeneous routing graph. Routers manage collections of ICommandEndpoint without knowing concrete types. Dispatcher pattern solves UE limitation that BlueprintNativeEvent can't return delegate references directly.
|
||||
统一接口,使异构路由图成为可能。路由器管理 ICommandEndpoint 集合,无需知晓具体类型。调度器模式解决了 UE 的限制——BlueprintNativeEvent 无法直接返回委托引用。
|
||||
|
||||
## 职责范围
|
||||
Defines contract for command routing participants. All routers, endpoint components, and input components implement this. Single ReceiveCommand entry point for all command types.
|
||||
定义命令路由参与者的契约。所有路由器、端点组件和输入组件均实现此接口。所有命令类型的单一 ReceiveCommand 入口点。
|
||||
|
||||
## 项目内依赖
|
||||
| 依赖项 | 关系 | 源文件 |
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
- **模块**: CharacterControl
|
||||
|
||||
## 功能概述
|
||||
Translates Enhanced Input actions into FCommandPacket commands. BeginPlay adds InputMappingContext to local player subsystem, then binds all InputActions from CommandData. BuildPacket converts Boolean/Axis1D/Axis2D/Axis3D values to FVector3f. Continuous commands use Triggered (every frame), discrete use Started. OnPacketBuilt virtual hook for inspection/modification. Default hop limits: 3 continuous, 5 discrete.
|
||||
将增强输入(Enhanced Input)动作转换为 FCommandPacket 命令。BeginPlay 将 InputMappingContext 添加到本地玩家子系统,然后从 CommandData 绑定所有 InputAction。BuildPacket 将布尔值/一维轴/二维轴/三维轴值转换为 FVector3f。连续命令使用 Triggered(每帧触发),离散命令使用 Started。OnPacketBuilt 虚函数钩子用于检查/修改。默认跳数限制:连续命令为 3,离散命令为 5。
|
||||
|
||||
## 设计用意
|
||||
Bridge between UE Enhanced Input and tag-based routing. Decouples gameplay logic from input bindings - systems subscribe to tags instead. Same input can trigger different responses based on state. Hop limit differentiation reflects frequency differences.
|
||||
UE 增强输入与基于标签的路由之间的桥梁。将游戏逻辑与输入绑定解耦——系统通过标签订阅而非直接绑定。同一输入可基于状态触发不同响应。跳数限制的差异化反映了频率差异。
|
||||
|
||||
## 职责范围
|
||||
Input-to-command translation. Binds Enhanced Input actions, converts values to command packets, outputs via delegate. Does NOT route commands.
|
||||
输入到命令的转换。绑定增强输入动作,将值转换为命令数据包,通过委托输出。不负责路由命令。
|
||||
|
||||
## 项目内依赖
|
||||
| 依赖项 | 关系 | 源文件 |
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
- **模块**: CharacterControl
|
||||
|
||||
## 功能概述
|
||||
Core command routing engine. Manages child endpoint registry (TMap<FGuid, FEndpointEntry>). Implements tag-based matching with two modes: continuous (tag + ContinuousFriendly check) and discrete (tag ALL/ANY matching). Tag aggregation system merges child tags upward with ref-counting. Hop-limit guarded dispatch. Upward propagation for child output commands. Self-identity protection prevents circular registration.
|
||||
核心命令路由引擎。管理子端点注册表(TMap<FGuid, FEndpointEntry>)。实现基于标签的匹配,包含两种模式:连续模式(标签 + ContinuousFriendly 检查)和离散模式(标签 ALL/ANY 匹配)。标签聚合系统通过引用计数将子标签向上合并。受跳数限制保护的调度。子端点输出命令的向上传播。自身身份保护防止循环注册。
|
||||
|
||||
## 设计用意
|
||||
Heart of the plugin. Tag-based publish-subscribe bus replacing hard references. Hierarchical tree topology support (routers inside routers). Hop-limit prevents infinite loops. Tag aggregation enables efficient parent-level filtering. EditInlineNew/DefaultToInstanced for embedding in components.
|
||||
插件的核心。基于标签的发布-订阅总线,替代硬引用。支持层级树拓扑(路由器嵌套路由器)。跳数限制防止无限循环。标签聚合实现高效的父级过滤。EditInlineNew/DefaultToInstanced 用于嵌入组件中。
|
||||
|
||||
## 职责范围
|
||||
Command routing and endpoint management. Registers/unregisters endpoints. Matches and dispatches commands. Aggregates and manages tag subscriptions. Does NOT generate commands (input components do that).
|
||||
命令路由与端点管理。注册/注销端点。匹配并调度命令。聚合并管理标签订阅。不生成命令(由输入组件负责)。
|
||||
|
||||
## 项目内依赖
|
||||
| 依赖项 | 关系 | 源文件 |
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
- **模块**: CharacterControl
|
||||
|
||||
## 功能概述
|
||||
ActorComponent wrapper around UCommandRouter. Creates InternalRouter as default subobject. Implements ICommandEndpoint by delegating all methods to InternalRouter. BeginPlay calls AutoRegisterEndpoints which discovers ICommandEndpoint siblings and registers them, skipping self and already-registered endpoints.
|
||||
UCommandRouter 的 ActorComponent 包装器。创建 InternalRouter 作为默认子对象。通过将所有方法委托给 InternalRouter 来实现 ICommandEndpoint。BeginPlay 调用 AutoRegisterEndpoints,自动发现同 Actor 上的 ICommandEndpoint 同级组件并进行注册,跳过自身和已注册的端点。
|
||||
|
||||
## 设计用意
|
||||
Bridge putting a command router on an Actor without C++. Auto-registration implements "local bus" pattern: all endpoint components on same actor auto-wire through this router. Designer adds component -> automatic local command bus.
|
||||
无需 C++ 即可在 Actor 上挂载命令路由器的桥梁。自动注册实现"本地总线"模式:同一 Actor 上的所有端点组件自动通过此路由器连线。设计者添加组件 → 自动形成本地命令总线。
|
||||
|
||||
## 职责范围
|
||||
Actor-attached router host. Owns and delegates to UCommandRouter. Auto-discovers and registers sibling endpoints. Does NOT implement routing logic (delegated to InternalRouter).
|
||||
附加到 Actor 的路由器宿主。拥有并委托给 UCommandRouter。自动发现并注册同级端点。不实现路由逻辑(委托给 InternalRouter)。
|
||||
|
||||
## 项目内依赖
|
||||
| 依赖项 | 关系 | 源文件 |
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
- **模块**: CharacterControl
|
||||
|
||||
## 功能概述
|
||||
Base ActorComponent for Blueprint-authored endpoints. Holds own FEndpointState, delegates. ReceiveCommand calls OnCommandReceived (BlueprintImplementableEvent). BeginPlay auto-registers with sibling UCommandRouterComponent.
|
||||
用于蓝图编写的端点的基类 ActorComponent。持有自身的 FEndpointState 和委托。ReceiveCommand 调用 OnCommandReceived(BlueprintImplementableEvent)。BeginPlay 自动向同级 UCommandRouterComponent 注册。
|
||||
|
||||
## 设计用意
|
||||
Primary base class for Blueprint endpoints. Subclass in Blueprint, override OnCommandReceived. Auto-wiring with UCommandRouterComponent for default setup. Blueprintable meta explicitly encourages Blueprint subclassing.
|
||||
蓝图端点的主要基类。在蓝图中子类化,重写 OnCommandReceived。默认设置下与 UCommandRouterComponent 自动连线。Blueprintable 元数据明确鼓励蓝图子类化。
|
||||
|
||||
## 职责范围
|
||||
Blueprint-friendly endpoint base. Handles state, delegates, and auto-registration. OnCommandReceived event is the Blueprint extension point.
|
||||
蓝图友好的端点基类。处理状态、委托和自动注册。OnCommandReceived 事件是蓝图扩展点。
|
||||
|
||||
## 项目内依赖
|
||||
| 依赖项 | 关系 | 源文件 |
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
- **模块**: CharacterControl
|
||||
|
||||
## 功能概述
|
||||
Bridge object exposing endpoint delegates to Blueprint. Holds OnStateChanged and OnCommandOutput delegates, plus CurrentState. Provides NotifyStateChanged/OutputCommand wrapper UFUNCTIONs for Blueprint callers.
|
||||
向蓝图公开端点委托的桥接对象。持有 OnStateChanged 和 OnCommandOutput 委托,以及 CurrentState。为蓝图调用者提供 NotifyStateChanged/OutputCommand 包装 UFUNCTION。
|
||||
|
||||
## 设计用意
|
||||
Glue between C++ delegates and Blueprint VM. Blueprint endpoint implementations return this via GetEndpointDispatcher_BP. The ICommandEndpoint default C++ implementations all route through this dispatcher.
|
||||
C++ 委托与蓝图虚拟机之间的粘合剂。蓝图端点实现通过 GetEndpointDispatcher_BP 返回此对象。ICommandEndpoint 的默认 C++ 实现均通过此调度器进行路由。
|
||||
|
||||
## 职责范围
|
||||
Delegate bridge for Blueprint endpoints. Broadcasts state changes and command output to C++ observers. Does NOT implement endpoint logic.
|
||||
D蓝图端点的委托桥接。向 C++ 观察者广播状态变更和命令输出。不实现端点逻辑。
|
||||
|
||||
## 项目内依赖
|
||||
| 依赖项 | 关系 | 源文件 |
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
- **模块**: CharacterControl
|
||||
|
||||
## 功能概述
|
||||
UDataAsset container for input configuration. Holds InputMappingContext (Enhanced Input mapping context to load) and InputCommands (TArray<FInputCommand>, the action-to-command mappings). Pure data container with no runtime logic.
|
||||
输入配置的 UDataAsset 容器。持有 InputMappingContext(要加载的增强输入映射上下文)和 InputCommands(TArray<FInputCommand>
|
||||
|
||||
## 设计用意
|
||||
Standard UE data asset pattern for designer-friendly configuration. Designer creates asset, fills in mappings, assigns to UCommandInputComponent::CommandData. Decouples configuration from code.
|
||||
标准 UE 数据资产模式,便于设计者配置。设计者创建资产、填充映射、分配给 UCommandInputComponent::CommandData。将配置与代码解耦。
|
||||
|
||||
## 职责范围
|
||||
Configuration data container. Holds mapping context reference and command array. No runtime logic (empty .cpp file).
|
||||
配置数据容器。持有映射上下文引用和命令数组。无运行时逻辑(.cpp 文件为空)。
|
||||
|
||||
## 项目内依赖
|
||||
| 依赖项 | 关系 | 源文件 |
|
||||
|
||||
Reference in New Issue
Block a user