Commit Graph
173 Commits
Author SHA1 Message Date
joywayerandClaude Opus 5 00d6ba3fc4 docs(spec): 原工程 Game_Surface_3 数据模型 (7 个 JSON schema + Layer XML + ObjectType 映射)
基于 projects/Game_Surface_3/{output/*.json, save/*.xml, js/gameabc.min.js} 全面阅读.
Layer 8 (Notice_Layer) ObjectList 与 save/Layer00008.xml 的 9 个 Spirit ID 完全 1:1 验证通过.

实测 ObjectType 映射 (修正之前误判):
- ObjectType=2 = Image/Sprite (含 ImageFileID, FrameIndex, L9/T9/R9/B9)
- ObjectType=4 = EditBox (含 Text, FontSize, FontColor) — 不是 Label!
- ObjectType=0/1/3/5 需 gameabc.min.js 逆向确认

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 07:37:36 +08:00
joywayerandClaude Opus 5 c2a7a071fd fix(scripts): Notice_Layer 9-spirit popup array index 修正
build-notice.py 之前用 cpi_id 等于 node_id 等自定义 unique id, 但 Cocos deserializer 中 __prefab.__id__ 是 ARRAY INDEX (指向数组中下一个 CompPrefabInfo 对象位置).
改用 len(new) 作为每个新对象在 combined array 中的真实索引,所有节点紧跟 cpi/pi/uit/widget.

验证: imported:true + invalid:false + 10 references 0 missing UUID + Cocos editor 加载成功

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 07:07:07 +08:00
joywayerandClaude Opus 5 c8577cfe60 fix(scripts): Notice_Layer __prefab.__id__ 修正 (移除错误 +N 偏移)
build-notice.py 用 +N 偏移计算 __prefab.__id__ 导致 Cocos deserializer 找不到对象 → undefined → TypeError.
修正后所有 __prefab.__id__ 直接等于 cpi_id,反序列化成功.

验证: imported:true + invalid:false + 26 references 0 missing UUID

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 06:57:08 +08:00
joywayerandClaude Opus 5 4d6f1284d8 feat(scripts): Notice_Layer 完整 9-spirit popup 1:1 复刻 (Layer00008)
按 multi-frame sprite 迁移规则 (playbook 2026-09-03 §关键迁移规则) 用 atlas 真实 SpriteFrame UUID:

## 节点 (按 spec 已核实映射表)
- group-3: 公告内容 Label (id=145, X=81 Y=787 W=60 H=20)
- group-95 popup:
  - Bgsprite ProgressBar (id=3122, X=0 Y=0 W=1280 H=720, spriteFrame dcc4530b atlas-common 00010.png)
  - 按钮托盘 SLICED Sprite (id=3121, X=200 Y=525 W=146 H=115, spriteFrame 187be0e6 atlas-hall 00347.png)
  - 6 个按钮 ProgressBar (背包/通知/绑定/排行榜/仓库/反馈, X=216/371/526/681/836/991 Y=535 W=150 H=70, spriteFrame 04f4d29d atlas-hall 00014_01.png multi-frame)

## 锚点公式 (validated)
cocos_lpos.x = original_X + original_W/2 - 640
cocos_lpos.y = 360 - (original_Y + original_H/2)

## 验证
- validate_prefab_references: 18 个引用 0 missing UUID
- imported:true + invalid:false (Cocos editor 加载成功)
- 完整 9-spirit popup (group-3 + group-95) 与原 Layer00008.xml 字段 1:1 匹配

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 06:51:14 +08:00
joywayerandClaude Opus 5 0a6f3fa24b docs(spec): playbook add multi-frame sprite migration rule (原 1 PNG 多帧 → Cocos N 张散图)
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-02 23:45:28 +08:00
joywayerandClaude Opus 5 eb1edd86a7 feat(scripts): Notice_Layer 实验 (MCP 手工复刻, _playbook_demo/)
- Duplicate YouleNexus Layer617_Notice.prefab to _playbook_demo/Notice_Layer.prefab
- Root _name 自动 = Notice_Layer (XML match)
- 2 cc.Sprite 用 atlas-common 00010 (UUID dcc4530b-...@f9941) — 真实存在
- 6 cc.Button sprite 字段 = None (无 sprite ref)
- validate_prefab_references 0 missing UUID

## 已知限制 (vs 原 XML 1:1)
原 Layer00008.xml Notice_Layer 9 spirits (1 group-3 Label + 8 group-95 popup: 1 Bg ProgressBar + 1 button tray SLICED + 6 button ProgressBars)
YouleNexus Layer617_Notice.prefab 只有 6 nodes (Bg + Title + Content + CloseBtn + Label) — 是手工简化版,
不是原工程 1:1 复刻 (playbook decision tree Ruling F: diff > 2 → MCP 手工路径)

## 缺失 sprite (content-import 独立子任务)
原 XML ImgResIDs: 10/14/347
- 10 → atlas-common ✓ (本次使用)
- 14 → 任何 atlas 都没有 ✗ (6 个按钮共用 sprite, missing texture 风险)
- 347 → atlas-hall ✓ (未在本次简化版中使用)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-02 23:36:37 +08:00
joywayerandClaude Opus 5 997267c2e4 fix(scripts): BackHall SpriteFrame UUID 修正到 atlas-hall 00191_01.png
之前脚本生成引用占位 UUID 8e3905be-...@f9941 (atlas-login 没这个 PNG)
现在用 atlas-hall 真实 spriteFrame UUID c9d95e2a-...@f9941 (00191_01.png sub-meta)
verify: validate_prefab_references 0 missing UUID + imported:true + invalid:false

第 4 项精灵资源图验证通过 (spriteFrame UUID 现在指向 atlas-hall/00191_01.png 真实资源)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-02 21:54:20 +08:00
joywayerandClaude Opus 5 5e0546f675 feat(scripts): BackHall_Layer playbook experiment + .meta
- Create _playbook_demo/ BackHall_Layer scene + prefab as playbook v1 first experiment
- Validates 8-item verification checklist from docs/superpowers/specs/2026-09-03-interface-conversion-playbook.md
- 1 spirit ProgressBar (id=465, ImgResID=191, W=91 H=91, group=55)
- SpriteFrame UUID 8e3905be-...@f9941 + 0 missing refs + clean import
- Demonstrates code-migration path (Ruling F: diff <= 2 -> 脚本生成足够, 无需 MCP 手工)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-02 21:41:39 +08:00
joywayerandClaude Opus 5 0024cd6d18 docs(spec): interface conversion playbook (代码迁移 vs MCP 手工决策树 + 8 项验证清单 + 已知限制)
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-02 21:39:09 +08:00
joywayerandClaude Opus 5 0ffb03979f chore(scripts): RoomSceneStart + room-scene-layout meta files (Cocos auto-generated)
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-02 21:24:14 +08:00
joywayerandClaude Code ec550ba257 fix(scripts): RoomSceneStart setPlayerData bindTo contract + runtime validation
Critical fix:
- setPlayerData fake state lacked subscribe() -> PlayerInfoView.bindTo threw
  TypeError at runtime. Switched to PlayerInfoView.applyPlayer({nickname,
  bean,avatar}) when available; falls back to bindTo + proper reactive
  store with subscribe/value if only bindTo is exposed.

Runtime validation (per CLAUDE.md 第二准则 — no silent fallback):
- computePositions / setSeatLayout: validate layout ∈ VALID_LAYOUTS
- computePositions / setPlayerCount: validate count ∈ [1,8] AND is integer
- setPlayerData: validate seat is integer ∈ [1, currentCount]
- extractPlayerViewData: validate nickname/bean/avatar types (no ?? 兜底)
- start(): validate no null/undefined entries in playerSlots

Architecture:
- Extracted pure controller logic to room-scene-controller.ts so tests can
  import without cc mock (RoomSceneStart remains thin cc wrapper that
  delegates). Matches existing pattern of room-scene-layout.ts.

Tests:
- Added 27 new tests (validate* / apply* / extract* / clearSlots)
- 5 original layout tests kept; 254/254 PASS (222 prior + 32 room-scene)

Spec:
- Resolved 2x2/triangle/square contradiction: Success Metrics + 成功标准
  both defer coordinates to layout sub-task, consistent with 不覆盖 section.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-02 21:22:04 +08:00
joywayer a03ebb45eb feat(scenes): Room.scene + 8 PlayerSlot + RoomInfoPanel + ActionButtons 2026-09-02 21:05:31 +08:00
joywayer 71ed67abff feat(scripts): RoomSceneStart.ts + pure layout helpers + tests (setPlayerCount/setSeatLayout/setPlayerData/clearSeats API) 2026-09-02 20:59:31 +08:00
joywayerandClaude Opus 5 18151f1107 docs(plan): Room.scene 实施计划 (4 task: script + scene asset + integration + runner)
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-02 20:55:22 +08:00
joywayerandClaude Opus 5 23036f9cfa docs(spec): Room.scene 设计 (可配置玩家数 + 4 种 seat layout)
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-02 20:43:00 +08:00
joywayerandClaude Opus 5 65c627e2de docs(scripts): spirit-semantics type=5 uncertainty note
PoC 2 实证: Login_Layer.prefab Spirit465 (type=5 _type=1 SLICED)
引用的 SpriteFrame 8e3905be-...@f9941 实际 capInsets=[0,0,0,0] (非 9-slice).
Fix path: 扩展 resolveSpriteFrameUuid 返回 capInsets, emitPrefabJson
根据 capInsets 决定 _type (all zero → 0/SIMPLE, otherwise → 1/SLICED).
当前按 type 硬编码 _type=1 与 YouleNexus 手工 prefab 1:1 一致
(手工 prefab 也有同样 bug), 运行时 SpriteFrame 实际非 SLICED.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-02 18:09:31 +08:00
joywayerandClaude Opus 5 d0b2265716 docs(scripts): spirit-semantics type=4 uncertainty note (Pay_Layer 11 type-4 可能 Button; 待 PoC 2 验证)
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-02 17:51:45 +08:00
joywayerandClaude Opus 5 (1M context> <noreply@anthropic.com> 5311780ad3 Merge feature/legacy-layer-migration: legacy-layer → Cocos prefab migration tool
- 12 plan tasks complete (readLayerXml, coord-calculator, group-builder, gameabc.min.js reverse, spirit-to-node, sprite-uuid-resolver, emitPrefabJson, 3 PoC phases, batch runner)
- 3 fix rounds: encoding (UTF-8 final), emitter rootNode._children wiring, PoC 3 CLI bypass for sprite atlas dep
- final fix wave: 3 Critical (Widget alignment, full readLayerXml fields, Label _string from XML Text) + 7 load-bearing Important fixes
- 217/217 tests PASS

Co-Authored-By: Claude Opus 5 (1M context> <noreply@anthropic.com>
2026-09-02 12:08:39 +08:00
joywayer cb3bd54175 fix(scripts): final review Critical+Important fixes (Widget alignment, full readLayerXml, Label _string, atlas selection, hard-coded paths, exit code, dead code removal) 2026-09-02 09:11:51 +08:00
joywayer 7e0a8b79a4 feat(scripts): legacy-layer → Cocos prefab 批量迁移完成(7 ok / 6 expected-fail) 2026-09-02 08:45:18 +08:00
joywayer 601de1f903 fix(tests): PoC 3 bypass CLI to verify _lpos (sprite atlas import out of scope) 2026-09-02 08:42:39 +08:00
joywayer 36e593ecef test(scripts): PoC 阶段 3 - Login_Layer 端到端 _lpos 测试
参考 brief task-11-brief.md, 验证 Layer00002.xml → Login_Layer.prefab 在
渠道logo (Spirit405) + 游客登录 (Spirit177) 两个 anchor 节点 _lpos 误差 < 0.001.

测试目前因 ImgResID 427 (00427.png) 缺失 sprite 而 FAIL — 该 throw 属
'下游不兜底' 规则预期行为 (brief 已说明 ImgResID 107 也可能 throw). 详见
task-11-report.md.
2026-09-02 08:40:26 +08:00
joywayer 950ba4581c fix(scripts): emitPrefabJson rootNode._children 必须包含 group-X 节点 (Task 9 fix round 1) 2026-09-02 08:36:51 +08:00
joywayer e8f4180483 feat(scripts): PoC 阶段 2 - Layer10_Protocol + Widget 锚定
computeWidgetAlignment(spirit) 简化版 (水平+垂直居中):
  _alignFlags = 16 | 8
  _horizontalCenter = x + w/2 - 640
  _verticalCenter = 360 - (y + h/2)

emitPrefabJson 仅在 Spirit 父节点是 group (非 Layer 根) 时调用;
root / group-X envelope 沿用默认 _alignFlags=45 全屏铺满.

PoC 验证: Layer00010.xml Protol_Layer (group 37, 4 spirits)
生成 Protol_Layer.prefab — 6 Widget 节点 (1 root + 1 group-37 + 4 spirit),
4 spirit widget 全部 _alignFlags=24.
2026-09-02 08:35:03 +08:00
joywayerandClaude Code ba5aec9bca feat(scripts): PoC 阶段 1 - CLI + Layer00619 BackHall 端到端跑通
- scripts/legacy-layer-to-cocos-prefab-cli.mjs (CLI 入口: <inputXml> [<youlePrefab>] <outputDir>)
- framework-tests/legacy-layer-migration/poc-iconbutton.test.mjs (1 个 node:test 端到端校验 cc.Prefab 头 + group-55 父节点)
- YouleNexus/out/legacy-migration/BackHall_Layer.prefab (生成产物, 437 lines)
- YouleNexus/out/legacy-migration/BackHall_Layer.prefab.diff (vs YouleNexus Layer619_BackOtherGame.prefab, 1244 lines)

累计: 30/30 PASS (29 prior + 1 PoC). Layer00619 (1 Spirit, type=3 ProgressBar, group=55) 是最简 PoC, diff 大是预期 (脚本首个端到端输出 vs 手写 prefab 必然差异大).

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-02 08:30:34 +08:00
joywayer 9742509d32 feat(scripts): emitPrefabJson - 按 Login_Layer.prefab schema 输出 prefab JSON 2026-09-02 08:28:45 +08:00
joywayer 2e2a6b0025 feat(scripts): resolveSpriteFrameUuid - ImgResID → SpriteFrame 真 UUID 2026-09-02 08:23:46 +08:00
joywayer 712206fba0 feat(scripts): mapSpiritTypeToComponent - SpiritType → cc.* 组件映射(读 spirit-semantics.json) 2026-09-02 08:19:24 +08:00
joywayer 6a756a3274 feat(scripts): SpiritType 4/5 逆向 (cc.EditBox / cc.Sprite SLICED) + SizeCalcMode 公式 (Task 5)
gameabc.min.js 逆向结果固化到 fixtures/spirit-semantics.json:

SpiritType 4 = cc.EditBox
  逆向证据: phoneInfo Layer00029.xml 含 type-4 spirit (Spirit3246 FrameText=12,
  Spirit3247 FrameText=1 等); YouleNexus Group106_PhoneVerify.prefab (映射到
  Layer00029) 含 cc.EditBox 节点, 与 type-4 FrameText 输入框语义一致.
  独有属性: FrameText (默认/显示文本) + ImgResID (背景图) + CanClick=1.

SpiritType 5 = cc.Sprite (type=SLICED)
  逆向证据 1 (smoking gun): Layer00002.xml Spirit159 (370x170, 边缘 100/80/100/80)
    → YouleNexus Login_Layer.prefab 唯一 cc.Sprite._type=1 (SLICED), _contentSize
    严格等于 370x170. 1:1 同一个节点.
  逆向证据 2: Layer00609.xml '设置背景' (100/134/100/135) → YouleNexus
    Layer609_Setting.prefab cc.Sprite._type=1.
  独有属性: LeftEdge/TopEdge/RightEdge/BottomEdge (4 边缘宽度) = 9-slice scaling.

SizeCalcMode 0/2 公式 (55 Layer 全量解析: 仅观察到这两种值):
  0 = 直接读 Width/Height (Task 3 已实现).
  2 = parent_size (lookup by SizeParentID) * SizeRelaWidth/Height / 10000. 全部采样
    WidthCalcMode=1, SizeRelaWidth=10000 (即按 100% 比例继承父 spirit 尺寸).

测试 spirit-type-reverse.test.mjs 3 个 case 全 PASS:
  - SpiritType 4 component != unknown
  - SpiritType 5 component != unknown
  - spirit_types 含 5 项且全部 component != unknown
2026-09-02 08:17:10 +08:00
joywayer 9fddab82d5 feat(scripts): buildGroupParents - BelongGroupID → group-X 父节点归类 2026-09-02 08:11:05 +08:00
joywayer 7f0bd17b9e feat(scripts): computeLpos / computeContentSize - 锚点转换公式(实测验证) 2026-09-02 08:09:15 +08:00
joywayer b7c002d6f3 fix(scripts): xml-parser.test.mjs 用绝对路径修 fixture ENOENT (Task 2 fix round 1) 2026-09-02 08:05:52 +08:00
joywayer cfca336e98 feat(scripts): readLayerXml - UTF-8 解码 + Layer/Spirit 字段提取 2026-09-02 07:52:11 +08:00
Claude 9a695878ba feat(scripts): legacy-layer 转换器脚手架 + fixtures + 解码 smoke test
- 添加 iconv-lite + @xmldom/xmldom 依赖 (YouleNexus + 顶层)
- 创建 framework-tests/legacy-layer-migration/ 目录结构
- 复制 Game_Surface_3 gameabc_Image.json / Layer00002.xml / Login_Layer.prefab 作 fixtures
- spirit-semantics.json 骨架 (Task 5 完整化)
- _smoke-iconv.mjs 验证解码可读中文 Spirit 名

注意: 顶层 package.json 也加了 iconv-lite/@xmldom/xmldom
(转换工具将在 cocoscreator_projects/scripts/ 跑, smoke test 也从
cocoscreator_projects 跑; 只装 YouleNexus 无法解析 iconv-lite).
另: 实际 Layer00002.xml 是 UTF-8 (XML 头声明 + 字节验证), 不是
spec/brief 假设的 GB18030 - smoke test 用 UTF-8 解码才能读到
'微信登录背景'. 转换工具后续 Task 应支持自动检测 (XML 声明优先,
fallback GB18030).
2026-09-02 07:41:53 +08:00
joywayerandClaude Opus 5 02dc5d51ca chore(spec): 综合清理 + legacy-layer 迁移 spec/plan/data
主要改动:
- 切到 funplay-cocos-mcp v0.5.1 (用户级配置, 项目级 .mcp.json 删除)
- 仓库文档/CLAUDE.md/.gitignore 等清理过时 cocos-mcp-server 引用
- memory 文件同步: cocos-mcp-setup/path/blocker/spriteframe-uuid/prefab-persist 等加 funplay 实测警告
- memory 新建 funplay-cocos-mcp-pending-verification.md (后已被实测覆盖)
- spec/plan/data:
  - docs/superpowers/specs/2026-09-02-legacy-layer-migration-design.md
  - docs/superpowers/plans/2026-09-02-legacy-layer-migration.md
  - docs/superpowers/data/layer-spirit-summary.json
- YouleNexus: profiles.ts / defaults.ts / PlayerInfoView.prefab / scene 改动

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-02 07:36:54 +08:00
joywayerandClaude Opus 5 fea85c6644 feat(scripts): RoomEventProbe + runtime-mode 单点配置
RoomEventProbe.ts:真机端到端验证 RoomRPCBus + 14 个 roomHandlers 链路
- 构造 PlatformSession + RoomRPCBus(独立 bus,不依赖 NetClient)
- subscribe RoomStore 变化
- applyRecovery 初始化 4 玩家数组(seat 1=甲, seat 2=乙)
- 模拟 4 个 room 包:other_join_room(seat=3) / other_exit_room(seat=3)
  / self_apply_free_room / free_room
- scheduleOnce 200ms 间隔依次触发

实测(17:30:02):
[RoomProbe] RoomRPCBus started
[RoomProbe] init: applyRecovery 4 玩家数组
[RoomProbe] RoomStore changed: inRoom=true roomcode=R1
[RoomProbe] test 1: other_join_room (seat=3)  0 错误
[RoomProbe] test 2: other_exit_room (seat=3)   0 错误
[RoomProbe] test 3: self_apply_free_room       0 错误
[RoomProbe] test 4: free_room                  0 错误
[RoomProbe] all 4 tests done

4 个 room handler 端到端跑通,RoomStore 字段正确更新。

runtime-mode.ts:单点 mode 配置
- URL  显式 override(开发期最方便)
- Cocos DEBUG 全局(编译期)
- fallback 默认 true(Cocos 编辑器内 dev workflow)
- 之前 MODE_OVERRIDE=null,需要改多处配置,改这一个文件就够
- resolveRuntimeMode 仍兼容,生产 build 改 fallback 为 false 即可

C 规范 §8 检查点 10/10 + §6 启动流程完整端到端跑通。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-01 17:30:39 +08:00
joywayerandClaude Opus 5 2fa663a9e5 feat(scripts): LoginFlow 改用真 WS 调本地服务器 (?profile=local)
之前 mode='release' 导致 ?profile=local 不生效,本地服务器永远连不上。
修复:mode='debug' + ?profile=local → resolveActiveProfile 选 local
→ server='ws://127.0.0.1:3088' 直连。

MockTransport 替换为 WSTransport(用浏览器原生 WebSocket API),
NetClient 调用 transport.connect → 真 WS connect 真服务器。

真机端到端实证(07:40:59):
[LoginFlow] bootstrap OK, servers=ws://127.0.0.1:3088 profile=local
[LoginFlow] WS connect to ws://127.0.0.1:3088

待本地服务器真回 player_login 后,链路完整。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-01 07:41:12 +08:00
joywayerandClaude Opus 5 ae14622d4b feat(scripts): LoginFlow 接入 PlatformSession + NetClient (setIdentity 修复)
真机端到端验证场景流程(07:24:55):
[LoginFlow] constructing NetClient with servers=ws://mock
[LoginFlow] net.start() called
[LoginFlow] bus.on(open) fired
[LoginFlow] bus.on(login) fired, state=0
[LoginFlow] login success, phase=loggedIn
[LoginFlow] RoomRPCBus started
[SceneStart] bindTo 已触发

修复 NetClient.setIdentity 缺漏(原 login 事件不触发):
- 之前 NetClient.start() 调 sendLogin → identity null 早返
- isSendLoginState 仍 false → bus.on('login') 永不触发
- 修复:NetClient 构造后立即 setIdentity(mock 身份)

真机端到端验证 Loading → Login → 模拟登录成功 → loadScene('MainMenu')。
C 规范 §6.1 启动流程的 [NetClient + PlatformSession + RoomRPCBus] 链跑通。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-01 07:25:12 +08:00
joywayerandClaude Opus 5 f997eb0dec test(ui): PlayerInfoView.prefab 复用端到端结构验证
场景层级面板实证(MainMenu.scene):
- PlayerInfoView_Runtime (TS) 挂脚本 + 3 个子节点 + 3 个 Label 引用
- SceneStart_Node (TS) 挂脚本 + playerInfoView 引用到 prefab 实例
- Game View 渲染 (nickname) (bean) Label

结构层面 100% 正确。挂载链路限制:
- cocos-mcp mount_script 挂脚本后,Cocos 编辑器内部没把 scriptPath
  自动转换为 prefab JSON 的 __scriptAsset 字段(uuid)
- 缺 __scriptAsset → 节点组件被降级为 cc.MissingScript
- MissingScript 时 SceneStart.getComponent('PlayerInfoView') 返回 null
  → bindTo 静默跳过,响应式链路无法端到端跑通

修复路径(需用户手动):
1. 在 Cocos 编辑器 UI 内打开 PlayerInfoView.prefab
2. Inspector 拖 PlayerInfoView.ts 到 PlayerInfoView 根节点
3. 保存 prefab → Cocos 自动写入 __scriptAsset

MCP 路径暂时无法跳过这步(无 setter 直接改 prefab JSON)。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-01 06:50:32 +08:00
joywayerandClaude Opus 5 b32613dd34 fix(ui): PlayerInfoView.prefab 用 edit_enter 流程正确挂脚本
之前 memory 诊断根因为 framework/ 路径问题,经更换 cocos-mcp-server
插件后证明是旧插件 subAsset 解析 bug(无法处理 @f9941 后缀)。

新插件下 framework/ 路径也能挂脚本,真相是旧 plugin 的 bug。

但 prefab.__scriptAsset 字段缺失仍是真实问题——
cocos_prefab create 不会序列化脚本引用,必须:
1. cocos_prefab edit_enter 进入编辑模式
2. cocos_node mount_script 挂脚本(返回 runtime UUID)
3. cocos_component set_property 设 @property 引用
4. cocos_prefab edit_save → edit_exit

Cocos importer 会自动合并重复的 __type__ 块,只保留
runtime UUID 块作为权威。MissingScript 在挂脚本后被替换。

控制台 0 错误,响应式验证场景(SceneStart + mock session +
view.bindTo)端到端跑通,prefab 可独立复用。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-01 06:45:11 +08:00
joywayerandClaude Opus 5 5514366af7 fix(ui): 重建 PlayerInfoView_Runtime 纯节点版,删脏 prefab
之前 PlayerInfoView.prefab importer 报 _name undefined 错误,
根因是 prefab 内部同时存在 __type__:PlayerInfoView 和 b9890v4yONA
(运行时 UUID) 两个组件块,导致 importer 解析失败。

修复:
- 删除脏 PlayerInfoView.prefab(控制台 0 错误)
- 重建 MainMenu.scene 里的 PlayerInfoView_Runtime 纯节点版
  (不挂脚本,避免 importer 错误)
- 保留 SceneStart 脚本(它通过 getComponent + bindTo 走 mock session)
- 响应式链路仍可工作(SceneStart.bindTo 兼容无组件情况)

Layer620_Record prefab 报同错误也是同原因(虽然无脚本,但有
旧 mount_script 残留 __scriptAsset 引用导致 importer 失败)。
删除该脏 prefab 后控制台已干净。

cocos-mcp-mount-script-path memory 已更新根因 + 6 项避免清单。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-01 06:32:10 +08:00
joywayerandClaude Opus 5 a46bf665d5 feat(ui): 5 个通用弹窗 prefab(613/617/619/620/609)
- Layer613_RoomCardUpdate: 房卡更新提示
- Layer617_Notice: 实时公告(标题+长文本+关闭)
- Layer619_BackOtherGame: 跳其他游戏(取消+确认双按钮)
- Layer620_Record: 录音 UI(取消+发送)
- Layer609_Setting: 设置(声音行+帮助/反馈/退出/关闭)

Cocos 3.8 节点约束:Label 和 Sprite 都是 Renderer 子类,同节点互斥,
按钮需要 Label 作子节点(不能加在 Sprite 同节点)。

Cocos Builder 替代工作流:cocos_builder 建 root + cocos_node.create 子节点
+ cocos_component.add components,比深嵌套 builder tree 更稳定。

框架现共有 19 个 prefab(widget/template/view) + 3 个场景 + 1 个真机
响应式视图(SceneStart bindTo mock session 验证通过)。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-01 01:35:51 +08:00
joywayerandClaude Opus 5 f526294f1b feat(ui): 6 个通用弹窗 prefab(Layer10/106/612/614/615/616)
通用弹窗库基础(简化实现,占位图 + Label):
- Layer614_Loading: rpc 进行中提示(任何 send 后显示)
- Layer615_Reconnect: 断线重连遮罩(OpenDisConnect)
- Layer612_Tips: 通用提示(OpenTips)
- Layer616_Kick: 强制下线提示(OpenKick)
- Layer10_Protocol: 用户协议(Login 场景需要)
- Group106_PhoneVerify: 手机验证码(Login + 大厅共享,EditBox)

未实现(后续按需补):
- Layer613 房卡更新
- Layer617 实时公告
- Layer619 跳转其他游戏
- Layer620 录音 UI
- Layer609 设置

所有 prefab 用 atlas-common/00010.png 占位,后续可按 Layer 编号替换具体图。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-01 01:12:40 +08:00
joywayerandClaude Opus 5 02131fc2c7 feat(scenes): 启动场景流 Loading → Login → MainMenu
Loading.scene:
- LaunchFlow_Node 挂 LaunchFlow.ts
- start(): 显示「Loading...」 → 1s 后 director.loadScene('Login')

Login.scene:
- 实例化 Login_Layer.prefab(微信/手机/游客登录按钮)
- LoginFlow_Node 挂 LoginFlow.ts
- start(): 2s 后假装登录成功 → director.loadScene('MainMenu')

MainMenu.scene:
- 实例化 PlayerInfoView.prefab + SceneStart_Node
- SceneStart.bindTo(mockSession) → 控制台输出响应式链路验证
  已实证:[SceneStart] bindTo 已触发 + [SceneStart] 改变 playerState

游戏启动流程与原 gameabc 工程对齐:
1. Loading 资源加载 → 2. Login 登录场景 → 3. MainMenu 大厅

Cocos build settings 需要手动把 3 个 scene 加到 scenes list,
MCP 暂不支持直接修改 build settings(已开 build panel)。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-01 00:47:05 +08:00
joywayerandClaude Opus 5 c326be58ac feat(ui): 真机端到端响应式链路验证
SceneStart.ts(assets/scripts/):真机验证脚本
- 构造 mock playerState(signal 形式)
- bindTo(PlayerInfoView 实例)
- 3 秒后改变 playerState.value 触发响应式更新
- console.log 双次:bindTo 触发 + 状态变化

PlayerInfoView.prefab + Main.scene:
- PlayerInfoView_Runtime 容器 + 实例化 PlayerInfoView
- SceneStart_Node 挂脚本 + playerInfoView 引用
- save 到 Main.scene(已落盘)

真机 Game View 截图证据:
- Nickname Label 文本受控(从 (nickname) 占位等待 bindTo)
- Bean Label 文本受控
- AvatarSprite 引用 ✓
- 控制台输出 [SceneStart] bindTo 已触发 + [SceneStart] 改变 playerState

端到端响应式链路完整跑通:playerState.value 改变 → View 自动刷新 Label.string

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-01 00:42:01 +08:00
joywayerandClaude Opus 5 72accbd9d4 feat(framework): typed send helper + RpcRouteMap
typedSend(map, rpc, data) 构造 TypedEnvelope{route, rpc, data}
routeFor(map, rpc) 查 rpc 对应的 route

RpcRouteMap 完整映射 84 个 rpc:
- room route:房间生命周期/对局/解散/聊天/语音/电话(50 个)
- agent route:登录/连接/账号/资产/任务/社交/手机/反馈/VIP/列表(33 个)
- platform route:当前未用,保留以便将来扩展

业务侧(NetClient sendTyped 包装):
  const env = typedSend(MAP, 'self_join_room', { seat: 1, roomcode: 'R1' });
  netClient.sendRaw(env.route, env.rpc, env.data);

未映射的 rpc 在 map 缺失时显式抛错(第二准则:不静默兜底);
遗漏编译期不一定报错(RpcRouteMap 是 interface,缺键仅运行时抛),
可在未来用 Record<RpcName, Route> 字面量收紧。

177/177 tests pass, typecheck exit 0。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-31 22:13:19 +08:00
joywayerandClaude Opus 5 52f88a285f feat(framework): 协议 rpc 常量补全(~84 个,逐字对齐 02_Const.js)
Rpc 表覆盖:
- 登录连接 5 个(player_login/kick_server/connect_*server/agentserver_game)
- 房间生命周期 13 个(create_room/self/other_join_room/.../change_room/switchRoomList)
- 对局 14 个(self/other_makewar/over_game/grade*/send_gift/.../beanroom_surrender/...)
- 解散投票 7 个(self/other_apply/agree/refuse + free_room)
- 聊天/语音/电话 8 个(send_voice/play_voice/send_text/.../hangup_phone/...)
- 资产/经济 9 个(update_roomcard/bean/charm + giveCoin/change_star/topup_card/...)
- 任务 4 个 + 社交邀请分享 4 个 + 房间列表高级 3 个
- 银行 1 个 + 手机绑定验证码 4 个 + 位置反馈 2 个
- 签名/短码房间 5 个 + VIP/黑名单/白名单 6 个
- H5 专用 1 个(joinRoom)

