修正分支合并

This commit is contained in:
MrZ626
2020-12-03 21:38:17 +08:00
parent 37d7dd5fe0
commit 391b2a95d3
9 changed files with 72 additions and 87 deletions

View File

@@ -1,32 +1,40 @@
local function socketWrite(message)
if not WSCONN then
if WSCONN then
local writeErr=client.write(WSCONN,message)
if writeErr then print(writeErr,"warn")end
else
LOG.print("尚未连接到服务器","warn")
return
end
local writeErr = client.write(WSCONN, message)
if writeErr then
print(writeErr, "warn")
end
return true
end
local function send()
local function sendMessage()
local W=WIDGET.active.text
socketWrite(W.value)
W.value=""
if #W.value>0 then
socketWrite(W.value)
W.value=""
end
end
function sceneInit.chat()
BG.set("none")
wsConnect(
TICK.wsCONN_connect,
PATH.socket..PATH.chat.."?email="..urlEncode(ACCOUNT.email).."&access_token="..urlEncode(ACCOUNT.access_token),
{}
PATH.socket..PATH.chat.."?email="..urlEncode(ACCOUNT.email).."&access_token="..urlEncode(ACCOUNT.access_token)
)
end
function keyDown.chat(k)
if k=="return"then
sendMessage()
elseif k=="escape"then
SCN.back()
else
WIDGET.keyPressed(k)
end
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},
WIDGET.newButton{name="send", x=1140, y=540,w=170,h=80,font=40,code=sendMessage},
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK},
})

View File

@@ -118,19 +118,16 @@ function Tmr.load()
VOC.play("welcome_voc")
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,
}
if res then
httpRequest(
TICK.httpREQ_autoLogin,
PATH.api..PATH.auth,
"GET",
{["Content-Type"]="application/json"},
res
)
end
httpRequest(
TICK.httpREQ_autoLogin,
PATH.api..PATH.auth,
"GET",
{["Content-Type"]="application/json"},
json.encode{
email=ACCOUNT.email,
auth_token=ACCOUNT.auth_token,
}
)
end
end
if S.tar then

View File

@@ -7,19 +7,16 @@ function keyDown.login(key)
elseif #password==0 then
LOG.print(text.noPassword)return
end
local res=json.encode{
email=email,
password=password,
}
if res then
httpRequest(
TICK.httpREQ_newLogin,
PATH.api..PATH.auth,
"GET",
{["Content-Type"]="application/json"},
res
)
end
httpRequest(
TICK.httpREQ_newLogin,
PATH.api..PATH.auth,
"GET",
{["Content-Type"]="application/json"},
json.encode{
email=email,
password=password,
}
)
elseif key=="escape"then
SCN.back()
else

View File

@@ -13,20 +13,17 @@ function keyDown.register(key)
elseif password~=password2 then
LOG.print(text.diffPassword)return
end
local res=json.encode{
username=username,
email=email,
password=password,
}
if res then
httpRequest(
TICK.httpREQ_register,
PATH.api..PATH.auth,
"POST",
{["Content-Type"]="application/json"},
res
)
end
httpRequest(
TICK.httpREQ_register,
PATH.api..PATH.auth,
"POST",
{["Content-Type"]="application/json"},
json.encode{
username=username,
email=email,
password=password,
}
)
elseif key=="escape"then
SCN.back()
else