删除游戏结束后的排名菜单,直接在玩家框内显示数据,详细信息也会显示motto
This commit is contained in:
@@ -20,7 +20,6 @@ local NET={
|
|||||||
private=false,
|
private=false,
|
||||||
start=false,
|
start=false,
|
||||||
},
|
},
|
||||||
resultList={},--List of {place,survivalTime,uid,score}
|
|
||||||
spectate=false,--If player is spectating
|
spectate=false,--If player is spectating
|
||||||
specSRID=false,--Cached SRID when enter playing room, for connect WS after scene swapped
|
specSRID=false,--Cached SRID when enter playing room, for connect WS after scene swapped
|
||||||
seed=false,
|
seed=false,
|
||||||
@@ -490,11 +489,24 @@ function NET.updateWS_play()
|
|||||||
NET.connectingStream=true
|
NET.connectingStream=true
|
||||||
NET.wsconn_stream(d.srid)
|
NET.wsconn_stream(d.srid)
|
||||||
elseif res.action==9 then--Game finished
|
elseif res.action==9 then--Game finished
|
||||||
NET.roomState.start=false
|
|
||||||
NET.spectate=false
|
|
||||||
if NET.spectate then NET.signal_setMode(2) end
|
|
||||||
if SCN.socketRead then SCN.socketRead('finish',d)end
|
if SCN.socketRead then SCN.socketRead('finish',d)end
|
||||||
|
|
||||||
|
--d.result: list of {place,survivalTime,uid,score}
|
||||||
|
for _,p in next,d.result do
|
||||||
|
for _,P in next,PLAYERS do
|
||||||
|
if P.uid==p.uid then
|
||||||
|
netPLY.setStat(p.uid,P.stat)
|
||||||
|
netPLY.setPlace(p.uid,p.place)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
netPLY.resetState()
|
||||||
netPLY.freshPos()
|
netPLY.freshPos()
|
||||||
|
NET.roomState.start=false
|
||||||
|
if NET.spectate then NET.signal_setMode(2)end
|
||||||
|
NET.spectate=false
|
||||||
NET.wsclose_stream()
|
NET.wsclose_stream()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
local gc=love.graphics
|
local gc=love.graphics
|
||||||
local gc_draw,gc_rectangle,gc_print=gc.draw,gc.rectangle,gc.print
|
local gc_draw,gc_rectangle,gc_print,gc_printf=gc.draw,gc.rectangle,gc.print,gc.printf
|
||||||
local gc_setColor,gc_setLineWidth,gc_translate=gc.setColor,gc.setLineWidth,gc.translate
|
local gc_setColor,gc_setLineWidth,gc_translate=gc.setColor,gc.setLineWidth,gc.translate
|
||||||
local gc_stencil,gc_setStencilTest=gc.stencil,gc.setStencilTest
|
local gc_stencil,gc_setStencilTest=gc.stencil,gc.setStencilTest
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ function netPLY.add(p)
|
|||||||
p.connected=false
|
p.connected=false
|
||||||
p.username=USERS.getUsername(p.uid)
|
p.username=USERS.getUsername(p.uid)
|
||||||
p.place=1e99
|
p.place=1e99
|
||||||
p.stat={}
|
p.stat=false
|
||||||
local a=rnd()*6.2832
|
local a=rnd()*6.2832
|
||||||
p.x,p.y,p.w,p.h=640+2600*cos(a),360+2600*sin(a),47,47
|
p.x,p.y,p.w,p.h=640+2600*cos(a),360+2600*sin(a),47,47
|
||||||
|
|
||||||
@@ -105,7 +105,6 @@ end
|
|||||||
|
|
||||||
function netPLY.getCount()return #PLYlist end
|
function netPLY.getCount()return #PLYlist end
|
||||||
function netPLY.getSID(uid)return PLYmap[uid].sid end
|
function netPLY.getSID(uid)return PLYmap[uid].sid end
|
||||||
function netPLY.getStat(uid)return PLYmap[uid].stat end
|
|
||||||
function netPLY.getSelfJoinMode()return PLYmap[USER.uid].mode end
|
function netPLY.getSelfJoinMode()return PLYmap[USER.uid].mode end
|
||||||
function netPLY.getSelfReady()return PLYmap[USER.uid].mode>0 end
|
function netPLY.getSelfReady()return PLYmap[USER.uid].mode>0 end
|
||||||
|
|
||||||
@@ -136,10 +135,11 @@ end
|
|||||||
function netPLY.setConnect(uid)PLYmap[uid].connected=true end
|
function netPLY.setConnect(uid)PLYmap[uid].connected=true end
|
||||||
function netPLY.setPlace(uid,place)PLYmap[uid].place=place end
|
function netPLY.setPlace(uid,place)PLYmap[uid].place=place end
|
||||||
function netPLY.setStat(uid,S)
|
function netPLY.setStat(uid,S)
|
||||||
local p=PLYmap[uid]
|
PLYmap[uid].stat={
|
||||||
p.stat.lpm=("%.1f %s"):format(S.row/S.time*60,text.radarData[5])
|
lpm=("%.1f %s"):format(S.row/S.time*60,text.radarData[5]),
|
||||||
p.stat.apm=("%.1f %s"):format(S.atk/S.time*60,text.radarData[3])
|
apm=("%.1f %s"):format(S.atk/S.time*60,text.radarData[3]),
|
||||||
p.stat.adpm=("%.1f %s"):format((S.atk+S.dig)/S.time*60,text.radarData[2])
|
adpm=("%.1f %s"):format((S.atk+S.dig)/S.time*60,text.radarData[2]),
|
||||||
|
}
|
||||||
end
|
end
|
||||||
function netPLY.resetState()
|
function netPLY.resetState()
|
||||||
for i=1,#PLYlist do
|
for i=1,#PLYlist do
|
||||||
@@ -210,6 +210,21 @@ function netPLY.draw()
|
|||||||
setFont(30)
|
setFont(30)
|
||||||
gc_print(p.username,p.h,8)
|
gc_print(p.username,p.h,8)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--Stat
|
||||||
|
local S=p.stat
|
||||||
|
if S and(p.h>=55 or p.w>=180)then
|
||||||
|
setFont(20)
|
||||||
|
local x=p.w-155
|
||||||
|
if p.h>=55 then
|
||||||
|
gc_printf(S.adpm,x,2,150,'right')
|
||||||
|
gc_printf(S.apm,x,24,150,'right')
|
||||||
|
gc_printf(S.lpm,x,46,150,'right')
|
||||||
|
else
|
||||||
|
gc_printf(S.adpm,x,0,150,'right')
|
||||||
|
gc_printf(S.lpm,x,19,150,'right')
|
||||||
|
end
|
||||||
|
end
|
||||||
gc_setStencilTest()
|
gc_setStencilTest()
|
||||||
gc_translate(-p.x,-p.y)
|
gc_translate(-p.x,-p.y)
|
||||||
end
|
end
|
||||||
@@ -226,6 +241,14 @@ function netPLY.draw()
|
|||||||
gc_print("#"..selP.uid,75,0)
|
gc_print("#"..selP.uid,75,0)
|
||||||
setFont(35)
|
setFont(35)
|
||||||
gc_print(selP.username,75,25)
|
gc_print(selP.username,75,25)
|
||||||
|
setFont(20)
|
||||||
|
gc_printf(USERS.getMotto(selP.uid),5,70,390)
|
||||||
|
if selP.stat then
|
||||||
|
local S=selP.stat
|
||||||
|
gc_print(S.lpm,5,193)
|
||||||
|
gc_print(S.apm,5,213)
|
||||||
|
gc_print(S.adpm,5,233)
|
||||||
|
end
|
||||||
gc_translate(-min(mouseX,880),-min(mouseY,460))
|
gc_translate(-min(mouseX,880),-min(mouseY,460))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
local gc,kb,tc=love.graphics,love.keyboard,love.touch
|
local gc,kb,tc=love.graphics,love.keyboard,love.touch
|
||||||
|
|
||||||
local gc_setColor,gc_setLineWidth=gc.setColor,gc.setLineWidth
|
local gc_setColor=gc.setColor
|
||||||
local gc_print,gc_printf=gc.print,gc.printf
|
local gc_print,gc_printf=gc.print,gc.printf
|
||||||
local gc_draw,gc_rectangle=gc.draw,gc.rectangle
|
local gc_draw=gc.draw
|
||||||
local setFont,mStr=setFont,mStr
|
local setFont,mStr=setFont,mStr
|
||||||
|
|
||||||
local ins=table.insert
|
local ins=table.insert
|
||||||
@@ -13,7 +13,7 @@ local PLAYERS,GAME=PLAYERS,GAME
|
|||||||
local textBox=WIDGET.newTextBox{name="texts",x=340,y=80,w=600,h=560}
|
local textBox=WIDGET.newTextBox{name="texts",x=340,y=80,w=600,h=560}
|
||||||
local inputBox=WIDGET.newInputBox{name="input",x=340,y=660,w=600,h=50}
|
local inputBox=WIDGET.newInputBox{name="input",x=340,y=660,w=600,h=50}
|
||||||
|
|
||||||
local playing,stat
|
local playing
|
||||||
local lastUpstreamTime
|
local lastUpstreamTime
|
||||||
local upstreamProgress
|
local upstreamProgress
|
||||||
local lastBackTime=0
|
local lastBackTime=0
|
||||||
@@ -21,10 +21,9 @@ local noTouch,noKey=false,false
|
|||||||
local touchMoveLastFrame=false
|
local touchMoveLastFrame=false
|
||||||
local newMessageTimer
|
local newMessageTimer
|
||||||
|
|
||||||
local function _playerSort(a,b)return a.place<b.place end
|
local function _setCancel()NET.signal_setMode(0)end
|
||||||
local function _setReady()NET.signal_setMode(1)end
|
local function _setReady()NET.signal_setMode(1)end
|
||||||
local function _setSpectate()NET.signal_setMode(2)end
|
local function _setSpectate()NET.signal_setMode(2)end
|
||||||
local function _setCancel()NET.signal_setMode(0)end
|
|
||||||
local function _gotoSetting()
|
local function _gotoSetting()
|
||||||
if not(netPLY.getSelfReady()or NET.getlock('ready'))then
|
if not(netPLY.getSelfReady()or NET.getlock('ready'))then
|
||||||
SCN.go('setting_game')
|
SCN.go('setting_game')
|
||||||
@@ -38,11 +37,6 @@ local function _quit()
|
|||||||
LOG.print(text.sureQuit,'warn')
|
LOG.print(text.sureQuit,'warn')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local function _switchStat()
|
|
||||||
if not playing and #NET.resultList>0 then
|
|
||||||
stat=not stat
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local function _switchChat()
|
local function _switchChat()
|
||||||
if inputBox.hide then
|
if inputBox.hide then
|
||||||
textBox.hide=false
|
textBox.hide=false
|
||||||
@@ -64,7 +58,6 @@ function scene.sceneInit(org)
|
|||||||
|
|
||||||
noTouch=not SETTING.VKSwitch
|
noTouch=not SETTING.VKSwitch
|
||||||
playing=false
|
playing=false
|
||||||
stat=false
|
|
||||||
lastUpstreamTime=0
|
lastUpstreamTime=0
|
||||||
upstreamProgress=1
|
upstreamProgress=1
|
||||||
newMessageTimer=0
|
newMessageTimer=0
|
||||||
@@ -76,7 +69,6 @@ function scene.sceneInit(org)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
function scene.sceneBack()
|
function scene.sceneBack()
|
||||||
NET.resultList={}
|
|
||||||
love.keyboard.setKeyRepeat(true)
|
love.keyboard.setKeyRepeat(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -145,6 +137,16 @@ function scene.keyDown(key)
|
|||||||
elseif not inputBox.hide then
|
elseif not inputBox.hide then
|
||||||
WIDGET.focus(inputBox)
|
WIDGET.focus(inputBox)
|
||||||
inputBox:keypress(key)
|
inputBox:keypress(key)
|
||||||
|
elseif key:find("[123456789]")then
|
||||||
|
for _=1,tonumber(key)do
|
||||||
|
netPLY.add{
|
||||||
|
uid=tostring(6000+#netPLY.list+1),
|
||||||
|
username="Test Player"..tostring(#netPLY.list+1),
|
||||||
|
sid=tostring(#netPLY.list+1),
|
||||||
|
mode=0,
|
||||||
|
config="",
|
||||||
|
}
|
||||||
|
end
|
||||||
elseif playing then
|
elseif playing then
|
||||||
if noKey then return end
|
if noKey then return end
|
||||||
local k=keyMap.keyboard[key]
|
local k=keyMap.keyboard[key]
|
||||||
@@ -159,8 +161,6 @@ function scene.keyDown(key)
|
|||||||
else
|
else
|
||||||
_setCancel()
|
_setCancel()
|
||||||
end
|
end
|
||||||
elseif key=="tab"then
|
|
||||||
_switchStat()
|
|
||||||
elseif key=="s"then
|
elseif key=="s"then
|
||||||
_gotoSetting()
|
_gotoSetting()
|
||||||
end
|
end
|
||||||
@@ -230,19 +230,6 @@ function scene.socketRead(cmd,d)
|
|||||||
elseif cmd=='finish'then
|
elseif cmd=='finish'then
|
||||||
playing=false
|
playing=false
|
||||||
love.keyboard.setKeyRepeat(true)
|
love.keyboard.setKeyRepeat(true)
|
||||||
table.sort(d.result,_playerSort)
|
|
||||||
NET.resultList=d.result
|
|
||||||
for _,p in next,NET.resultList do
|
|
||||||
p.username=USERS.getUsername(p.uid)
|
|
||||||
for _,P in next,PLAYERS do
|
|
||||||
if P.uid==p.uid then
|
|
||||||
netPLY.setStat(p.uid,P.stat)
|
|
||||||
netPLY.setPlace(p.uid,p.place)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
netPLY.resetState()
|
|
||||||
elseif cmd=='stream'then
|
elseif cmd=='stream'then
|
||||||
if d.uid~=USER.uid then
|
if d.uid~=USER.uid then
|
||||||
for _,P in next,PLAYERS do
|
for _,P in next,PLAYERS do
|
||||||
@@ -294,7 +281,7 @@ function scene.update(dt)
|
|||||||
NET.uploadRecStream(stream)
|
NET.uploadRecStream(stream)
|
||||||
lastUpstreamTime=PLAYERS[1].alive and P1.frameRun or 1e99
|
lastUpstreamTime=PLAYERS[1].alive and P1.frameRun or 1e99
|
||||||
end
|
end
|
||||||
elseif not stat then
|
else
|
||||||
netPLY.update()
|
netPLY.update()
|
||||||
end
|
end
|
||||||
if newMessageTimer>0 then
|
if newMessageTimer>0 then
|
||||||
@@ -322,17 +309,6 @@ function scene.draw()
|
|||||||
gc_setColor(.2,1,0,.8)
|
gc_setColor(.2,1,0,.8)
|
||||||
gc_print(text.spectating,940,0)
|
gc_print(text.spectating,940,0)
|
||||||
end
|
end
|
||||||
else
|
|
||||||
if stat then
|
|
||||||
gc_setColor(1,1,1)
|
|
||||||
gc_setLineWidth(4)
|
|
||||||
gc_rectangle('line',75,90,730,555)
|
|
||||||
local L=NET.resultList
|
|
||||||
for i=1,#L do
|
|
||||||
local p=L[i]
|
|
||||||
setFont(30)gc_print("-"..p.place.."-",100,58+40*i)
|
|
||||||
setFont(25)gc_print(p.username,160,60+40*i)
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
--Users
|
--Users
|
||||||
netPLY.draw()
|
netPLY.draw()
|
||||||
@@ -349,7 +325,6 @@ function scene.draw()
|
|||||||
gc_setColor(0,.8,1,.9)
|
gc_setColor(0,.8,1,.9)
|
||||||
mStr(text.waitStream,640,15)
|
mStr(text.waitStream,640,15)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
--Room info.
|
--Room info.
|
||||||
gc_setColor(1,1,1)
|
gc_setColor(1,1,1)
|
||||||
@@ -402,19 +377,6 @@ scene.widgetList={
|
|||||||
not netPLY.getSelfReady() or
|
not netPLY.getSelfReady() or
|
||||||
NET.getlock('ready')
|
NET.getlock('ready')
|
||||||
end},
|
end},
|
||||||
WIDGET.newKey{name="showResult",x=310,y=35,w=60,font=35,code=_switchStat,
|
|
||||||
hideF=function()
|
|
||||||
return
|
|
||||||
playing or
|
|
||||||
#NET.resultList==0
|
|
||||||
end,
|
|
||||||
fText=DOGC{50,40,
|
|
||||||
{'setLW',4},
|
|
||||||
{'dRect',2,38,15,-15},
|
|
||||||
{'dRect',17,38,15,-24},
|
|
||||||
{'dRect',32,38,16,-10},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
WIDGET.newKey{name="hideChat",fText="...",x=380,y=35,w=60,font=35,code=_switchChat},
|
WIDGET.newKey{name="hideChat",fText="...",x=380,y=35,w=60,font=35,code=_switchChat},
|
||||||
WIDGET.newKey{name="quit",fText="X",x=900,y=35,w=60,font=40,code=_quit},
|
WIDGET.newKey{name="quit",fText="X",x=900,y=35,w=60,font=40,code=_quit},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user