收拾掉旧的联网相关函数准备换新

This commit is contained in:
MrZ626
2021-02-17 04:00:26 +08:00
parent cdc57dda38
commit a883c8a6cf
6 changed files with 31 additions and 329 deletions

View File

@@ -3,72 +3,6 @@ local tc=love.touch
local max,min,sin=math.max,math.min,math.sin
local function tick_httpREQ_launch(task)
local time=0
while true do
coroutine.yield()
local response,request_error=client.poll(task)
if response then
local res=json.decode(response.body)
if res.message=="OK"and response.code==200 then
LOG.print(res.notice,360,COLOR.sky)
if VERSION_CODE>=res.version_code then
LATEST_VERSION=true
else
LOG.print(string.gsub(text.oldVersion,"$1",res.version_name),"warn")
end
else
LOG.print(text.httpCode..response.code..": "..res.message,"warn")
end
return
elseif request_error then
LOG.print(text.getNoticeFail..": "..request_error,"warn")
return
end
time=time+1
if time>360 then
LOG.print(text.getNoticeFail..": "..text.httpTimeout,"message")
return
end
end
end
local function tick_httpREQ_autoLogin(task)
local time=0
while true do
coroutine.yield()
local response,request_error=client.poll(task)
if response then
local res=json.decode(response.body)
if response.code==200 and res.message=="OK"then
LOGIN=true
LOG.print(text.loginSuccessed)
httpRequest(
TICK_httpREQ_getUserInfo,
PATH.http..PATH.user,
"GET",
{["Content-Type"]="application/json"},
json.encode{
email=USER.email,
auth_token=USER.auth_token,
}
)
else
LOGIN=false
LOG.print(text.loginFailed..": "..text.httpCode..response.code.."-"..res.message,"warn")
end
return
elseif request_error then
LOG.print(text.loginFailed..": "..request_error,"warn")
return
end
time=time+1
if time>360 then
LOG.print(text.loginFailed..": "..text.httpTimeout,"message")
return
end
end
end
local scene={}
local time--Animation timer