Files
youle_cocos/cocoscreator_projects/YouleNexus/extensions/youle-version-manifest
joywayer 35216f75e7 feat: integrate room framework and isolated subgame bundles
Complete room UI and protocol integration, move game definitions and resources behind bundle entries, publish authoritative version XML, and document single-game builds. Include all current resource changes and experiment artifacts.
2026-09-09 03:13:18 +08:00
..

Youle Version Manifest

Cocos Creator 3.8.8 Web Desktop / Web Mobile 构建扩展,无需编译扩展或手动复制 XML。

在 YouleNexus 编辑器「扩展 → 扩展管理器 → 项目」中刷新并启用 Youle Version Manifest。已启用后,正常使用「项目 → 构建发布」构建 Web Desktop 或 Web Mobile。新增扩展若未出现,刷新扩展列表或重开工程。构建日志应出现 [youle-version-manifest] <gameKey>: <输出路径>/version.xml。

扩展通过构建任务 startScene 和 Asset DB query-path 获取真实启动场景,只读检查其中唯一、启用且节点层级激活的 SubgameAssets.gameKey,不另设游戏选择配置。按应用约定,从 assets/games/*/resources/<gameKey>/version.xml 查找唯一 XML;使用应用的 version-manifest.js 解析器验证。XML 字节原样写到 Cocos result.paths.output,与实际 index.html 同级,不使用构建路径猜测。

resources.meta 必须通过编辑器配置为 userData.isBundle=true、userData.bundleName="version-<gameKey>",否则立即终止构建。运行时先加载 version-<gameKey> bundle,再从该 bundle 加载 <gameKey>/version TextAsset;嵌套 resources 文件夹不会自动进入全局 resources bundle。

构建前保存场景、脚本 UUID 元数据、bundle 元数据与 XML 快照;构建后核对这些源文件、启动场景配置及 result.settings.launch.launchScene,并检查 result.settings.assets.projectBundles 包含 version-<gameKey>,再发布 XML。缺失、无效、重复、未选择、bundle 被构建配置排除或构建期间发生变化会抛错终止构建(throwError=true)。失败构建不应发布。

源 XML 同时由 Cocos 作为该游戏 version-<gameKey> bundle 的 <gameKey>/version 导入;发布的根目录 XML 供外部读取。二者只有这一份源 XML。扩展不修改服务器、运行时配置、场景或资源元数据。

开发验证:在仓库根目录运行 node --test cocoscreator_projects/scripts/test/version-manifest-build.test.mjs。测试使用临时输出目录验证两个游戏选择、字节保真及错误路径;真实编辑器构建还需检查日志与输出 XML。

API 核对来源:本机 Creator 3.8.8 resources/app.asar.unpacked/builtin/builder/build-plugin-template、@types/public/build-plugin.d.ts、@types/public/build-result.d.ts。