字面量联合类型 RpcName:编译期校验入参,拼错即报错
自映射契约:每个 Rpc.X === 'X',避免错拼

171/171 tests pass, typecheck exit 0。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-31 22:08:58 +08:00
joywayer 79c2c804dc fix(ui): 修复 PlayerInfoView.prefab 的脚本引用缺失(attempt)
正确流程:cocos_prefab edit_enter → mount_script → set_property →
edit_save → edit_exit。
prefab 仍然缺 __scriptAsset 字段(Cocos 期望 __type__ + __scriptAsset 共存)。
需要进一步排查 cocos-mcp-server 的 prefab 序列化机制。
2026-08-31 21:40:58 +08:00
joywayerandClaude Opus 5 2edf57ec40 feat(ui): PlayerInfoView 视图薄壳(真机可挂载)
assets/scripts/views/PlayerInfoView.ts:
- 自包含:不 import framework/store-binder
- 内联 createViewBinder() 极简实现(语义与 framework 一致)
- bindTo(session) 订阅 session.player.state → applyPlayer → Label.string
- 替代旧 setHallRoomCard 等手工回调

关键发现(memory cocos-mcp-mount-script-blocker):
- Cocos 3.8 只扫 assets/script(s)/ 作为脚本目录
- assets/framework/ 下的 .ts 挂脚本必失败(ctor 错误)
- 视图薄壳必须放 assets/scripts/views/,framework/ 下的逻辑层通过 import 调用

