Files
NumberSwipe_New/campaign-200/tools/overview.mjs
T

2 lines
2.3 KiB
JavaScript
Raw 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.
import fs from 'node:fs';import {fileURLToPath} from 'node:url';const root=new URL('../',import.meta.url),p=JSON.parse(fs.readFileSync(new URL('levels.json',root))),plan=JSON.parse(fs.readFileSync(new URL('plan.json',root))),n=JSON.parse(fs.readFileSync(new URL('design.json',root)));const names={big:'大块',direction:'方向',alternation:'双色',parity:'奇偶',walls:'墙',"rhythm-door":'门'};const bars=p.levels.map(l=>`<button title="第${l.order}关 ${l.title} · 目标${l.targetDifficulty}" data-order="${l.order}" style="height:${Math.max(3,l.targetDifficulty)}%;background:${l.tutorial?'#F5A524':l.role==='回落'?'#6DBF9C':'#6558F5'}"></button>`).join('');const items=p.levels.map(l=>`<article id="level-${l.order}"><b>${l.order} · ${l.title}</b><small>${l.chapterTitle} · ${l.role} · ${l.cells.length}格 · ${l.geometry}</small><p>${l.caption}</p><span>${l.features.map(f=>names[f]).join('+')||'基本覆盖'} · 目标${l.targetDifficulty}</span></article>`).join('');const html=`<!doctype html><html lang="zh-CN"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>200关编排与目标曲线</title><style>body{max-width:1080px;margin:24px auto;padding:0 16px;background:#f2f2f6;color:#23243a;font:15px/1.6 system-ui}a{color:#6558f5}.chart{height:220px;display:flex;align-items:end;gap:2px;background:white;padding:16px;overflow:auto}.chart button{flex:1;min-width:3px;border:0;padding:0;cursor:pointer}main{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:12px}article{padding:16px;background:white;border-radius:14px;scroll-margin:24px}small,span{display:block;color:#6b6d80}h1{font-size:26px}</style><h1>200关编排与目标曲线</h1><p><a href="index.html">进入200关试玩</a> · <a href="DESIGN.html">查看逐关作者解与必要性反例</a></p><p>20章×10关。橙色为极简教学,绿色为回落,紫色为练习与挑战。柱高是策划目标,尚未经真人难度校准。点击柱条定位关卡。</p><div class="chart">${bars}</div><h2>逐关任务</h2><main>${items}</main><script>document.querySelectorAll('[data-order]').forEach(b=>b.onclick=()=>document.getElementById('level-'+b.dataset.order).scrollIntoView({behavior:'smooth'}))</script></html>`;fs.writeFileSync(new URL('DIFFICULTY.html',root),html);console.log('Built target difficulty overview.');