pong动画
This commit is contained in:
@@ -598,6 +598,11 @@ function love.run()
|
||||
gc_setColor(.8,.8,.8)
|
||||
gc_draw(TEXTURE.ws_running,-20,20*i-20)
|
||||
end
|
||||
local lastPongTime=WS.lastPongTime(WSnames[i])
|
||||
if lastPongTime<1 then
|
||||
gc_setColor(1,1,1,1-lastPongTime)
|
||||
gc_rectangle("fill",0,20*i,-20,-20)
|
||||
end
|
||||
end
|
||||
gc_pop()
|
||||
|
||||
|
||||
@@ -174,6 +174,10 @@ function WS.status(name)
|
||||
return wsList[name]and wsList[name].status or"dead"
|
||||
end
|
||||
|
||||
function WS.lastPongTime(name)
|
||||
return wsList[name]and timer()-wsList[name].lastPongTime or 999
|
||||
end
|
||||
|
||||
function WS.setPingInterval(name,time)
|
||||
local ws=wsList[name]
|
||||
ws.pingInterval=math.max(time or 1,2.6)
|
||||
|
||||
Reference in New Issue
Block a user