调整ws错误消息显示,整理翻译文本
This commit is contained in:
@@ -23,7 +23,7 @@ do--Connect
|
||||
|
||||
SOCK:settimeout(2.6)
|
||||
local res,err=SOCK:connect(host,port)
|
||||
if not res then readCHN:push(err)return end
|
||||
if err then readCHN:push(err)return end
|
||||
|
||||
--WebSocket handshake
|
||||
if not body then body=""end
|
||||
@@ -327,7 +327,7 @@ function WS.update(dt)
|
||||
ws.pongTimer=1
|
||||
else
|
||||
ws.status="dead"
|
||||
LOG.print(text.wsFailed.." "..mes,"warn")
|
||||
LOG.print(text.wsFailed..": "..(mes=="timeout"and text.netTimeout or mes),"warn")
|
||||
end
|
||||
end
|
||||
elseif ws.status=="running"then
|
||||
|
||||
@@ -90,10 +90,8 @@ return{
|
||||
accessFailed="Access Denied.",
|
||||
wsSuccessed="WebSocket: Connected.",
|
||||
wsFailed="WebSocket: Connection Failed.",
|
||||
wsDisconnected="WebSocket: Disconnected.",
|
||||
wsNoConn="WebSocket: Not Connected.",
|
||||
wsClose="WebSocket Closed: ",
|
||||
waitNetTask="Connecting. Please wait...",
|
||||
netTimeout="Network connection timeout",
|
||||
|
||||
createRoomTooFast="Hold on there! We can't handle this fast!",
|
||||
createRoomSuccessed="Room successfully created!",
|
||||
|
||||
@@ -91,10 +91,8 @@ return{
|
||||
accessFailed="Autorisation échouée",
|
||||
wsSuccessed="WebSocket: connecté",
|
||||
wsFailed="WebSocket: connection échouée",
|
||||
wsDisconnected="WebSocket: déconnecté",
|
||||
wsNoConn="WebSocket: vous n'êtes pas connecté",
|
||||
wsError="Erreur WebSocket : ",
|
||||
waitNetTask="Connexion, veuillez patienter",
|
||||
-- wsClose="WebSocket Closed: ",
|
||||
-- netTimeout="Network connection timeout",
|
||||
|
||||
createRoomTooFast="Vous avez créé un salon trop rapidement !",
|
||||
createRoomSuccessed="Salon créé avec succès !",
|
||||
|
||||
@@ -90,10 +90,8 @@ return{
|
||||
accessFailed="Falha na autorização",
|
||||
wsSuccessed="WebSocket: conectado",
|
||||
wsFailed="WebSocket: falha na conexão",
|
||||
wsDisconnected="WebSocket: desconectado",
|
||||
wsNoConn="WebSocket: você não está conectado",
|
||||
wsClose="WebSocket closed: ",
|
||||
waitNetTask="Conectando, aguarde",
|
||||
-- netTimeout="Network connection timeout",
|
||||
|
||||
-- createRoomTooFast="Create room too fast!",
|
||||
-- createRoomSuccessed="Room successfully created!",
|
||||
|
||||
@@ -92,10 +92,8 @@ return{
|
||||
-- accessFailed="Authorization failed",
|
||||
-- wsSuccessed="WebSocket: connected",
|
||||
-- wsFailed="WebSocket: connection failed",
|
||||
-- wsDisconnected="WebSocket: disconnected",
|
||||
-- wsNoConn="WebSocket: you are not connected",
|
||||
-- wsClose="WebSocket closed: ",
|
||||
-- waitNetTask="Connecting, please wait",
|
||||
-- netTimeout="Network connection timeout",
|
||||
|
||||
-- createRoomTooFast="Create room too fast!",
|
||||
-- createRoomSuccessed="Room successfully created!",
|
||||
|
||||
@@ -90,10 +90,8 @@ return{
|
||||
accessFailed="身份验证失败",
|
||||
wsSuccessed="WS连接成功",
|
||||
wsFailed="WS连接失败",
|
||||
wsDisconnected="WS连接断开",
|
||||
wsNoConn="WS未连接",
|
||||
wsClose="WS被断开: ",
|
||||
waitNetTask="正在连接,请稍候",
|
||||
netTimeout="网络连接超时",
|
||||
|
||||
createRoomTooFast="创建房间太快啦,等等吧",
|
||||
createRoomSuccessed="创建房间成功!",
|
||||
|
||||
@@ -53,11 +53,11 @@ end
|
||||
|
||||
--wsEvent
|
||||
function NET.wsCloseMessage(message)
|
||||
if message:sub(1,1)=="{"then
|
||||
local mes=JSON.decode(message)
|
||||
LOG.print(text.wsClose..mes.type,"warn")
|
||||
local mes=JSON.decode(message)
|
||||
if mes then
|
||||
LOG.print(("%s [%s] %s"):format(text.wsClose,mes.type or"unknown type",mes.reason or""),"warn")
|
||||
else
|
||||
LOG.print(text.wsClose..type,"warn")
|
||||
LOG.print(text.wsClose.."","warn")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ function scene.sceneInit()
|
||||
end
|
||||
function scene.sceneBack()
|
||||
NET.quitChat()
|
||||
LOG.print(text.wsDisconnected,"warn")
|
||||
end
|
||||
|
||||
function scene.wheelMoved(_,y)
|
||||
|
||||
@@ -27,7 +27,6 @@ local scene={}
|
||||
|
||||
function scene.sceneBack()
|
||||
NET.signal_quit()
|
||||
LOG.print(text.wsDisconnected,"warn")
|
||||
love.keyboard.setKeyRepeat(true)
|
||||
end
|
||||
function scene.sceneInit()
|
||||
|
||||
Reference in New Issue
Block a user