public/index.html
分割 4 / 6 · 元ファイル 632〜821行付近
g2.fillStyle='rgba(255,250,230,.22)'; g2.beginPath(); g2.arc(-r*0.30,-r*0.32,r*0.36,0,7); g2.fill();
g2.strokeStyle='rgba(20,16,10,.5)'; g2.lineWidth=Math.max(1,r*0.08);
g2.beginPath(); g2.moveTo(-r*0.5,r*0.1); g2.lineTo(r*0.3,-r*0.2); g2.stroke();
}else{
wrGet(WR.STONES,SAVE.eq.st).draw(g2,r,rot);
}
g2.restore();
}
function drawPerson(p,isMe){
var r=L.hr, feet=L.floorY, x=MX(world.xOf(p.id));
var hy=feet-4.85*r, shY=hy+1.30*r, bot=shY+2.40*r;
var dead=!p.alive, av=SHURE.fix(p.av||{});
g2.save();
if(dead) g2.globalAlpha=0.32;
g2.strokeStyle='#33323a'; g2.lineWidth=r*0.28; g2.lineCap='round';
g2.beginPath(); g2.moveTo(x,bot-r*0.2); g2.lineTo(x-r*0.34,feet+r*1.12); g2.stroke();
g2.beginPath(); g2.moveTo(x,bot-r*0.2); g2.lineTo(x+r*0.42,feet+r*1.12); g2.stroke();
SHURE.draw(g2,x,hy,r,1,av,{},bot);
var lk=p.look||{c:0,ht:0,st:0};
var cst=wrGet(WR.COSTUMES,lk.c); if(cst&&cst.draw) cst.draw(g2,x,shY,bot,r,SHURE.WEAR_COL[av.w],1);
var hat=wrGet(WR.HATS,lk.ht); if(hat&&hat.draw) hat.draw(g2,x,hy,r,1,SHURE.HAIR_COL[av.hc]);
var skin=SHURE.SKIN_COL[av.sk], ex, ey;
if(isMe&&!dead){
var a=arm*Math.PI/180;
ex=x+Math.cos(-a)*2.2*r; ey=shY+Math.sin(-a)*2.2*r;
if(canThrow()||aiming){ ex=handX(); ey=handY()+r*0.10; }
}else{ ex=x+1.5*r; ey=shY+1.5*r; }
g2.strokeStyle=skin; g2.lineWidth=r*0.28; g2.lineCap='round';
g2.beginPath(); g2.moveTo(x,shY+r*0.12); g2.lineTo(ex,ey); g2.stroke();
g2.fillStyle=skin; g2.beginPath(); g2.arc(ex,ey,r*0.20,0,7); g2.fill();
if(isMe&&canThrow()) drawStoneAt(handX(),handY(),0,L.stoneR*(rockArm&&rockLeft()<=0?3:1),rockArm&&rockLeft()<=0);
g2.restore();
if(!dead){
var bw=r*2.6, bx=x-bw/2, by=hy-r*2.0;
g2.fillStyle='rgba(10,14,18,.75)'; g2.fillRect(bx-1,by-1,bw+2,6);
var f=Math.max(0,Math.min(1,p.hp/WC.MAXHP));
g2.fillStyle=(f>0.5?'#6fc07a':(f>0.22?'#e0b64a':'#d2604c'));
g2.fillRect(bx,by,bw*f,4);
if(isMe){ g2.strokeStyle='rgba(255,206,106,.9)'; g2.lineWidth=1; g2.strokeRect(bx-1.5,by-1.5,bw+3,7); }
}
}
function drawZombie(z){
var G=zGeo(z), r=G.r, x=G.x;
g2.save();
g2.translate(x,G.feet);
if(z.dead){ g2.rotate(-Math.min(1.48,z.dt*4.2)); g2.globalAlpha=Math.max(0,Math.min(1,(1.5-z.dt)/0.45)); }
else g2.rotate(z.tilt+Math.sin(z.ph*2.0)*0.035);
g2.translate(-x,-G.feet);
var av=SHURE.fix({h:z.look.h,hc:z.look.hc,sk:ZSK0+(z.look.sk%3),w:z.look.w});
var skin=SHURE.SKIN_COL[av.sk];
var sw=Math.sin(z.ph*3.0);
g2.strokeStyle='#2f2f28'; g2.lineWidth=r*0.28; g2.lineCap='round';
g2.beginPath(); g2.moveTo(x,G.bot-r*0.2); g2.lineTo(x-r*(0.26+0.42*Math.max(0,sw)),G.feet+r*1.10); g2.stroke();
g2.beginPath(); g2.moveTo(x,G.bot-r*0.2); g2.lineTo(x+r*0.80,G.feet+r*1.02); g2.stroke();
SHURE.draw(g2,x,G.hy,r,-1,av,{},G.bot);
g2.strokeStyle=skin; g2.lineWidth=r*0.25; g2.lineCap='round';
for(var k=0;k<2;k++){
var dy=r*(0.06+k*0.26), hxx=x-r*(2.00+0.16*Math.sin(z.ph*2.4+k*1.7));
g2.beginPath(); g2.moveTo(x-r*0.62,G.shY+dy); g2.lineTo(hxx,G.shY+dy+r*0.14); g2.stroke();
g2.fillStyle=skin; g2.beginPath(); g2.arc(hxx,G.shY+dy+r*0.14,r*0.18,0,7); g2.fill();
}
if(!z.dead){
g2.lineCap='butt';
g2.strokeStyle='rgba(20,16,10,.75)'; g2.lineWidth=Math.max(3,r*0.30);
g2.beginPath(); g2.arc(x,G.hy,r*1.16,Math.PI*1.24,Math.PI*1.76); g2.stroke();
g2.strokeStyle=z.gr?'rgba(255,120,90,.95)':'rgba(255,214,96,.92)'; g2.lineWidth=Math.max(1.6,r*0.16);
g2.beginPath(); g2.arc(x,G.hy,r*1.16,Math.PI*1.24,Math.PI*1.76); g2.stroke();
g2.lineCap='round';
}
g2.restore();
}
function drawCrow(c){
var G=cGeo(c), r=G.r;
g2.save(); g2.translate(G.x,G.y);
if(c.dead){ g2.rotate(c.dt*7); g2.globalAlpha=Math.max(0,(1.4-c.dt)/0.5); }
var flap=Math.sin(c.ph)*0.9;
/* 夜空に沈まないよう、体の後ろに薄い縁を敷く */
g2.strokeStyle='rgba(150,170,190,.34)'; g2.lineWidth=2.6;
g2.beginPath(); g2.ellipse(0,0,r*0.92,r*0.60,0,0,7); g2.stroke();
g2.fillStyle='#2c313a';
g2.beginPath(); g2.ellipse(0,0,r*0.85,r*0.52,0,0,7); g2.fill();
g2.beginPath(); g2.arc(-r*0.78,-r*0.18,r*0.40,0,7); g2.fill();
g2.fillStyle='#c8a23a';
g2.beginPath(); g2.moveTo(-r*1.12,-r*0.16); g2.lineTo(-r*1.62,-r*0.02); g2.lineTo(-r*1.10,r*0.12);
g2.closePath(); g2.fill();
g2.fillStyle='#3a414b';
g2.beginPath(); g2.moveTo(-r*0.1,-r*0.2); g2.lineTo(r*0.5,-r*0.2-flap*r*1.05); g2.lineTo(r*0.95,r*0.1);
g2.closePath(); g2.fill();
g2.beginPath(); g2.moveTo(-r*0.1,-r*0.2); g2.lineTo(r*0.3,-r*0.2+flap*r*0.95); g2.lineTo(r*0.75,r*0.16);
g2.closePath(); g2.fill();
if(!c.dead){ g2.fillStyle='#ffd24a'; g2.beginPath(); g2.arc(-r*0.86,-r*0.24,r*0.10,0,7); g2.fill(); }
g2.restore();
}
function guide(){
if(!aiming||pull<18) return;
var rock=rockArm&&rockLeft()<=0;
var v=speedMS()*L.ppm*(rock?0.82:1), r=ang*Math.PI/180;
var vx=Math.cos(r)*v, vy=-Math.sin(r)*v, x=handX(), y=handY(), h=1/120;
g2.fillStyle=rock?'rgba(255,190,120,.72)':'rgba(255,238,205,.60)';
for(var i=0;i<72;i++){
vy+=9.8*L.ppm*h; x+=vx*h; y+=vy*h;
if(i%7===6){ g2.beginPath(); g2.arc(x,y,rock?2.8:2.0,0,7); g2.fill(); }
}
g2.strokeStyle='rgba(255,238,205,.28)'; g2.lineWidth=2; g2.setLineDash([4,4]);
g2.beginPath(); g2.moveTo(handX(),handY()); g2.lineTo(handX()-(sx-ax),handY()-(sy-ay)); g2.stroke();
g2.setLineDash([]);
var pf=pull/L.maxPull;
g2.fillStyle='rgba(255,244,220,.16)'; g2.fillRect(10,L.floorY+8,W-20,4);
g2.fillStyle=rock?'#ffb05a':'#ff8a3a'; g2.fillRect(10,L.floorY+8,(W-20)*pf,4);
}
function roundRect(x,y,w,h,r){
g2.beginPath();
g2.moveTo(x+r,y); g2.lineTo(x+w-r,y); g2.quadraticCurveTo(x+w,y,x+w,y+r);
g2.lineTo(x+w,y+h-r); g2.quadraticCurveTo(x+w,y+h,x+w-r,y+h);
g2.lineTo(x+r,y+h); g2.quadraticCurveTo(x,y+h,x,y+h-r);
g2.lineTo(x,y+r); g2.quadraticCurveTo(x,y,x+r,y); g2.closePath();
}
/* 押せない時も**大きさは変えない**。グレーアウトして赤字を重ねる(UI憲法) */
function uiBtn(id,x,y,w,h,label,sub,state){
btn(id,x,y,w,h);
g2.save();
roundRect(x,y,w,h,9);
g2.fillStyle=(state==='off')?'rgba(24,30,38,.92)':(state==='hot'?'rgba(255,206,106,.96)':'rgba(34,48,61,.94)');
g2.fill();
g2.lineWidth=1.6;
g2.strokeStyle=(state==='off')?'rgba(60,74,88,.9)':(state==='hot'?'rgba(255,206,106,1)':'rgba(92,120,144,.95)');
g2.stroke();
g2.textAlign='center'; g2.textBaseline='middle';
g2.font='bold 13px "Hiragino Kaku Gothic ProN",sans-serif';
g2.fillStyle=(state==='off')?'#6d7d8c':(state==='hot'?'#0d131a':'#f2ead6');
g2.fillText(label,x+w/2,y+h/2-(sub?7:0));
if(sub){
g2.font='bold 10px "Hiragino Kaku Gothic ProN",sans-serif';
g2.fillStyle=(state==='off')?'#c8604f':(state==='hot'?'#0d131a':'rgba(242,234,214,.72)');
g2.fillText(sub,x+w/2,y+h/2+9);
}
g2.restore();
g2.textAlign='left'; g2.textBaseline='alphabetic';
}
function drawHUD(){
var p=myP();
g2.textAlign='left'; g2.textBaseline='alphabetic';
var s=1+Math.max(0,pop)*0.22;
g2.save(); g2.translate(12,28); g2.scale(s,s);
g2.font='bold 16px "Hiragino Kaku Gothic ProN",sans-serif';
g2.fillStyle='#f4ecd6'; g2.fillText('倒した '+world.kills,0,0);
g2.restore();
/* 右上: 今の区間で貯めたスクラップと生存倍率(K1「右上などに常時表示」) */
g2.textAlign='right';
g2.font='bold 16px "Hiragino Kaku Gothic ProN",sans-serif';
g2.fillStyle='#ffce6a'; g2.fillText('スクラップ '+(p?p.base:0),W-12,28);
g2.font='bold 11px "Hiragino Kaku Gothic ProN",sans-serif';
var mu=world.mult();
g2.fillStyle=(mu>1?'#9fd8ff':'rgba(244,236,214,.5)');
g2.fillText('生存 '+Math.floor(world.t)+'秒 ×'+mu.toFixed(1),W-12,45);
g2.font='10px "Hiragino Kaku Gothic ProN",sans-serif';
g2.fillStyle='rgba(244,236,214,.30)';
g2.fillText(VER+(NET.on?(world.ps.length>=2?' 2人':' 相手待ち'):''),W-12,60);
g2.textAlign='left';
var by=H-52, bw=Math.min(104,(W-36)/2), bh=40;
var left=rockLeft();
uiBtn('rock',12,by,bw,bh,'大岩',left>0?Math.ceil(left)+'秒':(rockArm?'かまえた':'いける'),
left>0?'off':(rockArm?'hot':'on'));
if(world.ps.length>=2){
uiBtn('swap',12+bw+8,by,bw,bh,'交代',world.canSwap()?'前後を入れ替え':'取り付かれ中',
world.canSwap()?'on':'off');
}
if(joinMsg>0&&netMsg){
g2.save(); g2.globalAlpha=Math.min(1,joinMsg*1.4);
g2.textAlign='center'; g2.font='bold 14px "Hiragino Kaku Gothic ProN",sans-serif';
g2.fillStyle='#9fd8ff'; g2.fillText(netMsg,W/2,84);
g2.restore(); g2.textAlign='left';
}
}
function drawTitle(){
g2.fillStyle='rgba(6,9,14,.66)'; g2.fillRect(0,0,W,H);
g2.textAlign='center';
g2.font='bold 34px "Hiragino Kaku Gothic ProN",sans-serif';
g2.fillStyle='#f4ecd6'; g2.fillText('石とゾンビ',W/2,H*0.24);
g2.font='13px "Hiragino Kaku Gothic ProN",sans-serif';
g2.fillStyle='rgba(244,236,214,.80)';
g2.fillText('どこでも引いて離すと石が飛ぶ',W/2,H*0.24+32);
g2.fillText('頭の上から落とした石だけが倒せる',W/2,H*0.24+54);
g2.fillText('横から当てても押し戻すだけ',W/2,H*0.24+76);
g2.font='11px "Hiragino Kaku Gothic ProN",sans-serif';
g2.fillStyle='rgba(159,216,255,.85)';
g2.fillText('はじめると、誰か来た時にそのまま2人になります',W/2,H*0.24+104);
g2.textAlign='left';
var bw=Math.min(250,W-60), bx=(W-bw)/2, y=H*0.50;
uiBtn('start',bx,y,bw,52,'はじめる','','hot');