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:
48
tools/sync_theme_nprop_ground.py
Normal file
48
tools/sync_theme_nprop_ground.py
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env python3
|
||||
"""为 themes-database.json 各主题写入 propGround(nProp)路径及 entityDisplay 默认值。"""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
PROJECT = Path(__file__).resolve().parent.parent
|
||||
DB_PATH = PROJECT / "assets/resources/theme/themes-database.json"
|
||||
|
||||
# 各主题 prop → nProp 贴图(resources 相对路径,无 .png)
|
||||
PROP_GROUND: dict[str, str] = {
|
||||
"silu": "textures/silu/nProp_kuai1",
|
||||
"sanxing": "textures/sanxing/nProp_kuai1",
|
||||
"snow": "textures/snow/nProp_kuai2",
|
||||
"chinese": "textures/chinese/nProp_Dumpling",
|
||||
"numMan": "textures/numMan/nProp_kuai",
|
||||
"redarmy": "textures/redArmy/nProp_star",
|
||||
}
|
||||
|
||||
DEFAULT_BLOCK_Y = 14
|
||||
DEFAULT_GROUND_Y = -11
|
||||
DEFAULT_MOVER_EMPTY_Y = 25
|
||||
|
||||
|
||||
def main() -> None:
|
||||
db = json.loads(DB_PATH.read_text(encoding="utf-8"))
|
||||
for theme_id, ground_path in PROP_GROUND.items():
|
||||
theme = db.get("themes", {}).get(theme_id)
|
||||
if not theme:
|
||||
print(f"skip missing theme: {theme_id}")
|
||||
continue
|
||||
theme.setdefault("entities", {})["propGround"] = ground_path
|
||||
ed = theme.setdefault("entityDisplay", {})
|
||||
prop_scale = ed.get("prop", {}).get("scale", 1)
|
||||
ed.setdefault("propGround", {"scale": prop_scale})
|
||||
ed.setdefault("propBlockYOffset", DEFAULT_BLOCK_Y)
|
||||
ed.setdefault("propGroundYOffset", DEFAULT_GROUND_Y)
|
||||
ed.setdefault("moverEmptyCellYOffset", DEFAULT_MOVER_EMPTY_Y)
|
||||
png = PROJECT / "assets/resources" / f"{ground_path}.png"
|
||||
status = "ok" if png.is_file() else "MISSING"
|
||||
print(f" {theme_id}: propGround={ground_path} [{status}]")
|
||||
DB_PATH.write_text(json.dumps(db, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
|
||||
print(f"Updated {DB_PATH}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user