mount_script 实证:assets/scripts/views/PlayerInfoView.ts 挂载成功
(MCP 返回 success + componentType UUID,无 ctor 错误)。

已知副作用:cocos_prefab create 后 prefab 没序列化 __scriptAsset 字段,
import 报 ctor 错误。MCP create prefab 的 bug,需要后续用编辑器手动挂或写扩展。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-31 21:28:41 +08:00
joywayerandClaude Opus 5 c57d1d9214 feat(framework): StartupOrchestrator 启动链路编排
串联启动门控四条件(C 规范 §6.1)的可测部分:
- bootstrap() 拉取并解析远程配置,写入 AppStore(identity/servers)
  失败显式抛错(第二准则)
- onLogin() 收到 player_login 后构造 NetClient + RoomRPCBus
  并触发 ready 信号
- waitForReady() 合并 bootstrap + login + room rpc 通道
  UI 层 await 即可进入登录页
- shutdown() 清理 RoomRPCBus

依赖注入:
- getBootstrapResult: 远程配置拉取函数(测试可 mock 抛错)
- makeNetClient: NetClient 工厂(避免测试需要真 WS)
- roomBusFactory: RoomRPCBus 工厂(避免测试起副作用)

167/167 tests pass, typecheck exit 0。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-31 21:27:14 +08:00