Răsfoiți Sursa

feat: 接入 AI 位面主题卡图与世界树主视觉,补树形 favicon 并放行 assets 图片

- 位面面板每张卡片顶部加 16:9 圆角主题卡图,onerror 自动移除优雅降级
- void-escape 作为「世界树 · 空洞之外」圆角卡图置于位面列表下方
- 新增 assets/favicon.svg(树形),替换浏览器默认空白图标
- .gitignore 放行 assets/*.png 与 assets/*.svg

署名:FmodeCode
LiuYuYang 1 săptămână în urmă
părinte
comite
6d6d5f0860

+ 3 - 1
.gitignore

@@ -1,3 +1,5 @@
 assets/*
-!.gitkeep
+!assets/*.png
+!assets/*.svg
+!assets/.gitkeep
 node_modules/

+ 1 - 0
assets/favicon.svg

@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 22V9M12 14 6.5 9M12 12l5.5-5M12 17l-4-3M12 16l4-3" stroke="#5FD68A" stroke-width="1.8" stroke-linecap="round" fill="none"/><path d="M11 6.8a3 3 0 0 1 4 0" stroke="#5FD68A" stroke-width="0" /><circle cx="6.5" cy="9" r="1.8" fill="#5FD68A"/><circle cx="17.5" cy="7" r="1.8" fill="#B7E4C7"/><circle cx="8" cy="14" r="1.4" fill="#B7E4C7"/><circle cx="16" cy="13" r="1.4" fill="#5FD68A"/><path d="M4 22h16" stroke="#5FD68A" stroke-width="1.6" stroke-linecap="round"/></svg>

BIN
assets/realm-magic.png


BIN
assets/realm-reality.png


BIN
assets/realm-tech.png


BIN
assets/realm-xiuxian.png


BIN
assets/void-escape.png


+ 7 - 0
css/style.css

@@ -205,6 +205,13 @@ button:disabled { cursor: not-allowed; opacity: .45; }
 
 /* ── 位面 ── */
 .plane-list { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
+.plane-card .art { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 9px; margin: -8px -9px 7px; box-sizing: content-box; width: calc(100% + 18px); background: #eceff3; }
+.plane-card.locked .art { filter: saturate(.55); }
+/* 世界树主视觉:位面面板底部圆角卡图(不干扰行军 canvas) */
+.tree-art { margin: 10px 0 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); position: relative; background: #0c111c; }
+.tree-art img { display: block; width: 100%; aspect-ratio: 21 / 9; object-fit: cover; object-position: 50% 45%; }
+.tree-art figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 10px 6px; font-size: 10.5px; color: #dfe8f5; background: linear-gradient(transparent, rgba(8,12,20,.72)); }
+.tree-art figcaption b { color: #7BE3A6; }
 .plane-card { border: 1px solid var(--line); border-radius: 9px; padding: 8px 9px; background: #fff; text-align: left; position: relative; overflow: hidden; }
 .plane-card .tier { position: absolute; right: 0; top: 0; font-size: 9px; color: #fff; padding: 1px 6px; border-bottom-left-radius: 6px; }
 .plane-card.cur { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }

+ 1 - 0
index.html

@@ -5,6 +5,7 @@
   <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover, maximum-scale=1">
   <meta name="theme-color" content="#121a2b">
   <title>世界树 · 逃离空洞</title>
+  <link rel="icon" type="image/svg+xml" href="assets/favicon.svg">
   <link rel="stylesheet" href="css/style.css">
 </head>
 <body>

+ 4 - 4
js/config.js

@@ -246,16 +246,16 @@ export const CRISIS = {
 
 // ── 位面(4 阶,规则松绑梯度) ─────────────────────────────
 export const PLANES = [
-  { id: 0, key: 'real', tier: '一阶', name: '现实位面', metric: '文明等级', essence: '认知本源', color: '#5FA8D3', accent: '#9BD1F5',
+  { id: 0, key: 'real', img: 'assets/realm-reality.png', tier: '一阶', name: '现实位面', metric: '文明等级', essence: '认知本源', color: '#5FA8D3', accent: '#9BD1F5',
     lore: '一切规则最严密的地方。这里没有魔法,只有因果、工程与不肯放弃的人。',
     rule: '坚固因果:全参数基准 ×1.00', bonus: '文明演进:文明事件链驱动主线' },
-  { id: 1, key: 'tech', tier: '二阶', name: '科技位面', metric: '自动化覆盖率', essence: '信息本源', color: '#6C5CE7', accent: '#B7A8FF',
+  { id: 1, key: 'tech', img: 'assets/realm-tech.png', tier: '二阶', name: '科技位面', metric: '自动化覆盖率', essence: '信息本源', color: '#6C5CE7', accent: '#B7A8FF',
     lore: '无人值守的城市里,机器替人类继续演算。自动化是这个世界唯一的信仰。',
     rule: '自动化闭环:每秒为已解锁兵种免费 +1 级(上限 5 级)', bonus: '时间压缩:推进速度 ×1.25;锚定采集 ×1.25' },
-  { id: 2, key: 'magic', tier: '三阶', name: '魔幻位面', metric: '魔力浓度', essence: '精神本源', color: '#C77DFF', accent: '#F0B2FF',
+  { id: 2, key: 'magic', img: 'assets/realm-magic.png', tier: '三阶', name: '魔幻位面', metric: '魔力浓度', essence: '精神本源', color: '#C77DFF', accent: '#F0B2FF',
     lore: '故事在这里是真实的燃料。只要还有人在讲述,世界就不会熄灭。',
     rule: '叙事即魔法:每次跳关本源产出 ×1.3,持续 12 秒(叠乘,最多 10 层)', bonus: '故事共鸣:跳关触发率 +10%' },
-  { id: 3, key: 'xiuxian', tier: '四阶', name: '修仙位面', metric: '灵气浓度', essence: '道之本源', color: '#2DD4BF', accent: '#FFD27A',
+  { id: 3, key: 'xiuxian', img: 'assets/realm-xiuxian.png', tier: '四阶', name: '修仙位面', metric: '灵气浓度', essence: '道之本源', color: '#2DD4BF', accent: '#FFD27A',
     lore: '大道无情,天道有功。修士以百年为一步,而你有世界树。',
     rule: '大道预算:转生结晶 ×1.5', bonus: '道基:转生返还本轮 50% 本源、起始层 +100、兵种保留 ×2' },
 ];

+ 6 - 0
js/ui.js

@@ -423,7 +423,10 @@ export class App {
       const unlocked = C.planeUnlocked(s, i);
       const tier = C.exploreTierOf(ex);
       const lock = i > 0 ? C.PLANE_UNLOCK_AT.find((u) => u.plane === i) : null;
+      // 主题卡图:缺失(img 未登记或加载失败)时 onerror 隐藏,退回纯文字卡,不留裂图
+      const art = p.img ? `<img class="art" src="${p.img}" alt="${p.name}" loading="lazy" decoding="async" onerror="this.remove()">` : '';
       return `<button class="plane-card ${s.currentPlane === i ? 'cur' : ''} ${unlocked ? '' : 'locked'}" data-act="plane" data-p="${i}" ${unlocked ? '' : 'disabled'}>
+        ${art}
         <span class="tier" style="background:${p.color}">${p.tier}</span>
         <div class="nm">${p.name}</div>
         <div class="met">${p.metric} · ${p.essence}</div>
@@ -433,8 +436,11 @@ export class App {
       </button>`;
     }).join('');
     const p = C.PLANES[s.currentPlane];
+const WORLDTREE_ART = '<figure class="tree-art"><img src="assets/void-escape.png" alt="空洞之外" loading="lazy" decoding="async" onerror="this.parentNode.remove()"><figcaption><b>世界树</b> · 空洞之外,根须仍在生长</figcaption></figure>';
+
     this.html('#planes', `<div class="panel-title">位面 · 规则模板</div>
       <div class="plane-list">${cards}</div>
+      ${WORLDTREE_ART}
       <div class="plane-note"><b>${p.name}规则</b>:${p.rule}<br><b>加成</b>:${p.bonus}</div>`);
   }
 

+ 44 - 0
任务书-v2-素材整合.md

@@ -0,0 +1,44 @@
+# 任务书 —《世界树 · 逃离空洞》AI 素材整合与收尾打磨
+
+> 你是 FmodeCode。游戏本体已开发完成并通过测试(单元测试 41 项全过、平衡模拟 89 轮回、e2e 四 tab 全通)。本任务是**收尾整合**:把已生成的 AI 位面主题图接入游戏、修小瑕疵、做最终验收。署名一律 FmodeCode,禁止出现 Hermes/Claude/DeepSeek。
+
+## 背景(已完成,勿重做)
+- 项目目录 `/opt/data/git-repos/worldtree-escape/`,游戏已可玩(index.html + css/style.css + js/ 10 模块 + tests/)
+- 纯 CSS/SVG 手绘图标,浅色底 + 深墨蓝 + 生命绿/金 主题,四阶位面各有专属色
+- 存档走 localStorage,转生/里世界/连续行军/事件系统均已实现
+
+## 本任务要做的三件事
+
+### 1. 接入 AI 位面主题图
+AI 已生成的位面插画在 `/opt/data/tmp/worldtree-art/*.png`:
+- `worldtree-main.png` — 世界树主视觉(发光世界树+星云)
+- `realm-reality.png` — 现实位面
+- `realm-tech.png` — 科技位面
+- `realm-magic.png` — 魔幻位面(可能缺失,缺则跳过)
+- `realm-xiuxian.png` — 修仙位面(可能缺失,缺则跳过)
+- `void-escape.png` — 空洞/标题氛围图(可能缺失,缺则跳过)
+
+做法:
+1. 把存在的图**复制**到 `assets/`(保持原名小写,如 `assets/realm-reality.png`)
+2. 在**位面面板**(`js/ui.js` 里 `#planes` 的渲染处)给每个位面加一张**圆角主题卡图**(`<img>` 标签,`width:100%`,`object-fit:cover`,圆角与卡片一致),图在卡片顶部、文字在下。**图缺失的位面优雅降级**(`onerror` 隐藏 img,不留裂图)
+3. 世界树主视觉 `worldtree-main.png` 接入主界面:建议放在行军区(`#canvas-wrap`)下方或作为「世界树」成长面板的配图,圆角卡片呈现,不干扰行军 canvas
+4. 保持现有 CSS/SVG 图标与配色不动,图是**增强**不是替换
+
+### 2. 修小瑕疵
+- 排查并修掉任何「非树的 emoji 出现在标题/品牌位」(浏览器曾显示 🐴,疑似 favicon 或 document.title 注入,grep 全仓 🐴🐎🌲 确认)
+- 检查移动端(375px 视口):四 tab 不溢出、canvas 缩放正常、位面卡图不撑破布局
+
+### 3. 最终自测
+- 重新跑 `node tests/unit.mjs`(必须全过)、`node tests/balance-sim.mjs`
+- 本地 `python3 -m http.server` 起服,用真实浏览器过一遍四 tab + 转生 + 里世界,控制台 0 错误
+- 确认 assets/*.png 全部被正确引用且无 404
+
+## 验收标准(达不到继续改)
+1. 位面面板每个**已有图**的位面都显示主题卡图,无裂图、无 404
+2. 缺图位面优雅降级(不显示破图图标)
+3. 移动端 375px 视口布局不错乱
+4. 单元测试全过、控制台 0 错误
+5. 全仓 grep `Hermes|Claude|DeepSeek|🐴` 为 0
+
+## 交付
+完成上述后,`git add -A && git commit`(消息带 feat/fix 前缀),然后输出一句话总结你改了什么、测试结果。