Files
cocos/tools/sync-level-db.sh
刘宇飞 d393302388 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>
2026-06-16 15:30:58 +08:00

32 lines
1.1 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# 从 Cocos 工程导出 levels-database.json权威数据源
#
# bash tools/sync-level-db.sh
#
# 地图/主题level-prefabs/Level*.prefab → LevelMapData
# spawns保留当前 levels-database.json 中由关卡编辑器维护的条目
# Unity 主站不参与此流程(仅作 ID 对照参考时用 sync-reference-from-unity.sh
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
OUT="$ROOT/assets/level-data/levels-database.json"
PREFAB_LEGACY="$ROOT/assets/resources/level-prefabs"
PREFAB_BUNDLE="$ROOT/assets/bundle-level-prefabs/level-prefabs"
if [[ -d "$PREFAB_BUNDLE" ]]; then
PREFAB_SRC="$PREFAB_BUNDLE"
else
PREFAB_SRC="$PREFAB_LEGACY"
fi
echo "==> 从 Cocos 导出关卡库"
echo " 预制体: $PREFAB_SRC"
echo " 输出: $OUT"
python3 "$ROOT/tools/export_cocos_level_db.py" \
--project "$ROOT" \
--output "$OUT"
echo "==> 完成。请在 Cocos Creator 中重新构建 Web再 bash tools/package-for-project.sh && import-to-unity.sh"
echo " 关卡库: assets/level-data/levels-database.json不进 resources bundle"