Skip to content
This repository was archived by the owner on Sep 20, 2026. It is now read-only.

fix(replay): await socket effect presentation - #231

Closed
pengx17 wants to merge 1 commit into
masterfrom
codex/fix-replay-socket-vfx-readiness
Closed

pengx17 wants to merge 1 commit into
masterfrom
codex/fix-replay-socket-vfx-readiness

Conversation

@pengx17

@pengx17 pengx17 commented Aug 7, 2026

Copy link
Copy Markdown
Member

Context

保存回放结束后,Continue 区域偶发出现一个没有字母内容的菱形。截图与游戏源码表明它不是回放按钮自身的 UI,而是插槽效果 VFX 在回放状态切换时未完成异步初始化所留下的空外框。

现有回放 bootstrap 会等待 ItemController.Setup,但 SocketEffectController.UpdateData 是 async void,其内部的 LoadVFXAssets 没有进入 readiness barrier。控制器被回收或跨状态复用时,VFX 外框与内容可能处于不同步状态。

改动重点

  • 回放 readiness: 将原物品专用跟踪器扩展为卡牌表现任务跟踪器。
  • 插槽效果 VFX: 通过 Harmony postfix 接管 LoadVFXAssets 返回的 Task,纳入现有等待屏障。
  • 生命周期: 回放进入播放前统一等待物品 Setup 与插槽效果 VFX 加载完成。

协作过程

sequenceDiagram
    participant U as 用户
    participant C as Codex
    participant G as 游戏源码/日志
    U->>C: 报告 Continue 下方偶发空菱形
    C->>G: 对照原生回放按钮与 SocketEffect 生命周期
    G-->>C: 按钮控制器不创建该元素;SocketEffect VFX 异步加载未被等待
    C->>C: 复用既有 Item presentation readiness 模式
    C->>G: Release 构建、格式与回放测试通过
Loading

方案讨论

没有按屏幕位置或对象名称硬隐藏菱形,因为那会掩盖竞态并可能误伤正常音符效果。最终选择现有的 readiness seam:与物品卡 Setup 相同,包装原生 Task,让 bootstrap 在播放前观察真实完成状态。

SocketEffectController.UpdateData 本身是 async void,无法由调用方等待;LoadVFXAssets 是它内部唯一可等待的 Task seam,因此补丁落在该方法上。

最终方案

ReplayCardPresentationReadiness 以控制器实例为键跟踪最新表现任务。保存回放注入期间,物品 Setup 和插槽效果 VFX 加载都会注册;WaitForPresentationReadyAsync 在一个渲染边界后确认没有新增待处理任务,再允许回放开始。

验证情况

  • dotnet build src/BazaarPlusPlus/BazaarPlusPlus.csproj -c Release ...:通过,0 warning / 0 error
  • ./run.sh format-check:通过(1194 files)
  • Architecture.Tests:154 passed
  • CombatReplayRecording.Tests:通过
  • CombatReplayPlaybackLogging.Tests:27 passed

已知局限 / 后续工作

  • 当前游戏进程中有正在进行的对局,因此本次没有强制重启游戏做保存回放 smoke,避免中断用户进度;需要在下次安全重启后复验原始场景。

Copilot AI lite review requested due to automatic review settings August 7, 2026 02:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses an intermittent empty diamond outline appearing under the replay “Continue” area by extending the replay “presentation readiness” barrier to also await socket-effect VFX asset loading, preventing pooled/transitioned controllers from crossing replay state boundaries with partially-initialized visuals.

Changes:

  • Replaced the item-only readiness tracker with a generalized card presentation readiness tracker (ReplayCardPresentationReadiness).
  • Added a Harmony postfix to wrap SocketEffectController.LoadVFXAssets’s returned Task so replay bootstrap can await VFX initialization.
  • Updated replay bootstrap and presentation-ready waiting to use the new readiness tracker/task barrier.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/BazaarPlusPlus/Patches/Combat/CombatReplayItemPresentationReadinessPatch.cs Removed the old item-only readiness patch (superseded by the new combined readiness patches).
src/BazaarPlusPlus/Patches/Combat/CombatReplayCardPresentationReadinessPatch.cs Introduces readiness patches for both ItemController.Setup and SocketEffectController.LoadVFXAssets, tracking both into the new barrier.
src/BazaarPlusPlus/Game/CombatReplay/Bootstrap/ReplayCardPresentationReadiness.cs Renames/generalizes the tracker and implements “wait until stable across a render boundary” for all tracked presentation tasks.
src/BazaarPlusPlus/Game/CombatReplay/Bootstrap/ReplayBootstrap.cs Switches bootstrap tracking scope to ReplayCardPresentationReadiness.
src/BazaarPlusPlus/Game/CombatReplay/Bootstrap/AppStateHandlerInstaller.cs Updates the “presentation ready” wait to include the new card presentation readiness tasks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +10 to +12
[HarmonyPatch(typeof(ItemController), nameof(ItemController.Setup), [typeof(Card)])]
internal static class CombatReplayItemPresentationReadinessPatch
{
@pengx17

pengx17 commented Aug 7, 2026

Copy link
Copy Markdown
Member Author

截图对象误判:该方案修复的是插槽 VFX,与实际的空原生 tooltip 框无关。错误改动已 revert;正确的池化 tooltip 修复移至 #232,避免污染新 PR 历史。

@pengx17 pengx17 closed this Aug 7, 2026
@pengx17
pengx17 deleted the codex/fix-replay-socket-vfx-readiness branch August 7, 2026 02:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants