Skip to content

feat(unity): add maimai DX animated themes - #23

Merged
Swan416ya merged 1 commit into
miaoledor:mainfrom
Swan416ya:add-theme-maimai-dx
Oct 25, 2026
Merged

Swan416ya merged 1 commit into
miaoledor:mainfrom
Swan416ya:add-theme-maimai-dx

Conversation

@Swan416ya

Copy link
Copy Markdown
Collaborator

摘要

新增舞萌DX(maimai DX)Unity UGUI 动态立绘主题 23 个:maimai-navichara-01 … -26(原包缺 07;17、23 是静态联动角色,不单独出主题)。

实现

  • 构建期,不引入 Unity 运行时:scripts/extract-unity-ui.py 用 UnityPy 解析 AssetBundle 的 prefab 层级、RectTransform 姿态、Sprite 与 AnimationClip,导出 assets/unity/<name>/model.json + 无损透明 WebP 分层图;scripts/verify-unity-ui.py 回读校验坐标、图层与换图曲线。
  • 服务端:模型随 embed.FS 打包,新增 GET /api/unity/models 与 GET /unity/models/:name/:file(严格白名单;model.json no-store,分层图 immutable + CORS)。
  • 播放器:web/public/unity-player.html 用 DOM/CSS + rAF 复现 UGUI 变换,随机/点击切换待机动作、contain-fit、{n} 计数 overlay,支持 prefers-reduced-motion 首帧降级与截图用的 thumbnail=1&time=0 固定帧模式。
  • 前端:kind:"unity" 进入 /api/themes;Playground 增加 Unity 筛选、iframe 预览,并把非 PSB 主题的嵌入代码改成对应 player 的 iframe;主题元数据补充舞萌DX游戏分类与 23 个角色。
  • 图库缩略图:scripts/capture-unity-thumbnails.py 用真实播放器按固定待机帧截图 23 张 256×256 透明 WebP(不再取“最大单张贴图”),--check 校验漂移。

测试

  • go vet ./...、go test -count=1 -p 1 ./... 全绿(本地;-race 由 CI 在 Ubuntu 跑)
  • pnpm generate 通过
  • 本地起服务:/api/themes 返回 23 个 kind:"unity";图库 Unity 筛选项 23 张卡片、0 张加载失败、缩略图 256×256;预览 iframe 正常渲染并计数
  • python scripts/capture-unity-thumbnails.py --check → OK: 23 Unity thumbnails match the rendered models
  • /unity-player.html?model=maimai-navichara-20&name=preview 正常显示计数;17/23 号确认不出主题

说明

  • 不打包 Unity 引擎/WebGL runtime,只多出模型字节与一个播放器页面。
  • 缩略图与模型字节绑定;后续若更新模型,需重跑 capture-unity-thumbnails.py,--check 会报出漂移。
  • 原 AssetBundle 素材版权归权利方所有,与现有动态主题一致,仅作演示。

Import the 25 navichara models from the maimai DX AssetBundles (23 shipped:
07 is absent from the bundle, 17 and 23 are static partner characters) as
browser-playable themes. A build-time extractor turns the prefab hierarchy,
RectTransform poses and animation curves into model.json plus lossless WebP
layers; the server embeds them under assets/unity and serves whitelisted
manifest and sprite routes (manifests no-store, sprites immutable); and
unity-player.html plays the idle motion with the counter overlay without a
Unity runtime. The playground gains an "unity" kind with its filter entry,
iframe preview and iframe embed snippet, and the gallery thumbnails are
captured from the real player at a fixed frame instead of a single sprite.

构建期把舞萌DX 的 UGUI 导航角色转换成浏览器模型(model.json + 无损 WebP 分层图),
服务端内嵌 assets/unity 并提供白名单接口(manifest no-store、分层图 immutable),
轻量播放器页面播放待机动作并叠加计数;Playground 增加 unity 类型(筛选、iframe
预览与嵌入代码),图库缩略图由真实播放器固定帧生成,共 23 个主题。
@Swan416ya
Swan416ya merged commit 5ff475f into miaoledor:main Oct 25, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant