Select.h
Source/MassBattle/Public/Fragments/Select.h
概述 Overview
选择(选中)视觉相关 fragment 集合:配置 FSelect(进入 BeingSelect / Selected 状态时的生成配置,FSelectSpawnConfig 含 Actor / FX / Sound 三组)与运行时状态 FBeingSelect(两个状态各自的视觉宿主句柄,FBeingSelectStateData 是每状态三组句柄数组的载体)。关键网络纪律:选中/选中的 FLAG 与生成宿主是端侧本地渲染层状态——UID=-1(全局 UID 游标不动)、无 FNetworkTag,永不进快照 / hash / 网络池;resync 后由 RebindLocalVisualsAfterResync 从 LocalVisualRegistry 重新挂接。模拟逻辑严禁按这些 flag 分支或把宿主当权威数据读取。
Selection-visual fragment collection: config FSelect (spawn configs on entering BeingSelect / Selected; FSelectSpawnConfig holds Actor / FX / Sound groups) and runtime state FBeingSelect (per-state visual host handles; FBeingSelectStateData carries the three handle arrays per state). Key network discipline: the Selected/BeingSelect flags and their spawned hosts are peer-local render-layer state — UID=-1 (global UID cursor untouched), no FNetworkTag, never in snapshot/hash/network pools; after a resync RebindLocalVisualsAfterResync re-attaches them from LocalVisualRegistry. Simulation logic must never branch on these flags or read the hosts as authoritative.
FSelectSpawnConfig USTRUCT
Select 生成配置——agent 进入 BeingSelect / Selected 时生成什么。网络模式下这些生成是端侧本地视觉:SelectAgents 锁步外执行(BP 直调、无服务器往返 → 即时选择手感),生成的 Actor / Fx / Sound 宿主为纯本地:UID=-1、无 FNetworkTag。它们不是锁步实体——模拟逻辑严禁把这类宿主当作权威数据读取。
Select spawn config — what to spawn when an agent enters BeingSelect/Selected. In networked mode these spawns are peer-local visuals: SelectAgents runs off-lockstep (BP-driven, no server round-trip → instant selection feel), so the spawned Actor/Fx/Sound hosts are local-only: UID=-1, no FNetworkTag. They are NOT lockstep entities — simulation logic must never read these hosts as authoritative.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
SpawnActor | TArray<FActorSpawnConfig> | 空 | 生成的 Actor(网络模式下为纯本地视觉)。Actors to spawn (local-only visuals in networked mode). |
SpawnFx | TArray<FFxConfig> | 空 | 生成的特效(网络模式下为纯本地视觉)。Effects to spawn (local-only visuals in networked mode). |
PlaySound | TArray<FSoundConfig> | 空 | 播放的声音(网络模式下为纯本地视觉)。Sounds to play (local-only visuals in networked mode). |
FSelect USTRUCT
select 配置 fragment(FA_MassBattleBaseFragment 派生)——每 agent 的选择配置。Selected / BeingSelect FLAG 是端侧本地渲染层状态:永不进实体 hash(hash 行不含 FEntityFlagFragment),快照恢复时被剥离(SnapshotStrippedRenderFlagsMask,与 Rendering 系 flag 同类),由本地登记表在 resync 后重放。模拟逻辑严禁按这些 flag 分支。含 TArray 成员,经 MASS_FRAGMENT_ACCEPT_NOT_TRIVIALLY_COPYABLE 声明。
Select config fragment (derived from FA_MassBattleBaseFragment) — per-agent selection configuration. The Selected/BeingSelect flags are peer-local render-layer state: they never enter the entity hash (hash rows exclude FEntityFlagFragment) and are stripped on snapshot restore (SnapshotStrippedRenderFlagsMask, alongside the Rendering flags) — the local registry replays them after resync. Simulation logic must not branch on these flags. Declared via MASS_FRAGMENT_ACCEPT_NOT_TRIVIALLY_COPYABLE (contains TArray members).
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
bEnable | bool | true | 是否启用选择逻辑。为 false 时,SelectAgents 对该 Agent 无效。Whether to enable selection logic. When false, SelectAgents will do nothing for this agent. |
SpawnOnBeingSelect | FSelectSpawnConfig | — | 进入 BeingSelect 状态时的生成配置(网络模式下为纯本地视觉)。Spawns when entering BeingSelect state (local-only visuals in networked mode). |
SpawnOnSelected | FSelectSpawnConfig | — | 进入 Selected 状态时的生成配置(网络模式下为纯本地视觉)。Spawns when entering Selected state (local-only visuals in networked mode). |
FBeingSelectStateData USTRUCT (plain)
每状态的 select 视觉宿主句柄载体(非 USTRUCT)。网络模式下数组持有端侧本地宿主句柄(UID=-1、无 FNetworkTag)。
Per-state host-handle container for the select visuals (not a USTRUCT). In networked mode the arrays hold the peer-local host handles (UID=-1, no FNetworkTag).
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
ActorHostEntities | TArray<FMassEntityHandle> | 空 | Actor 宿主实体句柄数组。Actor host entity handles. |
FxHostEntities | TArray<FMassEntityHandle> | 空 | FX 宿主实体句柄数组。FX host entity handles. |
SoundHostEntities | TArray<FMassEntityHandle> | 空 | Sound 宿主实体句柄数组。Sound host entity handles. |
方法 Methods
清空三个宿主句柄数组。
Clears all three host-handle arrays.
Input
无参数。
No parameters.
Output
无返回值。副作用:三个数组清空。
No return value. Side effect: the three arrays are emptied.
三个数组是否全为空。
Whether all three arrays are empty.
Input
无参数。
No parameters.
Output
三个数组全空返回 true;无副作用。
Returns true when all three arrays are empty; no side effects.
FBeingSelect USTRUCT
select 运行时状态 fragment(FA_MassBattleBaseFragment 派生)。fragment 本身不进快照——重建 agent 上这些数组为空,由 RebindLocalVisualsAfterResync 从 LocalVisualRegistry(唯一事实来源)重新填充;DeselectAgents 经这些数组销毁宿主,因此重链的写回使 resync 后 deselect 依然有效。经 MASS_FRAGMENT_ACCEPT_NOT_TRIVIALLY_COPYABLE 声明。
Selection runtime-state fragment (derived from FA_MassBattleBaseFragment). The fragment itself is NOT snapshotted — on rebuilt agents these arrays come back empty and are re-populated by RebindLocalVisualsAfterResync from LocalVisualRegistry (the single source of truth). DeselectAgents destroys hosts via these arrays, so the rebind write-back is what keeps deselect working after a resync. Declared via MASS_FRAGMENT_ACCEPT_NOT_TRIVIALLY_COPYABLE.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
BeingSelectData | FBeingSelectStateData | — | BeingSelect 状态下的视觉宿主句柄。Visual host handles for the BeingSelect state. |
SelectedData | FBeingSelectStateData | — | Selected 状态下的视觉宿主句柄。Visual host handles for the Selected state. |
方法 Methods
复位两个状态的宿主句柄(各自清空三组数组)。
Resets both states' host handles (each clears its three arrays).
Input
无参数。
No parameters.
Output
无返回值。副作用:全部句柄数组清空。
No return value. Side effect: all handle arrays are emptied.
管线角色 Pipeline Role
FSelect / FBeingSelect 在 MassBattle 管线中的位置:由 UMassBattleAgentSubsystem 的 SelectAgents / DeselectAgents 逻辑与 RebindLocalVisualsAfterResync(经 LocalVisualRegistry 重链)消费,函数入口暴露在 MassBattleFuncLib 供 BP 直调;锁步外执行,不经过快照 / hash。
Position of FSelect / FBeingSelect in the MassBattle pipeline: consumed by the SelectAgents / DeselectAgents logic of UMassBattleAgentSubsystem and by RebindLocalVisualsAfterResync (re-binding via LocalVisualRegistry); entry points are exposed on MassBattleFuncLib for direct BP calls. Runs off-lockstep, never through snapshot/hash.