Complete Cocos Creator port with level bundles, themes, and tooling.

Adds level prefabs, theme assets, audio, extensions, and deployment scripts for the Unity WebGL migration.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-16 15:30:58 +08:00
parent cba5105908
commit d393302388
6248 changed files with 17322729 additions and 11036 deletions

View File

@@ -190,7 +190,82 @@ npx --yes serve . -p 8080
---
## 六、生产环境注意
## 六、CDN 整包发布(对标 Unity mstest5
与 Unity 把 `mstest5/` 整目录上传 CDN 一样Cocos 也支持**单目录静态部署**,无需 Node 服务器。
### 1. 构建 + 打 CDN 包(与 Unity 参考包文件树 100% 一致)
参考 Unity 包:`/Users/liuyufei/tfrh/竞赛/mstest5`
```bash
cd /Users/liuyufei/tfrh/cocos/tfrh001
# ① Cocos Creator项目 → 构建发布 → Web Desktop → 构建
# ② 打成与 Unity 完全相同的目录/文件名
bash tools/package-for-cdn.sh --build build/web-desktop-001
# 输出到竞赛目录旁(便于对比)
bash tools/package-for-cdn.sh --build build/web-desktop-001 --out "/Users/liuyufei/tfrh/竞赛/mstest5-cocos"
```
### 2. 产物结构(与 Unity 参考逐文件对齐)
```
mstest5/
├── index.html
├── Build/
│ ├── mstest5.loader.js
│ ├── mstest5.data.br
│ ├── mstest5.framework.js.br
│ └── mstest5.wasm.br
├── StreamingAssets/aa/
│ ├── catalog.json
│ ├── settings.json
│ ├── AddressablesLink/link.xml
│ └── WebGL/
│ ├── 3a39a2f..._unitybuiltinshaders_....bundle
│ ├── defaultlocalgroup_assets_all_1baf4413....bundle ← Cocos 资源 zip
│ └── defaultlocalgroup_scenes_all_44c83ead....bundle ← Cocos 引擎 zip
└── TemplateData/11 个文件,与 Unity 相同)
```
`index.html` / `TemplateData` / `catalog.json` / `settings.json` / `link.xml` / `unitybuiltinshaders.bundle` **直接复制 Unity 参考包**Cocos 运行时打进两个 `defaultlocalgroup_*.bundle`,由自定义 `mstest5.loader.js` 解压并启动。
### 3. 上传与访问
1.`mstest5/` 内**全部文件**上传到 CDN 的 **mstest5** 目录(覆盖原 Unity 包)
2. 浏览器打开 `https://你的CDN域名/mstest5/index.html`
3. 主站 iframe 嵌入URL 与 Unity 时代相同,只换引擎):
```html
<iframe src="https://cdn.example.com/mstest5/index.html" width="960" height="600"></iframe>
```
### 4. 构建面板建议CDN 场景)
| 选项 | 建议 |
|------|------|
| 发布平台 | **Web Desktop** |
| 资源服务器地址 `server` | **留空**(资源与页面同域相对路径加载) |
| MD5 Cache | 生产可开启,更新后需刷新 CDN 缓存 |
| 主包压缩 | 默认 `merge_dep` 即可 |
若资源与页面不在同一路径,在构建面板填写 CDN 根 URL 到「资源服务器地址」,例如 `https://cdn.example.com/tfrh001/`
### 5. 与 Unity mstest5 对比
| | Unity mstest5 | Cocos mstest5 |
|--|---------------|-------------------|
| 入口 | `index.html` | `index.html` |
| 运行时 | `Build/*.br` (WASM) | `cocos-js/` + `src/` (JS) |
| 关卡资源 | `StreamingAssets/aa/*.bundle` | `assets/` (JSON + 贴图) |
| JS 桥 | 需主站页挂回调 | 已含 `cocos-bridge.js` |
| Brotli | 需要 `Content-Encoding: br` | 普通静态文件即可 |
---
## 七、生产环境注意
1. **HTTPS**:与 Unity 相同WebGL/Canvas 在混合内容下可能受限
2. **缓存**:构建带 MD5 时,更新后清 CDN 缓存
@@ -199,6 +274,6 @@ npx --yes serve . -p 8080
---
## 、关卡
## 、关卡
已导入 Levels600 共 **600** 关,`SwitchLevel(1..600)` 与 Unity 一致。