增加正在联网提示
This commit is contained in:
@@ -532,6 +532,13 @@ function love.run()
|
|||||||
_.draw(_.time)
|
_.draw(_.time)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--Draw network working
|
||||||
|
if TASK.netTaskCount>0 then
|
||||||
|
setFont(30)
|
||||||
|
gc.setColor(color.rainbow(Timer()*5))
|
||||||
|
gc.print("E",1250,0,.26+.355*math.sin(Timer()*6.26))
|
||||||
|
end
|
||||||
|
|
||||||
--Draw FPS
|
--Draw FPS
|
||||||
gc.setColor(1,1,1)
|
gc.setColor(1,1,1)
|
||||||
setFont(15)
|
setFont(15)
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
local rem=table.remove
|
local rem=table.remove
|
||||||
local tasks={}
|
local tasks={}
|
||||||
|
|
||||||
local TASK={}
|
local TASK={
|
||||||
|
netTaskCount=0,
|
||||||
|
}
|
||||||
function TASK.getCount()
|
function TASK.getCount()
|
||||||
return #tasks
|
return #tasks
|
||||||
end
|
end
|
||||||
@@ -9,6 +11,9 @@ function TASK.update()
|
|||||||
for i=#tasks,1,-1 do
|
for i=#tasks,1,-1 do
|
||||||
local T=tasks[i]
|
local T=tasks[i]
|
||||||
if T.code(T.data)then
|
if T.code(T.data)then
|
||||||
|
if T.data.net then
|
||||||
|
TASK.netTaskCount=TASK.netTaskCount-1
|
||||||
|
end
|
||||||
rem(tasks,i)
|
rem(tasks,i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -164,24 +164,23 @@ do--dumpTable
|
|||||||
end
|
end
|
||||||
do--httpRequest
|
do--httpRequest
|
||||||
client=LOADLIB("NETlib")
|
client=LOADLIB("NETlib")
|
||||||
if client then
|
httpRequest=
|
||||||
function httpRequest(tick,url,method,header,body)
|
client and function(tick,api,method,header,body)
|
||||||
local task,err=client.httpraw{
|
local task,err=client.httpraw{
|
||||||
url=url,
|
url="http://47.103.200.40/"..api,
|
||||||
method=method or"GET",
|
method=method or"GET",
|
||||||
header=header,
|
header=header,
|
||||||
body=body,
|
body=body,
|
||||||
}
|
}
|
||||||
if task then
|
if task then
|
||||||
TASK.new(tick,{task=task,time=0})
|
TASK.new(tick,{task=task,time=0,net=true})
|
||||||
else
|
else
|
||||||
LOG.print("NETlib error: "..err,"warn")
|
LOG.print("NETlib error: "..err,"warn")
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
function httpRequest(...)
|
|
||||||
LOG.print("[NO NETlib]",5,color.yellow)
|
|
||||||
end
|
end
|
||||||
|
TASK.netTaskCount=TASK.netTaskCount+1
|
||||||
|
end or
|
||||||
|
function()
|
||||||
|
LOG.print("[NO NETlib]",5,color.yellow)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
do--json
|
do--json
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ do--load
|
|||||||
--------------------------
|
--------------------------
|
||||||
SFX.play("welcome_sfx")
|
SFX.play("welcome_sfx")
|
||||||
VOC.play("welcome_voc")
|
VOC.play("welcome_voc")
|
||||||
httpRequest(TICK.httpREQ_launch,"http://47.103.200.40/api/game")
|
httpRequest(TICK.httpREQ_launch,"api/game")
|
||||||
else
|
else
|
||||||
S.cur=S.cur+1
|
S.cur=S.cur+1
|
||||||
S.tar=S.cur
|
S.tar=S.cur
|
||||||
|
|||||||
Reference in New Issue
Block a user