PageSourceSearch

https://chat1.ek21.com/assets/DigTreasureDemo-D2UUlkzK.js

js ek21.com collected 2026-10-02 11:28:36 UTC 2,964 bytes, 1 lines download raw bytes

1import{r as i,j as t}from"./index-BmUWOtyf.js";import R from"./DigTreasureGame-Curg6tfv.js";function j(n){const s={};return{on(e,u){(s[e]||(s[e]=[])).push(u)},off(e,u){s[e]=(s[e]||[]).filter(a=>a!==u)},emit(e){e==="digTreasure"&&n.handleDig()},_fire(e,u){(s[e]||[]).forEach(a=>a(u))}}}const y=["路過人間","夜貓子","旅人甲"];function T(){const[n,s]=i.useState(!1),[e,u]=i.useState(5),[a,h]=i.useState(1),[c,p]=i.useState(20),[m,x]=i.useState(15),d=i.useRef(0),l=i.useRef(0),o=i.useRef(j({handleDig:()=>{if(d.current>=e){o.current._fire("digTreasureRejected",{reason:"已達本回合挖寶次數上限"});return}const r=a+Math.floor(Math.random()*(c-a+1));d.current+=1,l.current+=r,o.current._fire("digTreasureResult",{reward:r,digsUsed:d.current,digsLeft:e-d.current,totalReward:l.current})}})),b=()=>{n||(s(!0),d.current=0,l.current=0,o.current._fire("digGameWarn",{secondsLeft:5}),setTimeout(()=>{o.current._fire("digGameStart",{duration:m,maxDigs:e,rewardMin:a,rewardMax:c}),setTimeout(()=>{o.current._fire("digGameEnd"),setTimeout(()=>{const r={};l.current>0&&(r.小明=l.current),y.forEach(f=>{if(Math.random()<.7){r[f]=0;for(let g=0;g<e;g++)Math.random()<.8&&(r[f]+=a+Math.floor(Math.random()*(c-a+1)))}}),o.current._fire("digGameResult",{rewards:r}),s(!1)},600)},m*1e3)},5e3))};return t.jsxs("main",{style:{minHeight:"100vh",padding:24,background:"linear-gradient(180deg, #101010, #1a1a1a)",color:"#eee",fontFamily:"Arial, sans-serif"},children:[t.jsx("h1",{style:{marginTop:0},children:"⛏️ 挖寶遊戲 Demo"}),t.jsx("p",{style:{opacity:.75,maxWidth:560},children:"全螢幕覆蓋層版本的展示頁,不連真的後端,用假的 socket 事件模擬「開始前 30 秒預告(demo 縮短成 5 秒)」「開始挖寶」「每次挖寶伺服器即時擲出隨機獎勵」「時間到統一結算」整個流程。 我的名字固定是「小明」,另外模擬了 3 位其他玩家的挖寶成績用來看結算畫面的排行榜。"}),t.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center",marginTop:16,flexWrap:"wrap"},children:[t.jsxs("label",{children:["持續時間(秒):",t.jsx("input",{type:"number",min:5,max:60,value:m,onChange:r=>x(Number(r.target.value)||15),disabled:n,style:{width:60,marginLeft:6}})]}),t.jsxs("label",{children:["挖寶次數:",t.jsx("input",{type:"number",min:1,max:20,value:e,onChange:r=>u(Number(r.target.value)||5),disabled:n,style:{width:60,marginLeft:6}})]}),t.jsxs("label",{children:["隨機獎勵範圍:",t.jsx("input",{type:"number",min:1,value:a,onChange:r=>h(Number(r.target.value)||1),disabled:n,style:{width:60,marginLeft:6}}),"~",t.jsx("input",{type:"number",min:1,value:c,onChange:r=>p(Number(r.target.value)||20),disabled:n,style:{width:60,marginLeft:6}})]}),t.jsx("button",{onClick:b,disabled:n,style:{padding:"8px 16px"},children:n?"進行中…":"⛏️ 開始挖寶"})]}),t.jsx(R,{socket:o.current,token:"demo",name:"小明",setApples:()=>{}})]})}export{T 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.