PageSourceSearch

https://shike-web.vercel.app/_nuxt/CKOf6vii.js

js shike-web.vercel.app collected 2026-10-03 07:43:35 UTC 11,511 bytes, 1 lines download raw bytes

1import{J as nt,al as c,a8 as gt,a4 as ht,aa as _t,ab as b,B as k,y as a,aw as L,d as yt,am as kt,A as j,H as P,aY as E,n as Y,r as wt,c as St,aH as Ct,z as Tt,x as Lt}from"./BRmlP7xU.js";import{_ as Mt}from"./C6IXV3VF.js";import{_ as Bt}from"./Vt_RF1Q8.js";import{_ as Pt}from"./Y4rNzQtG.js";import{h as Et,i as At,j as Rt}from"./CshGXoZE.js";import{u as Dt}from"./DPoMep2H.js";import{u as It}from"./X5ghqqtO.js";import"./BsvMOEaX.js";import"./D8Y2ukjb.js";import"./B8XgxyKV.js";import"./Bz5BUBp2.js";import"./D_j0JRW0.js";const Ot={class:"mx-auto max-w-lg pb-4 pt-4"},Ht={class:"mb-3 flex items-center justify-center gap-6"},Ft={class:"text-center"},Kt={class:"text-center"},Nt={key:0,class:"text-slate-400"},Vt={class:"text-center"},Wt={class:"text-2xl font-bold text-slate-500"},jt={class:"relative mx-auto w-full overflow-hidden rounded-3xl border-2 border-slate-200 bg-slate-900 shadow-lg",style:{"max-width":"480px"}},qt={key:0,class:"absolute inset-0 flex flex-col items-center justify-center bg-black/35 backdrop-blur-[2px]"},Gt={key:0,class:"absolute inset-0 flex items-center justify-center bg-black/40 backdrop-blur-[2px]"},Xt={class:"mx-4 mb-4 w-full max-w-xs rounded-3xl bg-white/95 p-8 text-center shadow-2xl"},$t={class:"my-5 flex justify-center gap-6"},zt={class:"text-3xl font-bold text-teal-600"},Yt={class:"text-3xl font-bold text-slate-500"},Ut={key:0,class:"absolute inset-0 flex items-center justify-center bg-black/40 backdrop-blur-[2px]"},Jt={class:"mx-4 mb-4 w-full max-w-xs rounded-3xl bg-white/95 p-8 text-center shadow-2xl"},Qt={class:"my-5 flex justify-center gap-6"},Zt={class:"text-3xl font-bold text-teal-600"},te={class:"text-3xl font-bold text-slate-500"},u=480,m=640,v=90,w=14,q=8,M=5,ee=7,U=9,G=6,le=60,B=22,ae=nt({__name:"BreakoutView",setup(it){const x=c(),A=c(),g=c(),S=m-50,h=(u-G*(U+1))/U,O=[["#ef4444","#f97316"],["#eab308","#22c55e"],["#14b8a6","#06b6d4"],["#0ea5e9","#6366f1"],["#8b5cf6","#d946ef"],["#ec4899","#f43f5e"],["#64748b","#475569"]],f=c((u-v)/2),C=c(u/2),R=c(S-q-2),_=c(M),i=c(-M),H=c([]),y=c(0),T=c(3),r=c("idle");let X=0,F=!1;const K=c(J());function J(){try{return Number(localStorage.getItem("breakout_high"))||0}catch{return 0}}function Q(e){try{const t=Number(localStorage.getItem("breakout_high"))||0;e>t&&(localStorage.setItem("breakout_high",String(e)),K.value=e)}catch{}}function rt(){const e=[];for(let t=0;t<ee;t++){const[l,o]=O[t%O.length];for(let s=0;s<U;s++)e.push({x:G+s*(h+G),y:le+t*(B+G),alive:!0,color:l,color2:o})}H.value=e}function Z(){F=!1,C.value=u/2,R.value=S-q-2,_.value=M,i.value=-M}let p=null;function ut(e){for(const t of H.value){if(!t.alive)continue;const l=e.createLinearGradient(t.x,t.y,t.x,t.y+B);l.addColorStop(0,t.color),l.addColorStop(1,t.color2),e.fillStyle=l,D(e,t.x,t.y,h,B,4),e.fill(),e.fillStyle="rgba(255,255,255,0.15)",D(e,t.x+2,t.y+1,h-4,B/2-1,2),e.fill()}}function D(e,t,l,o,s,n){e.beginPath(),e.moveTo(t+n,l),e.lineTo(t+o-n,l),e.quadraticCurveTo(t+o,l,t+o,l+n),e.lineTo(t+o,l+s-n),e.quadraticCurveTo(t+o,l+s,t+o-n,l+s),e.lineTo(t+n,l+s),e.quadraticCurveTo(t,l+s,t,l+s-n),e.lineTo(t,l+n),e.quadraticCurveTo(t,l,t+n,l),e.closePath()}function dt(e){const t=f.value,l=S;e.fillStyle="rgba(0,0,0,0.1)",D(e,t+2,l+3,v,w,w/2),e.fill();const o=e.createLinearGradient(t,l,t,l+w);o.addColorStop(0,"#2dd4bf"),o.addColorStop(1,"#0d9488"),e.fillStyle=o,D(e,t,l,v,w,w/2),e.fill(),e.fillStyle="rgba(255,255,255,0.3)",D(e,t+4,l+2,v-8,w/3,3),e.fill()}function ct(e){const t=C.value,l=R.value,o=q,s=e.createRadialGradient(t,l,o*.3,t,l,o*2.5);s.addColorStop(0,"rgba(45,212,191,0.3)"),s.addColorStop(1,"rgba(45,212,191,0)"),e.fillStyle=s,e.beginPath(),e.arc(t,l,o*2.5,0,Math.PI*2),e.fill();const n=e.createRadialGradient(t-2,l-2,1,t,l,o);n.addColorStop(0,"#ffffff"),n.addColorStop(1,"#2dd4bf"),e.fillStyle=n,e.beginPath(),e.arc(t,l,o,0,Math.PI*2),e.fill(),e.strokeStyle="#0d9488",e.lineWidth=1.5,e.stroke()}function ft(e){const t=e.createLinearGradient(0,0,0,m);t.addColorStop(0,"#0f172a"),t.addColorStop(1,"#1e293b"),e.fillStyle=t,e.fillRect(0,0,u,m),e.strokeStyle="rgba(148,163,184,0.06)",e.lineWidth=1;for(let l=0;l<u;l+=40)e.beginPath(),e.moveTo(l,0),e.lineTo(l,m),e.stroke();for(let l=0;l<m;l+=40)e.beginPath(),e.moveTo(0,l),e.lineTo(u,l),e.stroke()}function N(e){ft(e),ut(e),dt(e),ct(e)}function vt(){const e=C.value,t=R.value,l=q;(e-l<=0||e+l>=u)&&(_.value*=-1,Math.abs(i.value)<1.5&&(i.value=i.value>
10?-1.5:1.5)),t-l<=0&&(i.value*=-1),C.value=Math.max(l,Math.min(u-l,C.value));const o=f.value,s=S;if(i.value>0&&t+l>=s&&t+l<=s+w+4&&e>=o-4&&e<=o+v+4){const V=(e-o)/v*Math.PI-Math.PI/2,W=Math.sqrt(_.value**2+i.value**2);_.value=Math.cos(V)*W,i.value=-Math.abs(Math.sin(V)*W),i.value>-1.5&&(i.value=-1.5),Math.abs(i.value)<1.5&&(i.value=-1.5),R.value=s-l}let n=!1;for(const d of H.value)if(d.alive&&e+l>d.x&&e-l<d.x+h&&t+l>d.y&&t-l<d.y+B){d.alive=!1,y.value+=10,n=!0;const V=e+l-d.x,W=d.x+h-(e-l),at=t+l-d.y,ot=d.y+B-(t-l),st=Math.min(V,W,at,ot);st===at||st===ot?i.value*=-1:_.value*=-1;break}if(n&&A.value&&(A.value.classList.add("!text-teal-400"),setTimeout(()=>A.value?.classList.remove("!text-teal-400"),200)),t-l>m){if(T.value--,g.value&&(g.value.classList.add("!text-red-400"),setTimeout(()=>g.value?.classList.remove("!text-red-400"),300)),T.value<=0)return r.value="lost",Q(y.value),!1;Z()}return H.value.every(d=>!d.alive)?(r.value="won",Q(y),!1):!0}function tt(){if(r.value==="playing"){if(F&&(C.value+=_.value,R.value+=i.value,!vt())){N(p);return}N(p),X=requestAnimationFrame(tt)}}function I(){r.value!=="playing"&&(r.value="playing",y.value=0,T.value=3,rt(),f.value=(u-v)/2,Z(),$(),X=requestAnimationFrame(tt))}function $(){F||(F=!0,_.value=M*(.6+Math.random()*.8),i.value=-M)}function et(e){const t=x.value;if(!t)return;const l=t.getBoundingClientRect(),o=u/l.width,s=(e-l.left)*o;f.value=Math.max(0,Math.min(u-v,s-v/2))}function xt(e){r.value==="playing"&&et(e.clientX)}function pt(e){r.value==="playing"&&(e.preventDefault(),e.touches.length>0&&et(e.touches[0].clientX))}function lt(e){if(r.value!=="playing")return;const t=30;(e.key==="ArrowLeft"||e.key==="a")&&(e.preventDefault(),f.value=Math.max(0,f.value-t)),(e.key==="ArrowRight"||e.key==="d")&&(e.preventDefault(),f.value=Math.min(u-v,f.value+t)),e.code==="Space"&&(e.preventDefault(),$())}function mt(){if(r.value==="idle"){I();return}if(r.value==="won"||r.value==="lost"){I();return}$()}function bt(){const e=x.value;if(!e)return;const t=e.getContext("2d");t&&(p=t)}function z(){const e=x.value;if(!e)return;const t=e.parentElement;if(!t)return;const l=Math.min(t.clientWidth,480),o=l/u;e.style.width=`${l}px`,e.style.height=`${Math.round(m*o)}px`,p&&r.value==="idle"&&N(p)}return gt(async()=>{await ht(),bt(),z(),window.addEventListener("resize",z),window.addEventListener("keydown",lt);const e=x.value;e?.addEventListener("pointerdown",mt),e?.addEventListener("pointermove",xt),e?.addEventListener("touchmove",pt,{passive:!1}),p&&N(p),K.value=J()}),_t(()=>{cancelAnimationFrame(X),window.removeEventListener("resize",z),window.removeEventListener("keydown",lt),p=null}),(e,t)=>(b(),k("div",Ot,[t[17]||(t[17]=a("div",{class:"mb-4 text-center"},[a("h1",{class:"text-2xl font-bold text-slate-800"},"打砖块"),a("p",{class:"mt-1 text-sm text-slate-500"},"击碎砖块,挑战最高分!")],-1)),a("div",Ht,[a("div",Ft,[t[0]||(t[0]=a("p",{class:"text-xs text-slate-400"},"分数",-1)),a("p",{ref_key:"scoreEl",ref:A,class:"text-2xl font-bold text-teal-600 transition-colors duration-300"},L(y.value),513)]),t[4]||(t[4]=a("div",{class:"w-px self-stretch bg-slate-200"},null,-1)),a("div",Kt,[t[2]||(t[2]=a("p",{class:"text-xs text-slate-400"},"生命",-1)),a("p",{ref_key:"livesEl",ref:g,class:"text-2xl font-bold transition-colors duration-300"},[(b(!0),k(yt,null,kt(T.value,l=>(b(),k("svg",{key:l,class:"h-6 w-6 inline-block text-red-500",viewBox:"0 0 24 24",fill:"currentColor"},[...t[1]||(t[1]=[a("path",{d:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"},null,-1)])]))),128)),T.value===0?(b(),k("span",Nt,"无")):j("",!0)],512)]),t[5]||(t[5]=a("div",{class:"w-px self-stretch bg-slate-200"},null,-1)),a("div",Vt,[t[3]||(t[3]=a("p",{class:"text-xs text-slate-400"},"最高",-1)),a("p",Wt,L(K.value),1)])]),a("div",jt,[a("canvas",{ref_key:"canvasRef",ref:x,width:u,height:m,class:"block cursor-pointer select-none"},null,512),P(Y,{name:"fade"},{default:E(()=>[r.value==="idle"?(b(),k("div",qt,[a("div",{class:"rounded-3xl bg-white/95 px-10 py-8 text-center shadow-2xl"},[t[6]||(t[6]=a("div",{class:"mb-2 text-5xl"}
1,"🧱",-1)),t[7]||(t[7]=a("h2",{class:"mb-1 text-xl font-bold text-slate-700"},"准备好击砖了吗?",-1)),t[8]||(t[8]=a("p",{class:"mb-5 text-sm text-slate-400"},"击碎所有砖块,挑战你的最高分!",-1)),a("button",{type:"button",class:"inline-flex items-center gap-2 rounded-full bg-teal-500 px-8 py-3 text-sm font-semibold text-white shadow-lg transition-all hover:bg-teal-600 hover:scale-105 active:scale-95",onClick:I}," 开始游戏 "),t[9]||(t[9]=a("p",{class:"mt-3 text-xs text-slate-400"},"鼠标/触屏移动挡板 · 点击发射球",-1))])])):j("",!0)]),_:1}),P(Y,{name:"fade"},{default:E(()=>[r.value==="lost"?(b(),k("div",Gt,[a("div",Xt,[t[12]||(t[12]=a("div",{class:"mb-3 text-2xl font-bold text-red-500"},"游戏结束",-1)),a("div",$t,[a("div",null,[t[10]||(t[10]=a("p",{class:"text-xs text-slate-400"},"得分",-1)),a("p",zt,L(y.value),1)]),a("div",null,[t[11]||(t[11]=a("p",{class:"text-xs text-slate-400"},"最高",-1)),a("p",Yt,L(K.value),1)])]),a("button",{type:"button",class:"inline-flex items-center gap-2 rounded-full bg-teal-500 px-8 py-3 text-sm font-semibold text-white shadow-lg transition-all hover:bg-teal-600 hover:scale-105 active:scale-95",onClick:I}," 再来一局 ")])])):j("",!0)]),_:1}),P(Y,{name:"fade"},{default:E(()=>[r.value==="won"?(b(),k("div",Ut,[a("div",Jt,[t[16]||(t[16]=a("div",{class:"mb-3 text-2xl font-bold text-teal-500"},"恭喜通关!",-1)),a("div",Qt,[a("div",null,[t[13]||(t[13]=a("p",{class:"text-xs text-slate-400"},"得分",-1)),a("p",Zt,L(y.value),1)]),a("div",null,[t[14]||(t[14]=a("p",{class:"text-xs text-slate-400"},"剩余生命",-1)),a("p",te,L(T.value),1)])]),a("button",{type:"button",class:"inline-flex items-center gap-2 rounded-full bg-teal-500 px-8 py-3 text-sm font-semibold text-white shadow-lg transition-all hover:bg-teal-600 hover:scale-105 active:scale-95",onClick:I},[...t[15]||(t[15]=[a("span",null,"再玩一次",-1),a("span",null,"🔄",-1)])])])])):j("",!0)]),_:1})]),t[18]||(t[18]=a("p",{class:"mt-3 text-center text-xs text-slate-400"}," 💡 鼠标或手指移动挡板,点击发射小球。键盘方向键左右也可控制 ",-1)),t[19]||(t[19]=a("p",{class:"mt-2 text-center text-xs text-slate-300"}," ⚠️ 本小游戏仅供娱乐,结果不代表任何实际能力评估 ",-1))]))}}),oe=wt(ae,[["__scopeId","data-v-ae9d35ec"]]),be=nt({__name:"index",setup(it){const x=St["game/breakout"];return Dt("fun","game/breakout"),It(Lt(()=>({title:Rt(x),description:At(x),path:"/fun/game/breakout",keywords:Et(x),ogType:"article"}))),Ct({meta:[{name:"theme-color",content:"#0d9488"}]}),(A,g)=>{const S=oe,h=Mt,O=Bt,f=Pt;return b(),Tt(f,{width:"main",compact:""},{default:E(()=>[P(h,null,{fallback:E(()=>[...g[0]||(g[0]=[a("div",{class:"py-24 text-center text-sm text-slate-500"},"加载中...",-1)])]),default:E(()=>[P(S)]),_:1}),P(O,{kind:"fun",slug:"game/breakout"})]),_:1})}}});
1export{be as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.