fix: descend undo notes and smooth next-level transitions

This commit is contained in:
toshiocn
2026-10-23 16:02:03 +08:00
parent 90d83b3903
commit 0cefce44ef
26 changed files with 301 additions and 26 deletions
+5 -1
View File
@@ -1,3 +1,4 @@
import {buildPreparedRoutes} from './prepared-routes-build.mjs';
import {buildMusic} from './music-assets.mjs';
import {applyLayeredFeedback} from './layered-feedback-build.mjs';
import {buildAudio} from './audio-assets.mjs';
@@ -7,7 +8,7 @@ import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { build } from 'esbuild';
const root = path.dirname(fileURLToPath(import.meta.url));
buildAudio(root);buildMusic(root);
buildAudio(root);buildMusic(root);buildPreparedRoutes(root);
await build({ absWorkingDir: root, entryPoints: ['src/main.mjs'], outfile: 'game.js', bundle: true, format: 'iife', platform: 'neutral', target: 'es2019', minify: true, plugins: [{ name: 'wechat-host', setup(b) {
b.onLoad({ filter: /upstream[\\/]ui\.mjs$/ }, args => {
let contents = fs.readFileSync(args.path, 'utf8');
@@ -46,6 +47,9 @@ export function renderLesson(target,l,route,w,h){
contents+=`
export function resumeGameplay(){const saved=readResume(localStorage),target=resumeTarget(playLevels,completed,saved,level.id);if(level.id!==playLevels[target.index].id||cleared){start(target.index,false);path=validResumePath(level,target.path,canAppend);draw();}showPlay();}
`;
const solveSeam='solution=solve(level)[0]';if(!contents.includes(solveSeam))throw Error('Prepared-route seam changed');contents=contents.replace(solveSeam,'solution=[...prepared.routes[level.id]]');
const firstDraw='if(open)showPlay();draw();';if(!contents.includes(firstDraw))throw Error('Initial board draw seam changed');contents=contents.replace(firstDraw,'if(open)showPlay();else draw();');
contents="import prepared from '../prepared-routes.json';\n"+contents;
contents=applyBrightClassroom(contents);
contents=applyLayeredFeedback(contents);
contents=contents.replace(' if(previewOnly)return;updateTutorial(bad);',' if(previewOnly)return;persistResume();updateTutorial(bad);');