From f68aa26278c0a1fd7bf217a78683ad8d016e3269 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Tue, 4 May 2021 17:37:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=BF=E9=97=B4=E5=86=85=E7=8E=A9=E5=AE=B6?= =?UTF-8?q?=E5=B8=83=E5=B1=80=E5=9F=BA=E6=9C=AC=E5=AE=8C=E6=88=90=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=BC=A0=E6=A0=87=E6=82=AC=E6=B5=AE=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E8=AF=A6=E7=BB=86=E4=BF=A1=E6=81=AF=E6=A1=86=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/netPlayer.lua | 119 +++++++++++++++++++++++++++++-------- parts/scenes/net_game.lua | 9 ++- parts/scenes/net_rooms.lua | 2 +- 3 files changed, 101 insertions(+), 29 deletions(-) diff --git a/parts/netPlayer.lua b/parts/netPlayer.lua index b43738cd..feb7d316 100644 --- a/parts/netPlayer.lua +++ b/parts/netPlayer.lua @@ -1,4 +1,6 @@ local gc=love.graphics +local max,min=math.max,math.min + local ins,rem=table.insert,table.remove local posLists={ @@ -6,32 +8,52 @@ local posLists={ (function() local L={} for i=1,5 do - L[i]={x=40,y=65+50*i,w=1000,h=46} + L[i]={x=70,y=20+90*i,w=1000,h=80} end return L end)(), --6~17 (function() local L={} - for i=1,17 do - L[i]={x=40,y=65+50*i,w=1000,h=46} + for i=1,10 do + L[i]={x=40,y=60+55*i,w=520,h=50} + end + for i=1,7 do + L[10+i]={x=600,y=60+55*i,w=520,h=50} end return L end)(), --18~31 (function() local L={} - for i=1,31 do - L[i]={x=40,y=65+50*i,w=1000,h=46} - end + for i=1,11 do L[i]= {x=40,y=65+50*i,w=330,h=45}end + for i=1,11 do L[11+i]= {x=400,y=65+50*i,w=330,h=45}end + for i=1,9 do L[22+i]= {x=760,y=65+50*i,w=330,h=45}end return L end)(), --32~49 (function() local L={} - for i=1,49 do - L[i]={x=40,y=65+50*i,w=1000,h=46} - end + for i=1,10 do L[i]= {x=30,y=60+50*i,w=200,h=45}end + for i=1,10 do L[10+i]= {x=240,y=60+50*i,w=200,h=45}end + for i=1,10 do L[20+i]= {x=450,y=60+50*i,w=200,h=45}end + for i=1,10 do L[30+i]= {x=660,y=60+50*i,w=200,h=45}end + for i=1,9 do L[40+i]= {x=870,y=60+50*i,w=200,h=45}end + return L + end)(), + --50~99 + (function() + local L={} + for i=1,11 do L[i]= {x=30,y=60+50*i,w=100,h=45}end + for i=1,11 do L[i+11]= {x=135,y=60+50*i,w=100,h=45}end + for i=1,11 do L[i+22]= {x=240,y=60+50*i,w=100,h=45}end + for i=1,11 do L[i+33]= {x=345,y=60+50*i,w=100,h=45}end + for i=1,11 do L[i+44]= {x=450,y=60+50*i,w=100,h=45}end + for i=1,11 do L[i+55]= {x=555,y=60+50*i,w=100,h=45}end + for i=1,11 do L[i+66]= {x=660,y=60+50*i,w=100,h=45}end + for i=1,11 do L[i+77]= {x=765,y=60+50*i,w=100,h=45}end + for i=1,7 do L[i+88]= {x=870,y=60+50*i,w=100,h=45}end + for i=1,4 do L[i+95]= {x=975,y=60+50*i,w=100,h=45}end return L end)(), } @@ -52,10 +74,14 @@ local netPLY={list=PLY} local function freshPosList() if #PLY<=5 then posList=posLists[1] - elseif #PLY<=15 then + elseif #PLY<=17 then posList=posLists[2] - elseif #PLY<=30 then + elseif #PLY<=31 then posList=posLists[3] + elseif #PLY<=49 then + posList=posLists[4] + else--if #PLY<=99 then + posList=posLists[5] end end @@ -64,7 +90,7 @@ function netPLY.clear() end function netPLY.add(p) ins(PLY,p.uid==USER.uid and 1 or #PLY+1,p) - p.x,p.y,p.w,p.h=640,2600,0,0 + p.x,p.y,p.w,p.h=2600,2600,0,0 freshPosList() end function netPLY.remove(sid) @@ -120,6 +146,19 @@ function netPLY.resetReady() end end +local selP,mouseX,mouseY +function netPLY.mouseMove(x,y) + selP=nil + for i=1,#PLY do + local p=PLY[i] + if x>p.x and y>p.y and x