Phase 6 commit C:backgameData pop + getWebdata 反向 callback
- 新增 Source/Bridge/Handlers/BackGameDataHandler.swift(仅 SubGameViewController 注册):
- 调 AudioPlayer.stopAllBackground 停背景音
- AppCoordinator.popSubGame(returningData:) → popViewController + 发 .subGameDidReturn
- data 兼容 string / object(非字符串走 JSONSerialization 序列化透传)
- 字面 cb "backgameData"(msext gameController.m:691-709 等价,
WXApi 清理跳过 — 微信 SDK 待 Phase 4.E)
- AudioPlayer.stopAllBackground:无条件停背景音(msext 不看 type 直接 nil 行为)
- SubGameViewController.registerBridgeHandlers:挂上 BackGameDataHandler,
注释更新 exitRoom/getVideoinfo/createRoom 推迟到 Phase 8
- WebContainerViewController:在 setupExternalSubscriptions 挂 .subGameDidReturn
观察者 → bridge.call("getWebdata", .string(data)),teardown 时 removeObserver
(生命周期与 battery/network/appservice 同一对,子游戏栈顶时大厅已 teardown
避免双发)
- Plan §5.6.3 / 6.5 / 6.6 / §8 进度已勾选
至此 SwitchOverGameData → push 子游戏 → backgameData → pop + getWebdata
完整链路接通;子游戏视频房间(exitRoom/getVideoinfo/createRoom)留待 Phase 8。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
a9eaf86c63
commit
5f3a435180
@@ -82,4 +82,15 @@ public final class AudioPlayer {
|
||||
backgroundType = nil
|
||||
Self.log.debug("stopBackground done type=\(type, privacy: .public)")
|
||||
}
|
||||
|
||||
/// 无条件停止当前背景音。子游戏 `backgameData` 退出时统一调一次
|
||||
/// (msext gameController.m:693-697 行为:不看 type,直接 stop + nil)。
|
||||
public func stopAllBackground() {
|
||||
guard backgroundPlayer != nil else { return }
|
||||
let oldType = backgroundType ?? "nil"
|
||||
backgroundPlayer?.stop()
|
||||
backgroundPlayer = nil
|
||||
backgroundType = nil
|
||||
Self.log.debug("stopAllBackground done (was type=\(oldType, privacy: .public))")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user