Repository navigation
fix(story-player): cgitem 纹理加载不阻塞剧情推进与同 key 瞬间替换 - #367
Merged
Merged
Conversation
- ease 默认 Linear 改为 DOTween Ease 枚举 1 = InSine(AVGShowItemCgSlot.Show 0x183ed1810 的 GetEnum 默认值),接入共享 DotweenEase 库并把未解析名字重映射到 InSine - show() 命令侧先行:同步 dispose 旧同 key 项、建占位 root、写 states 后立即返回(block=false),纹理到位后再建 sprite 并启动各 tween 轨道;block=true 等纹理 + 全部轨道 - 同 key 替换对齐 native 瞬间替换语义;加载期 hidecgitem 可命中 pending 注册;纹理缺失撤销注册并告警 - blocker 注释勘误(2.7.61 blocker 也走公共前段,仅跳过 sprite 加载)
daflyinbed
force-pushed
the
fix/story-player-cgitem
branch
from
October 19, 2026 13:49
7705d23 to
5b1d8f3
Compare
daflyinbed
marked this pull request as ready for review
October 19, 2026 13:55
DOTween `Ease` 枚举是 `Unset = 0, Linear = 1, InSine = 2`(2.7.81 dump.cs DG.Tweening.Ease),`AVGShowItemCgSlot.Show`(2.7.81 0x18405dde0)的 `GetEnum<Ease>(param, "ease", (Ease)1, ...)` 默认值即 Ease.Linear,与共享 DotweenEase 库的 Linear 回落一致。撤回 InSine 默认值与 cgEaseCurve 重映射, 测试同步改为 Linear 默认/回落。blocker 注释按 2.7.81 `_ShowItem` (0x183fb12b0)更正:实例化 blocker 样式 prefab、`Show(command, null, null)` 后立即 FinishCommand。
Member
Review(native 复核:2.7.81 GameAssembly.dll + dump.cs)P1 回归:
|
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
本 PR 处理 StoryPlayer 中 AVG
cgitem移植 review 差异清单里纹理加载 / 同 key 替换相关的 3 项 P2,以及 1 项 P3 注释修正。依据是对明日方舟官服客户端 GameAssembly.dll(Unity IL2CPP)的逆向:最初分析的是 2.7.61(build 2761),review 时在 2.7.81 上用 IDA 反编译和 Il2CppDumperdump.cs复核过。下文直接给出关键结论,不依赖外部文档。背景:native 的 cgitem 机制
Torappu.AVG.AVGShowItemCgSlot.Show(2.7.610x183ed1810/ 2.7.810x18405dde0)用GetEnum<Ease>(param, "ease", (Ease)1, ignoreCase: false)读缓动。(Ease)1是 Linear;GetEnum解析失败时同样回落 Linear。语料 188 条 cgitem 里只有 3 条显式写了ease,都是OutQuad。Torappu.AVG.AVGCgItemPanel._ShowItem(2.7.610x183e35d80/ 2.7.810x183fb12b0)的执行顺序:Dispose()旧的同 key 项(瞬间消失,不淡出);m_slotsInUseDict;_LoadSprite是同步取缓存(由InternalResRefCollector.GatherResRefs预加载保证),executor 不挂起,也没有回调。也就是说:注册先于加载,替换没有空窗,加载不在命令关键路径上。blockerstyle:同样走上面的公共前段(实例化 blocker 样式的 slot prefab、写 dict、绑 PostDisplay),然后跳过 sprite 加载,调用Show(command, null, null),并立即FinishCommand()。语料中 0 次使用。ExecutorComponent.Execute(2.7.610x183e45b10):executor 返回false(即block=false)时立即FinishCommand(),命令瞬时完成。修复内容
1. 纹理加载移出命令关键路径(P2,差异 #2)
block=false时命令瞬时返回,加载不在关键路径上(资源已预加载)。show()无条件先await loadTexture(网络 + 解码),CG 未缓存时剧情推进会被卡住。CgItemPanel.show()改成「命令侧先行」:同步建好占位 root 后立即返回(block=false),纹理到位后再建 sprite、启动各 tween 轨道。block=true仍等待纹理和全部轨道,相当于 native 等整个 Sequence,再加上 web 特有的取纹理等待。纹理到位后才开始运动,比 native 多一段加载耗时的起步延迟,属于 web 适配。2. 同 key 替换的空窗(P2,差异 #3)
await新纹理,加载完成后才dispose(key),旧图一直保留到新图就绪。dispose(input.key)提前到加载之前,对齐「瞬间替换」语义。占位 slot 的语义是 review 建议的可接受方案。3. 加载期竞态残留(P2,差异 #4)
hidecgitem能命中 key。states在加载完成后才写入。加载期间的hidecgitem(key)查不到 key,变成 no-op;CG 随后出现,一直残留到 clear-all。states(pending 注册)。4. ease 默认值注释更正与测试锁定(差异 #1 / #5,不改行为)
差异 Create ISEvent.ts #1 原来判断「默认应为 InSine」,依据的是错误的枚举序号,已撤回。默认值维持
"Linear";runtime 注释更正为Unset = 0, Linear = 1, InSine = 2并注明出处。差异 XbMapViewer: Init #5(ease 名集合)由共享
DotweenEase库覆盖:GetEnum一致。panel 直接使用
dotweenEaseCurve。5. blocker 注释更正(P3,差异 #6)
原注释说 blocker "deliberately skips m_slotsInUseDict",与反编译结果不符。整条命令跳过的行为保持不变(有意省略),只更正注释。
未动条目:以下按 review 建议维持现状:
Stack 关系
fix/story-player-hidecgitem(#365,hidecgitem 命令的同源修复)叠在本分支之上。先合本 PR,再合 #365。验证用剧情文件
语料:torappu gamedata
story/目录(2026-10-14 版本复核行号)。obt/main/level_main_15-15_end.txt:393,396,398:不写ease的 Ken Burns 镜头。block缺省为 false,验证 Create ISEvent.ts #1:推进不被加载卡住。obt/main/level_main_15-15_end.txt:398→400:同 keycgitem_60_i12_3重复下发,验证 ISEvent: Init #2 瞬间替换。obt/main/level_main_15-15_end.txt:400→407:400show 之后407紧跟hidecgitem(image="cgitem_60_i12_3"),验证 Refactor: isEvent #3:加载期 hide 不再漏掉 CG。obt/main/level_main_15-16_beg.txt:443,454,458:同 keycgitem_60_i16三连发,验证 ISEvent: Init #2;每条block缺省 false,验证 Create ISEvent.ts #1。activities/act51side/level_act51side_01_end.txt:662-664:显式ease="OutQuad",回归:显式曲线保持不变。测试
pnpm test:725 个用例全部通过(main 基线 719 + 新增 6)。tests/cgItemPanel.spec.ts新增 5 条:tests/runtime/panels.spec.ts新增 1 条:默认 ease = Linear。pnpm exec vue-tsc -b:无错误。pnpm exec eslint(改动文件):无告警。