实现子游戏按需下载,修复点子游戏白屏(§11.1 路径A)

根因:整包 gamehall.zip 顶层只含 gamehall,子游戏需按需单独下载;原 switchGame
直接 loadUrl 不存在的目录 → ArkWeb invalidFileUrl → 白屏。

对齐 Android NewwebviewActivity 的 updategamezip:
- ConfigManager.resolveGame(remote, gameid):以 gamedownloadurl 为 gameid 经
  agent→game→channel→market 分层解析子游戏 game_zip/game_version(复用 VersionResolver)。
- ResourceManager.updateSubgame:下载→暂存解压→校验 <dir>/index.html→原子换入 urlpath/<dir>。
  另加 subgameInstalled/subgameLocalVersion/subgameLocalGameId。
- BridgeGameContainer.switchGame 改 async + prepareSubgame:目录缺失先下载、已装比对远程
  版本更高才更新;下载期复用启动页同款金色进度条;远程配置 10 分钟缓存(对齐 gameconfigtime)。
- SwitchGamePayload 增 gameId(gamedownloadurl)。

真机验证:点三个老K → 下载 sangelaok.zip(9.4M) → 解压加载,子游戏正常渲染
(V1.155 与配置 game_version=155 一致);日志不再 invalidFileUrl。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
lanterngamescn
2026-06-27 02:33:55 +08:00
co-authored by Claude Opus 4.8
parent e75f567948
commit de5b950d9b
5 changed files with 192 additions and 4 deletions
+2
View File
@@ -28,6 +28,8 @@ export interface SwitchGamePayload {
webtype: string;
/** 目标游戏目录名 */
dir: string;
/** 游戏 idgamedownloadurl 字段):按需下载时经分层配置解析 game_zip 用。 */
gameId: string;
data: string;
}