优化BGMA连续播放与通关音量压低并强化节点缩放
This commit is contained in:
@@ -8,8 +8,8 @@ test('all 200 levels: valid numeric, parity and direction arrivals play checkpoi
|
||||
test('drag back and undo button both vibrate lightly; disabling vibration suppresses both',()=>{
|
||||
const ui=boot(),route=solve(levels[3])[0];ui.select(3);for(const id of route.slice(0,3)){ui.advance(80);ui.cell(id);}ui.advance(61);let n=ui.vibrated.length;ui.cell(route[1]);assert.equal(ui.api.snapshot().path.length,2);assert.equal(ui.vibrated.length,n+1);assert.equal(ui.vibrated.at(-1).type,'light');ui.advance(61);ui.button('撤销');assert.equal(ui.vibrated.length,n+2);assert.equal(ui.vibrated.at(-1).type,'light');ui.button('设置');ui.button('振动:开');ui.button('完成');ui.advance(80);ui.cell(route[1]);n=ui.vibrated.length;ui.advance(80);ui.button('撤销');assert.equal(ui.vibrated.length,n);assert.equal(ui.api.snapshot().music.playing,'play');});
|
||||
test('haptic cadence is approximately 15 percent denser without changing light or medium grades',()=>{let now=0;const calls=[],h=new Haptics({vibrateShort:o=>calls.push(o.type)},{getItem:()=>null},{now:()=>now});h.play('move');now=60;h.play('undo');assert.deepEqual(calls,['light']);now=61;h.play('undo');assert.deepEqual(calls,['light','light']);h.play('checkpoint');assert.equal(calls.at(-1),'medium');assert.ok(Math.abs(70/FEEDBACK.hapticGapMs-1.15)<.01);});
|
||||
test('regular and special scale settle at 90ms with a larger special peak',()=>{assert.equal(FEEDBACK.moveMs,90);assert.equal(FEEDBACK.checkpointMs,90);assert.equal(landingScale(45),1.025);assert.equal(checkpointScale(45),1.065);for(const t of [-10,0,90,1000]){assert.equal(landingScale(t),1);assert.equal(checkpointScale(t),1);}});
|
||||
test('regular and special scale settle at 90ms with a larger special peak',()=>{assert.equal(FEEDBACK.moveMs,90);assert.equal(FEEDBACK.checkpointMs,90);assert.equal(landingScale(45),1.1);assert.equal(checkpointScale(45),1.3);for(const t of [-10,0,90,1000]){assert.equal(landingScale(t),1);assert.equal(checkpointScale(t),1);}});
|
||||
test('rendered undo target and nonnumeric checkpoint animate immediately without adding ribbons',t=>{
|
||||
const old=feedback.now;t.after(()=>{feedback.reset();feedback.now=old;});const level=levels[3],route=solve(level)[0],scales=[],ctx=new Proxy({measureText:()=>({width:20}),scale:(x,y)=>scales.push([x,y])},{get:(o,k)=>o[k]??(()=>{}),set:(o,k,v)=>(o[k]=v,true)});feedback.reset();feedback.now=()=>1000;feedback.emit('undo',level,route[1],1,{from:route[0]});renderBrightBoard(ctx,level,route.slice(0,1),375,400,{now:1045});assert.ok(scales.some(([x])=>x===1.025));scales.length=0;feedback.now=()=>1100;feedback.emit('checkpoint',level,route[0],1,{ribbon:false});const scene=renderBrightBoard(ctx,level,route.slice(0,1),375,400,{now:1145});assert.ok(scales.some(([x])=>x===1.065));assert.equal(scene.bursts.length,0);});
|
||||
const old=feedback.now;t.after(()=>{feedback.reset();feedback.now=old;});const level=levels[3],route=solve(level)[0],scales=[],ctx=new Proxy({measureText:()=>({width:20}),scale:(x,y)=>scales.push([x,y])},{get:(o,k)=>o[k]??(()=>{}),set:(o,k,v)=>(o[k]=v,true)});feedback.reset();feedback.now=()=>1000;feedback.emit('undo',level,route[1],1,{from:route[0]});renderBrightBoard(ctx,level,route.slice(0,1),375,400,{now:1045});assert.ok(scales.some(([x])=>x===1.1));scales.length=0;feedback.now=()=>1100;feedback.emit('checkpoint',level,route[0],1,{ribbon:false});const scene=renderBrightBoard(ctx,level,route.slice(0,1),375,400,{now:1145});assert.ok(scales.some(([x])=>x===1.3));assert.equal(scene.bursts.length,0);});
|
||||
|
||||
test('quick undo cancels removed node rebound, including last-step removal',t=>{const old=feedback.now;t.after(()=>{feedback.reset();feedback.now=old;});const level=levels[3],route=solve(level)[0],scales=[],ctx=new Proxy({measureText:()=>({width:20}),scale:x=>scales.push(x)},{get:(o,k)=>o[k]??(()=>{}),set:(o,k,v)=>(o[k]=v,true)});feedback.reset();feedback.now=()=>1000;feedback.emit('checkpoint',level,route[1],2,{ribbon:false});feedback.now=()=>1010;feedback.emit('undo',level,route[1],1,{from:route[0]});renderBrightBoard(ctx,level,route.slice(0,1),375,400,{now:1045});assert.equal(scales.length,1);assert.ok(scales[0]>1&&scales[0]<=1.025);scales.length=0;feedback.now=()=>1100;feedback.emit('undo',level,route[0],0,{});renderBrightBoard(ctx,level,[],375,400,{now:1145});assert.deepEqual(scales,[1.025]);});
|
||||
test('quick undo cancels removed node rebound, including last-step removal',t=>{const old=feedback.now;t.after(()=>{feedback.reset();feedback.now=old;});const level=levels[3],route=solve(level)[0],scales=[],ctx=new Proxy({measureText:()=>({width:20}),scale:x=>scales.push(x)},{get:(o,k)=>o[k]??(()=>{}),set:(o,k,v)=>(o[k]=v,true)});feedback.reset();feedback.now=()=>1000;feedback.emit('checkpoint',level,route[1],2,{ribbon:false});feedback.now=()=>1010;feedback.emit('undo',level,route[1],1,{from:route[0]});renderBrightBoard(ctx,level,route.slice(0,1),375,400,{now:1045});assert.equal(scales.length,1);assert.ok(scales[0]>1&&scales[0]<=1.1);scales.length=0;feedback.now=()=>1100;feedback.emit('undo',level,route[0],0,{});renderBrightBoard(ctx,level,[],375,400,{now:1145});assert.deepEqual(scales,[1.1]);});
|
||||
|
||||
Reference in New Issue
Block a user