联网对战排名信息存到NET中,等待添加ui
This commit is contained in:
@@ -20,6 +20,7 @@ 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,
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ local lastBackTime=0
|
|||||||
local noTouch,noKey=false,false
|
local noTouch,noKey=false,false
|
||||||
local touchMoveLastFrame=false
|
local touchMoveLastFrame=false
|
||||||
|
|
||||||
|
local function _playerSort(a,b)return a.place<b.place 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 _setCancel()NET.signal_setMode(0)end
|
||||||
@@ -215,16 +216,13 @@ 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)
|
||||||
local winnerUID
|
table.sort(d.result,_playerSort)
|
||||||
for _,p in next,d.result do
|
for k,v in next,d.result do
|
||||||
if p.place==1 then
|
if v.place==0 then
|
||||||
winnerUID=p.uid
|
table.remove(d.result,k)
|
||||||
break
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if winnerUID then
|
NET.resultList=d.result
|
||||||
TEXT.show(text.champion:gsub("$1",USERS.getUsername(winnerUID)),640,260,80,'zoomout',.26)
|
|
||||||
end
|
|
||||||
netPLY.resetState()
|
netPLY.resetState()
|
||||||
elseif cmd=='stream'then
|
elseif cmd=='stream'then
|
||||||
if d.uid~=USER.uid then
|
if d.uid~=USER.uid then
|
||||||
|
|||||||
Reference in New Issue
Block a user