订正上一个提交漏改的东西
优化debug消息显示格式 调整网络断开提示文本用法
This commit is contained in:
Submodule Zframework updated: 08a65f0b1b...1a44ad2ea1
@@ -110,6 +110,7 @@ return{
|
||||
-- TODO
|
||||
},
|
||||
|
||||
tooFrequently="Request too frequently",
|
||||
getNoticeFail="Failed to fetch announcements",
|
||||
oldVersion="Version $1 is now available",
|
||||
needUpdate="Newer version required!",
|
||||
@@ -125,8 +126,8 @@ return{
|
||||
diffPassword="Passwords don’t match",
|
||||
checkEmail="A sign up request has been sent.",
|
||||
|
||||
wsFailed="WebSocket connection failed",
|
||||
wsClose="WebSocket closed:",
|
||||
wsFailed="WebSocket connection failed: $1",
|
||||
wsClose="WebSocket closed: $1",
|
||||
netTimeout="Connection timed out",
|
||||
serverDown="Oops! Server is down",
|
||||
requestFailed="Request failed",
|
||||
|
||||
@@ -109,6 +109,7 @@ return{
|
||||
-- TODO
|
||||
},
|
||||
|
||||
-- tooFrequently="Request too frequently",
|
||||
getNoticeFail="Error al buscar novedades.",
|
||||
oldVersion="¡Está disponible la nueva versión $1!",
|
||||
needUpdate="¡Nueva versión requerida!",
|
||||
@@ -124,8 +125,8 @@ return{
|
||||
diffPassword="Las contraseñas no coinciden",
|
||||
checkEmail="Petición de registro enviada con éxito",
|
||||
|
||||
wsFailed="WebSocket conexión fallida",
|
||||
wsClose="WebSocket cerrado:",
|
||||
wsFailed="WebSocket conexión fallida: $1",
|
||||
wsClose="WebSocket cerrado: $1",
|
||||
netTimeout="Tiempo de conexión agotado",
|
||||
-- serverDown="Oops! Server is down",
|
||||
-- requestFailed="Request failed",
|
||||
|
||||
@@ -100,6 +100,7 @@ return{
|
||||
-- TODO
|
||||
},
|
||||
|
||||
-- tooFrequently="Request too frequently",
|
||||
getNoticeFail="Echec de l'obtention de la notice",
|
||||
oldVersion="La version $1 est disponible !",
|
||||
-- versionNotMatch="Version do not match!",
|
||||
@@ -115,8 +116,8 @@ return{
|
||||
diffPassword="Les mots de passe ne se correspondent pas",
|
||||
-- checkEmail="Registration request sent",
|
||||
|
||||
wsFailed="WebSocket connection échouée",
|
||||
-- wsClose="WebSocket Closed:",
|
||||
wsFailed="WebSocket connection échouée: $1",
|
||||
-- wsClose="WebSocket Closed: $1",
|
||||
-- netTimeout="Network connection timeout",
|
||||
-- serverDown="Oops! Server is down",
|
||||
-- requestFailed="Request failed",
|
||||
|
||||
@@ -111,6 +111,7 @@ return{
|
||||
-- TODO
|
||||
},
|
||||
|
||||
-- tooFrequently="Request too frequently",
|
||||
getNoticeFail="Gagal mengambil pengumuman-pengumuman",
|
||||
oldVersion="Versi $1 sekarang tersedia",
|
||||
needUpdate="Butuh versi lebih baru!",
|
||||
@@ -126,8 +127,8 @@ return{
|
||||
diffPassword="Kata sandi tidak sama",
|
||||
checkEmail="Permintaan daftar telah terkirim.",
|
||||
|
||||
wsFailed="Koneksi websocket gagal",
|
||||
wsClose="Websocket tertutup:",
|
||||
wsFailed="Koneksi websocket gagal: $1",
|
||||
wsClose="Websocket tertutup: $1",
|
||||
netTimeout="Koneksi waktu habis",
|
||||
-- serverDown="Oops! Server is down",
|
||||
-- requestFailed="Request failed",
|
||||
|
||||
@@ -111,6 +111,7 @@ return{
|
||||
-- TODO
|
||||
},
|
||||
|
||||
-- tooFrequently="Request too frequently",
|
||||
getNoticeFail="お知らせ情報を取得できませんでした",
|
||||
oldVersion="バージョン$1のダウンロードが可能になりました",
|
||||
needUpdate="最新バージョンに更新してください",
|
||||
@@ -126,8 +127,8 @@ return{
|
||||
diffPassword="パスワードが一致しません!",
|
||||
checkEmail="Sign Upリクエストを送信しました!",
|
||||
|
||||
wsFailed="ウェブソケットとの通信に失敗しました",
|
||||
wsClose="ウェブソケットとの通信を終了:",
|
||||
wsFailed="ウェブソケットとの通信に失敗しました: $1",
|
||||
wsClose="ウェブソケットとの通信を終了: $1",
|
||||
netTimeout="接続がタイムアウトしました",
|
||||
-- serverDown="Oops! Server is down",
|
||||
-- requestFailed="Request failed",
|
||||
|
||||
@@ -98,6 +98,7 @@ return{
|
||||
-- TODO
|
||||
},
|
||||
|
||||
-- tooFrequently="Request too frequently",
|
||||
getNoticeFail="Não conseguiu ter anúncios",
|
||||
oldVersion="Versão $1 esta disponível agora!",
|
||||
-- versionNotMatch="Version do not match!",
|
||||
@@ -113,8 +114,8 @@ return{
|
||||
diffPassword="Senhas não combinam",
|
||||
-- checkEmail="Registration request sent",
|
||||
|
||||
wsFailed="WebSocket falha na conexão",
|
||||
wsClose="WebSocket closed:",
|
||||
wsFailed="WebSocket falha na conexão: $1",
|
||||
wsClose="WebSocket closed: $1",
|
||||
-- netTimeout="Network connection timeout",
|
||||
-- serverDown="Oops! Server is down",
|
||||
-- requestFailed="Request failed",
|
||||
|
||||
@@ -110,6 +110,7 @@ return{
|
||||
-- TODO
|
||||
},
|
||||
|
||||
tooFrequently="操作太频繁",
|
||||
getNoticeFail="拉取公告失败",
|
||||
oldVersion="最新版本$1可以下载了!",
|
||||
needUpdate="请更新游戏!",
|
||||
@@ -125,8 +126,8 @@ return{
|
||||
diffPassword="两次密码不一致",
|
||||
checkEmail="请查看邮箱验证码",
|
||||
|
||||
wsFailed="连接失败",
|
||||
wsClose="连接被断开:",
|
||||
wsFailed="连接失败: $1",
|
||||
wsClose="连接断开: $1",
|
||||
netTimeout="连接超时",
|
||||
serverDown="唉哟!服务器不在线",
|
||||
requestFailed="请求失败",
|
||||
|
||||
@@ -110,9 +110,10 @@ return{
|
||||
-- TODO
|
||||
},
|
||||
|
||||
tooFrequently="Error.requestTooFrequently();",
|
||||
getNoticeFail="Error.FetchAnnouncement();",
|
||||
oldVersion="Version.New($1);",
|
||||
needUpdate="Version.NeedUpdate()",
|
||||
needUpdate="Version.NeedUpdate();",
|
||||
versionNotMatch="Version.NotMatch();",
|
||||
notFinished="ComingSoon();",
|
||||
|
||||
@@ -125,8 +126,8 @@ return{
|
||||
diffPassword="Error.DiffPassword();",
|
||||
checkEmail="register.RequestSent=true",
|
||||
|
||||
wsFailed="Error.Websocket.Failed();",
|
||||
wsClose="Error.Websocket.Close=",
|
||||
wsFailed="Error.Websocket.Failed=$1",
|
||||
wsClose="Error.Websocket.Close=$1",
|
||||
netTimeout="Error.ConnectTimeOut();",
|
||||
serverDown="Error.ServerDown();",
|
||||
requestFailed="Error.RequestFailed();",
|
||||
@@ -708,12 +709,12 @@ return{
|
||||
title="Register.UI",
|
||||
login="Login();",
|
||||
email="Email=",
|
||||
send="Send()",
|
||||
send="Send();",
|
||||
code="V-code=",
|
||||
verify="Verify()",
|
||||
verify="Verify();",
|
||||
password="Password=",
|
||||
password2="RePassword=",
|
||||
setPW="SetPassword()",
|
||||
setPW="SetPassword();",
|
||||
},
|
||||
account={
|
||||
title="Account.UI",
|
||||
|
||||
@@ -110,6 +110,7 @@ return{
|
||||
-- TODO
|
||||
},
|
||||
|
||||
tooFrequently="操作太頻繁",
|
||||
getNoticeFail="無法獲取公告",
|
||||
oldVersion="版本 $1 現已推出",
|
||||
needUpdate="請更新遊戲!",
|
||||
@@ -125,8 +126,8 @@ return{
|
||||
diffPassword="密碼不匹配",
|
||||
checkEmail="已發送註冊請求",
|
||||
|
||||
wsFailed="連接失敗",
|
||||
wsClose="連接斷開:",
|
||||
wsFailed="連接失敗: $1",
|
||||
wsClose="連接斷開: $1",
|
||||
netTimeout="連接超時",
|
||||
serverDown="哎唷!服務器不在线",
|
||||
requestFailed="請求失敗",
|
||||
|
||||
@@ -27,6 +27,10 @@ local NET={
|
||||
}
|
||||
|
||||
|
||||
function NET.connectLost()
|
||||
while SCN.stack[#SCN.stack-1]~='main' and #SCN.stack>0 do SCN.pop() end
|
||||
SCN.back()
|
||||
end
|
||||
|
||||
--------------------------<NEW HTTP API>
|
||||
local availableErrorTextType={info=1,warn=1,error=1}
|
||||
@@ -334,9 +338,10 @@ local actMap={
|
||||
} for k,v in next,actMap do actMap[v]=k end
|
||||
|
||||
local function wsSend(act,data)
|
||||
-- print("SEND ACT: "..act)
|
||||
-- print(("Send: $1 -->"):repD(act))
|
||||
-- print(("Send: $1 -->"):repD(act)) print(TABLE.dump(data),"\n")
|
||||
WS.send('game',JSON.encode{
|
||||
action=act,
|
||||
action=assert(act),
|
||||
data=data,
|
||||
})
|
||||
end
|
||||
@@ -359,13 +364,8 @@ function NET.room_chat(msg,rid)
|
||||
end
|
||||
end
|
||||
function NET.room_create(roomName,description,capacity,roomType,roomData,password)
|
||||
if not TASK.lock('createRoom',6) then return end
|
||||
WAIT{
|
||||
quit=function()
|
||||
TASK.unlock('createRoom')
|
||||
end,
|
||||
timeout=1e99,
|
||||
}
|
||||
if not TASK.lock('createRoom',10) then MES.new('warn',text.tooFrequently) return end
|
||||
WAIT{timeout=12}
|
||||
wsSend(actMap.room_create,{
|
||||
capacity=capacity,
|
||||
info={
|
||||
@@ -404,10 +404,8 @@ function NET.room_enter(rid,password)
|
||||
if not TASK.lock('enterRoom',6) then return end
|
||||
SFX.play('reach',.6)
|
||||
wsSend(actMap.room_enter,{
|
||||
data={
|
||||
roomId=rid,
|
||||
password=password,
|
||||
}
|
||||
roomId=rid,
|
||||
password=password,
|
||||
})
|
||||
end
|
||||
function NET.room_kick(pid,rid)
|
||||
@@ -421,14 +419,14 @@ function NET.room_leave()
|
||||
end
|
||||
function NET.room_fetch()
|
||||
if not TASK.lock('fetchRoom',3) then return end
|
||||
wsSend(actMap.room_lock,{
|
||||
wsSend(actMap.room_fetch,{
|
||||
pageIndex=0,
|
||||
pageSize=26,
|
||||
})
|
||||
end
|
||||
function NET.room_setPW(pw,rid)
|
||||
if not TASK.lock('setRoomPW',2) then return end
|
||||
wsSend(actMap.room_lock,{
|
||||
wsSend(actMap.room_setPW,{
|
||||
password=pw,
|
||||
roomId=rid,-- Admin
|
||||
})
|
||||
@@ -552,22 +550,21 @@ function NET.ws_update()
|
||||
elseif op=='pong' then
|
||||
elseif op=='close' then
|
||||
local res=JSON.decode(msg)
|
||||
MES.new('info',("$1 $2"):repD(text.wsClose,res and res.message or msg))
|
||||
MES.new('info',text.wsClose:repD(res and res.message or msg))
|
||||
if res and res.message then LOG(res.message) end
|
||||
TEST.yieldUntilNextScene()
|
||||
while SCN.stack[#SCN.stack-1]~='main' do SCN.pop() end
|
||||
SCN.back()
|
||||
NET.connectLost()
|
||||
return
|
||||
else
|
||||
local body=JSON.decode(msg)
|
||||
if body then
|
||||
-- print(("RECV ACT: $1 ($2)"):repD(body.action,body.type))
|
||||
-- print(TABLE.dump(body))
|
||||
-- print(("Recv: <-- $1 ($2)"):repD(body.action,body.type))
|
||||
-- print(("Recv: <-- $1 ($2)"):repD(body.action,body.type)) print(TABLE.dump(body),"\n")
|
||||
if body.type=='Failed' then
|
||||
parseError(body.message~=nil and body.message or msg)
|
||||
else
|
||||
local f=NET.wsCallBack[actMap[body.action]]
|
||||
if f then f(body) else print("Wrong action number: "..body.action) end
|
||||
if f then f(body) end
|
||||
end
|
||||
else
|
||||
MES.new('warn',"Wrong json: "..msg,5)
|
||||
|
||||
@@ -144,7 +144,7 @@ function scene.keyDown(key,isRep)
|
||||
elseif key=='return' then
|
||||
local mes=STRING.trim(inputBox:getText())
|
||||
if not inputBox.hide and #mes>0 then
|
||||
if NET.room.chat(mes) then
|
||||
if NET.room_chat(mes) then
|
||||
inputBox:clear()
|
||||
end
|
||||
else
|
||||
|
||||
@@ -86,7 +86,7 @@ function scene.keyDown(key)
|
||||
local R=roomList:getSel()
|
||||
if R and not TASK.getLock('fetchRoom') then
|
||||
if R.info.version==VERSION.room then
|
||||
NET.room.enter(R.roomId,passwordBox.value)
|
||||
NET.room_enter(R.roomId,passwordBox.value)
|
||||
else
|
||||
MES.new('error',text.versionNotMatch)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user