Update api path, add global table (#16)
This commit is contained in:
@@ -8,6 +8,27 @@ function sceneInit.chat()
|
||||
BG.set("none")
|
||||
end
|
||||
|
||||
local function socketConnect()
|
||||
wsConnect(
|
||||
TICK.wsCONN_connect,
|
||||
"/solo?room_id=114",
|
||||
{}
|
||||
)
|
||||
end
|
||||
local function socketWrite()
|
||||
if not WSCONN then
|
||||
LOG.print("尚未连接到服务器","warn")
|
||||
return
|
||||
end
|
||||
local message = WIDGET.active.message.value
|
||||
print("TextBox: "..message)
|
||||
local writeErr = client.write(WSCONN, message)
|
||||
if writeErr then
|
||||
print(writeErr, "warn")
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
WIDGET.init("chat",{
|
||||
WIDGET.newTextBox{name="text", x=40, y=500,w=980,h=180,font=40},
|
||||
WIDGET.newButton{name="send", x=1140, y=540,w=170,h=80,font=40,code=send},
|
||||
|
||||
@@ -116,8 +116,8 @@ function Tmr.load()
|
||||
LOADED=true
|
||||
SFX.play("welcome_sfx")
|
||||
VOC.play("welcome_voc")
|
||||
httpRequest(TICK.httpREQ_launch,"/tech/api/v1/app/info")
|
||||
if ACCOUNT.auth_token then
|
||||
httpRequest(TICK.httpREQ_launch,PATH.api..PATH.appInfo)
|
||||
if ACCOUNT.auth_token and ACCOUNT.email then
|
||||
local res=json.encode{
|
||||
email=ACCOUNT.email,
|
||||
auth_token=ACCOUNT.auth_token,
|
||||
@@ -125,7 +125,7 @@ function Tmr.load()
|
||||
if res then
|
||||
httpRequest(
|
||||
TICK.httpREQ_autoLogin,
|
||||
"/tech/api/v1/users",
|
||||
PATH.api..PATH.auth,
|
||||
"GET",
|
||||
{["Content-Type"]="application/json"},
|
||||
res
|
||||
|
||||
@@ -14,7 +14,7 @@ function keyDown.login(key)
|
||||
if res then
|
||||
httpRequest(
|
||||
TICK.httpREQ_newLogin,
|
||||
"/tech/api/v1/users",
|
||||
PATH.api..PATH.auth,
|
||||
"GET",
|
||||
{["Content-Type"]="application/json"},
|
||||
res
|
||||
|
||||
@@ -21,7 +21,7 @@ function keyDown.register(key)
|
||||
if res then
|
||||
httpRequest(
|
||||
TICK.httpREQ_register,
|
||||
"/tech/api/v1/users",
|
||||
PATH.api..PATH.auth,
|
||||
"POST",
|
||||
{["Content-Type"]="application/json"},
|
||||
res
|
||||
|
||||
Reference in New Issue
Block a user