This repository was archived by the owner on Sep 20, 2026. It is now read-only.
fix(combat-insights): compact wide recap impact tooltips - #226
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Post-Combat “Recap Combat Impact” tooltip rendering to avoid main-thread stalls caused by extremely wide target/source detail groups, while also fixing missing/misaligned effect icons by mapping attribute keys to native keyword icon keys. It fits into the PostCombatImpact UI pipeline by changing how NativePostCombatImpactTooltipView decides whether to render per-entity detail rows and how it resolves icon keys for group headers.
Changes:
- Suppress per-target/per-source detail row rendering when a group exceeds
MaximumDetailedEntityRows(12), reducing hover-time layout/preview construction. - Introduce
CombatImpactEffectIconKeyto map attribute keys (e.g.,RepairTargets,TransformTargets,*Targets, derived reduction keys) to native keyword icon keys, restoring missing icons. - Adjust group header layout to a fixed icon column + label + metric columns so rows stay aligned even when an icon is missing.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/PostCombatImpact.Tests/PostCombatImpact.Tests.csproj | Links new UI helper/policy source files into the test project build. |
| tests/PostCombatImpact.Tests/CombatImpactProjectorTests.cs | Adds a regression scenario that produces wide unique target groups for repair/destroy/transform/haste. |
| tests/PostCombatImpact.Tests/CombatImpactEffectIconKeyTests.cs | Adds unit tests validating attribute-key → native icon-key mapping behavior (including variants and destroy). |
| tests/PostCombatImpact.Tests/CombatImpactDetailPresentationPolicyTests.cs | Adds unit tests for the “render entity rows only up to threshold” policy. |
| src/BazaarPlusPlus/Patches/PostCombatImpact/NativePostCombatImpactTooltipView.cs | Applies the detail-row suppression policy, resolves icon keys via the new helper, and renders a fixed-width icon column for alignment. |
| src/BazaarPlusPlus/Game/PostCombatImpact/Ui/CombatImpactEffectIconKey.cs | New centralized mapping helper for resolving native keyword icon keys from combat impact kinds/attribute keys. |
| src/BazaarPlusPlus/Game/PostCombatImpact/Ui/CombatImpactDetailPresentationPolicy.cs | New UI presentation policy defining the max detailed row threshold and predicate. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动重点
*Targets/ 派生属性 key 映射到 native keyword icon key,修复 Repair / Transform 等行缺图标的问题。Context
玩家在 Recap 中 hover 中文卡牌“无人机粉碎者”时,游戏主线程会长时间卡住;来源录像是 https://www.bilibili.com/video/BV1Z8un61ECZ。这个战斗比较特殊,同一张卡在一个战斗中反复触发修复、摧毁、转化、加速,导致 Recap 的 Combat Impact 数据里出现大量不同 target/source 明细。
本地用临时 Debug 复现场景把详细行上限拉到 300 后确认会明显卡住;恢复生产策略后,用户反馈进游戏不卡。临时 synthetic/debug 入口已在提交前清理,本 PR 只保留正式修复和测试。
协作过程
sequenceDiagram participant User as 用户 participant Codex as Codex participant CCFable as ccfable participant Game as 本地游戏验证 User->>Codex: 提供录像与截图:hover 无人机粉碎者时 Recap 卡死 Codex->>CCFable: 请求只读复核卡顿假设 CCFable-->>Codex: 指出不是无限循环,而是超长 per-target rows × 同步布局重建 Note over Codex,CCFable: destroy/transform/repair/haste 会产生随 use count 增长的 unique target/source 明细,hover 时一次性构建 TMP、preview、layout tree Codex->>Game: 加临时 Debug synthetic report,把明细上限拉到 300 User-->>Codex: 确认 300 场景确实卡住,但等待后能恢复 Codex->>Game: 恢复生产上限策略,只展示汇总 User-->>Codex: 确认进游戏不卡;随后发现 Repair/Transform 图标缺失且不对齐 Codex->>Codex: 对照反编译 native TooltipTypography/Data keyword 表 Note over Codex: `TransformTargets` / `RepairTargets` 不是可靠的 icon lookup key,应映射到 native keyword `Transform` / `Repair` Codex->>Codex: 清理临时复现入口,保留阈值策略、icon 映射、固定 icon 列和回归测试方案讨论
ADR-001: 超长明细的展示策略
Context: 旧实现会为每个 target/source 生成明细行与 native card preview,再交给 tooltip fit/trim loop 逐行裁剪;高基数数据会把成本集中到 hover 的主线程路径。
Considered Options:
Decision: 选择 UI 呈现层阈值策略,超过
MaximumDetailedEntityRows = 12时不渲染该分组的 per-target/per-source 明细。Consequences: 保留了分组总次数和最终统计,避免超长明细产生大量 TMP、preview 与 layout rebuild;代价是极端战斗中不再展开每个目标的明细。
ADR-002: 效果图标 key 的来源
Context: native
TooltipTypography.GetKeywordStringWithIconNoScale(key, "")在 key 未命中时返回空字符串。RepairTargets/TransformTargets是 action target attribute,不一定是 native keyword 配置里的 icon key,导致图标消失;图标作为内联文本拼在 label 前时,缺图标行还会左移。Considered Options:
nativeAttributeKey。Decision: 新增
CombatImpactEffectIconKey,集中映射高置信属性族,例如 Haste/Slow/Freeze/Charge 的 targets/reduction、Repair、Transform、Enchant、Upgrade、Flying、Destroy、Tempo、Rage、Regen 等。Consequences: Repair/Transform 等行恢复 native icon,后续新增映射有单测保护;对 native keyword 不明确的属性不强行映射,避免误导性图标。
最终方案
sequenceDiagram participant Report as CombatImpactReport participant View as NativePostCombatImpactTooltipView participant Policy as CombatImpactDetailPresentationPolicy participant Icons as CombatImpactEffectIconKey participant Native as TooltipTypography Report->>View: groups with targets/sources View->>Policy: ShouldRenderEntityRows(count) alt count <= 12 View->>View: render detail rows and previews else count > 12 View->>View: render group header summary only end View->>Icons: Resolve(kind, nativeAttributeKey) Icons-->>View: native keyword icon key View->>Native: GetKeywordStringWithIconNoScale(iconKey, "") View->>View: render fixed icon column + label + right metric验证情况
./run.sh format-checkdotnet test tests/PostCombatImpact.Tests/PostCombatImpact.Tests.csprojdotnet build src/BazaarPlusPlus/BazaarPlusPlus.csproj -c Releasegit diff --check已知局限 / 后续工作
Reload、Cooldown、ForceUse、Disable、经济/等级、Joy*、Custom_*等 native icon key 不够明确的项目没有强行补图标;现在即使为空也会通过固定 icon 列保持对齐。