Files
SoundGame Dev cc0f8c008d HTML5 重写:6 款游戏 + 用户系统 + 全局设置 + 5 轮迭代重构
- 新增 web/ 纯音频 HTML5 平台:共享引擎(手势/WebAudio 三层/设置/震动)、
  Node 零依赖服务器(静态 + 注册登录 + 进度存档 API)
- 游戏:剑与声(RPG 新作)、声命线、暗室(重设计)、音序回响(重设计)、
  节拍行者(跟随领奏重构)、盲航(同向闪避重构);声东击西删除
- 全局功能:男声/女声双套 TTS 资产、三档语速、BGM 音量三档、
  震动反馈语言(10 种震型)、服务器进度同步
- 资产:899 ogg + 899 m4a(Qwen3-TTS 双性别语音、Stable Audio 3 音效、
  Mureka BGM 4+3 首),终检零缺失
- 文档:docs/design/ 13 篇设计审查文档、docs/audio/ 资产管线、
  web/server/README.md API 文档
2026-08-29 21:55:44 +08:00

49 lines
1.5 KiB
Python
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.
"""资产清单校验:game.js 引用的每个音频 id 都必须有 .ogg 和 .m4a。
- 提取所有 'bgm/xxx' 'voice/xxx' 'sfx/xxx' 字面量 id;
- numIds() 里动态拼的 voice/num_${k}(k=0..9)特判展开。
用法:python3 gen/check_assets.py
"""
import os
import re
import sys
HERE = os.path.dirname(__file__)
GAME_DIR = os.path.normpath(os.path.join(HERE, ".."))
AUDIO = os.path.join(GAME_DIR, "audio")
src = ""
for js in ("game.js", "index.html"):
with open(os.path.join(GAME_DIR, js), encoding="utf-8") as f:
src += f.read()
ids = set(re.findall(r"['\"]((?:bgm|voice|sfx)/[a-z0-9_]+)['\"]", src))
# 动态拼接的数字语音 voice/num_0 .. voice/num_9
if re.search(r"voice/num_\$\{", src) or "voice/num_" in src:
ids.update(f"voice/num_{k}" for k in range(10))
missing = []
for aid in sorted(ids):
for ext in (".ogg", ".m4a"):
if not os.path.isfile(os.path.join(AUDIO, aid + ext)):
missing.append(aid + ext)
print(f"引用音频 id 数: {len(ids)}")
if missing:
print("缺失文件:")
for m in missing:
print(" ", m)
sys.exit(1)
# 反向检查:目录里有但代码没引用的资产(提示,不失败)
unreferenced = []
for layer in ("bgm", "voice", "sfx"):
d = os.path.join(AUDIO, layer)
for f in os.listdir(d):
if f.endswith(".ogg") and f"{layer}/{f[:-4]}" not in ids:
unreferenced.append(f"{layer}/{f}")
if unreferenced:
print("未被引用的资产(提示):", ", ".join(sorted(unreferenced)))
print("OK:全部引用 id 均有 .ogg 与 .m4a")