Implemented chatting room (#17)

This commit is contained in:
Particle_G
2020-12-03 16:09:25 +08:00
committed by MrZ626
parent 325c544e17
commit 37d7dd5fe0
11 changed files with 189 additions and 66 deletions

View File

@@ -806,6 +806,37 @@ function WIDGET.lnk_STPeq(k,v) return function() return sceneTemp[k]==v end e
function WIDGET.lnk_pressKey(k) return function() love.keypressed(k) end end
function WIDGET.lnk_goScene(t,s) return function() SCN.go(t,s) end end
function WIDGET.lnk_swapScene(t,s) return function() SCN.swapTo(t,s) end end
function WIDGET.lnk_goNetgame()
if LOGIN then
if ACCOUNT.access_token then
local res=json.encode{
email=ACCOUNT.email,
access_token=ACCOUNT.access_token,
}
httpRequest(
TICK.httpREQ_checkAccessToken,
PATH.api..PATH.access,
"GET",
{["Content-Type"]="application/json"},
res
)
else
local payload=json.encode{
email=ACCOUNT.email,
auth_token=ACCOUNT.auth_token,
}
httpRequest(
TICK.httpREQ_getAccessToken,
PATH.api..PATH.access,
"POST",
{["Content-Type"]="application/json"},
payload
)
end
else
SCN.go("login")
end
end
local indexMeta={
__index=function(L,k)