居中标题并接入指定WAV与随机关卡音乐

This commit is contained in:
toshiocn
2026-10-23 12:52:55 +08:00
parent eeff9373f2
commit c13b850fb2
39 changed files with 305 additions and 56 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ export function browserAudio(report){
stop(){generation++;player.pause();if(player.readyState)player.currentTime=0;},
play(){
const current=generation;
player.play().then(()=>{if(!disposed&&current===generation){playHandler();report('音效已播放 · '+(++plays)+' 次');}})
player.play().then(()=>{if(!disposed&&current===generation){playHandler();report((player.loop?'音乐':'音效')+'已播放 · '+player.src.split('/').at(-1)+' · '+(++plays)+' 次');}})
.catch(reason=>{if(current===generation)error(reason);});
}
};
Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

@@ -0,0 +1,115 @@
> numberswipe-main@1.0.0 check
> npm run build && npm test && npm run smoke
> numberswipe-main@1.0.0 build
> node build.mjs
Built campaign-200-r2: 200 levels
> numberswipe-main@1.0.0 test
> node --test *.test.mjs
✔ 手机没有浏览器音频接口时,原生播放器仍能播放全部 36 步和六类反馈音 (14.9009ms)
✔ 关闭音效停止播放;再次开启会试听并保存偏好;后台中断停止所有播放器 (2.1632ms)
✔ 延迟通关音在静音或进入后台时取消,不在返回后突然播放 (54.554ms)
✔ 音频错误可诊断,不再静默吞掉 (1.5022ms)
✔ 所有音频均为非静音 PCM;原版第13步比第1步高一个八度 (50.2806ms)
✔ 教学和组合规则用具体动作及奇偶例子解释,没有未解释的术语 (34.0885ms)
✔ 过关提示同步使用实际播放起点,非请求时间 (0.6778ms)
✔ 过关短句使用用户提供的3秒WAV,不与旧和弦叠加 (2.7838ms)
✔ merged irregular outlines retain holes and never draw internal unit edges (94.9455ms)
✔ all 200 boards fit four screen budgets with stable safe anchors and real shared entrances (1024.4193ms)
✔ guides through every irregular block stay inside its occupied shape (38.5314ms)
✔ visited, conflicting and hinted category cells retain their material identity (13.3387ms)
✔ five font subsets match their manifest and fit the package budget (4.7748ms)
✔ upstream adapter fails closed if the inspected render seams change (1.1066ms)
✔ procedural cushion pixels preserve holes and light the upper bevel without a border (23.2625ms)
✔ visible glyph bounds are centered independently of font ascent and side bearings (2.0215ms)
✔ stage with zero depth casts alpha shadows without painting a solid backing (11.0858ms)
✔ native width-only TextMetrics still centers the rasterized glyph ink (3.2947ms)
✔ fixed channels remain anchored at their block centers after number enlargement (1060.741ms)
✔ checkpoint ribbons trigger on correct arrival only and never duplicate per frame (2.5724ms)
✔ checkpoint pulse is small, centered in time and settles without looping (0.458ms)
✔ event batches preserve every landing and sequence but commit only highest audio and haptic (6.5873ms)
✔ completion waits at most 120ms and ignores late audio callbacks (1.2868ms)
✔ light haptics are limited, checkpoint replaces light, and completion adds only one delayed short pulse (1.6916ms)
✔ unsupported graded haptic falls back to one short pulse, never long vibration (1.0837ms)
✔ haptic disable, preview and lifecycle cancellation suppress delayed or expired work (0.6282ms)
✔ late failed haptic requests cannot revive old pulses and ungraded completion falls back once (0.38ms)
✔ rectangles, concave shapes and hexagons require geometric inward distance without treating internal seams as walls (1.3569ms)
✔ one high-speed native move records all intermediate cells and completion without duplicate final node (207.1856ms)
✔ legal but off-solution moves use public rules, while invalid clues only produce error (148.4917ms)
✔ drag near a previous-block boundary cannot undo; deeper entry can, and undo button remains immediate (86.424ms)
✔ tutorial, redraw, hint and restored saved routes do not generate player feedback (134.7882ms)
✔ pressure and rebound have bounded amplitude and duration (0.6392ms)
✔ interpolation cannot duplicate the same failed-cell event within one native movement (0.5552ms)
✔ nodes are driven by explicit events even when multiple arrive before rendering; at most two ribbons survive (46.156ms)
✔ audio fast moves merge to latest pitch and completion stops the whole four-channel pool (3.0031ms)
✔ settings persist haptic preference independently and chapter cards always use three columns (109.6829ms)
✔ original audio is preserved and high pitches lose energy rather than growing sharper (17.1175ms)
✔ empty, partial and wrong routes reveal the first incomplete full segment (5.642ms)
✔ completion hides the hint; repeat clicks cannot skip; undo and restart return to earlier segments (9.2333ms)
✔ all 200 levels reveal consecutive segments without changing the player path (2016.9027ms)
✔ hint draws skip player edges and mask visited cells on their own layer; compositing is restored (1.5701ms)
✔ parity is a segment anchor; colour is not; flow moves continuously across cells (0.6078ms)
✔ coral teaching ribbon preserves visited masks and offers direction in reduced motion (2.9612ms)
✔ hint rounds shared guide junctions and keeps separate runs disconnected (0.6602ms)
✔ 实际教学关动画:basic (5.3181ms)
✔ 实际教学关动画:walls (1.0642ms)
✔ 实际教学关动画:straight (2.4424ms)
✔ 实际教学关动画:vertical (7.5609ms)
✔ 实际教学关动画:corner (1.7796ms)
✔ 实际教学关动画:colour (2.6619ms)
✔ 实际教学关动画:parity (1.9387ms)
✔ 实际教学关动画:rhythm-door (0.9813ms)
✔ 实际教学关动画:hex (0.9572ms)
✔ 实际教学关动画:unknown-start (2.9763ms)
✔ 200关的组合规则均能找到对应真实教学关 (147.2545ms)
✔ 教学减速,结束停留1秒后自动循环 (3.0083ms)
✔ music loops independently, persists mute and cancels in background (2.8131ms)
✔ old arrows retain distance, rush to endpoint and fresh arrows move at base speed (0.9428ms)
✔ settings have exactly three independent preferences, and hint has its own cue (238.1837ms)
✔ actual fixed numeric node uses checkpoint pitch, final cell uses complete chord (167.2175ms)
✔ selected menu and both level loops are stereo PCM WAV with complete musical durations (21.4585ms)
✔ selected four runtime WAVs retain the original durations after sample-rate adaptation (40.46ms)
✔ gameplay ambient uses lower scene volume and keeps independent mute and resume behavior (2.8611ms)
✔ all 200 levels: valid numeric, parity and direction arrivals play checkpoint pitch; final arrival only completes (27899.3609ms)
✔ drag back and undo button both vibrate lightly; disabling vibration suppresses both (58.2145ms)
✔ haptic cadence is approximately 15 percent denser without changing light or medium grades (1.3006ms)
✔ regular and special scale settle at 90ms with a larger special peak (0.4739ms)
✔ rendered undo target and nonnumeric checkpoint animate immediately without adding ribbons (7.5203ms)
✔ quick undo cancels removed node rebound, including last-step removal (2.1063ms)
✔ first launch goes directly to gameplay (148.3509ms)
✔ resume unfinished route after exit from gameplay (194.5898ms)
✔ resume unfinished route after exit from selection (180.1794ms)
✔ completed level resumes next unfinished, including leaving from cleared screen (120.5731ms)
✔ replaying a cleared level does not replace the unfinished save (165.7154ms)
✔ legacy saves, malformed data and full completion have valid startup targets (86.919ms)
✔ selection pages expose fifteen cards and fit phone safe areas (337.4545ms)
✔ hint-only frames reuse static UI, and player input invalidates it (59.5498ms)
✔ hint curves are cached and distance lookup is stable at boundaries (0.9446ms)
✔ new-mechanic lesson reuses the board while the continuous cursor advances (52.7928ms)
✔ entering a level chooses either track once; redraw, mute and background resume keep that choice (2.0173ms)
✔ subpackage completion never plays a stale scene after hiding, muting, or clearing (0.592ms)
✔ music load failure is silent and one real resume can retry; muted pending loads stay silent (0.3667ms)
✔ runtime uses supplied WAV hashes and ships music as a subpackage with a small main bundle (279.7373ms)
✔ title is centered and selection settings share the progress and level-range row (294.8849ms)
✔ completion pauses background loop, plays one selected jingle and the next level resumes a loop (172.4642ms)
✔ title artwork is a transparent, high resolution PNG packaged locally (3.6602ms)
✔ asynchronous native image load requests a repaint and draws the artwork without a font substitute (0.8729ms)
✔ artwork stays above progress pills and clear of settings; fifteen cards still fit all phone sizes (406.3256ms)
ℹ tests 89
ℹ suites 0
ℹ pass 89
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 28380.4433
> numberswipe-main@1.0.0 smoke
> node smoke.mjs
PASS 200/200: r2源文件哈希一致、唯一解、微信发布包触摸通关、撤销/重开/指路、存档/音效设置恢复、前后台切换。
@@ -0,0 +1 @@
音效已播放 · complete.wav · 3 次