继续实现一堆联网消息
语言文件加一条 框架跟进
This commit is contained in:
Submodule Zframework updated: 1a44ad2ea1...98f0fff6b0
@@ -111,6 +111,7 @@ return{
|
|||||||
},
|
},
|
||||||
|
|
||||||
tooFrequently="Request too frequently",
|
tooFrequently="Request too frequently",
|
||||||
|
roomPasswordChanged="Room password changed",
|
||||||
getNoticeFail="Failed to fetch announcements",
|
getNoticeFail="Failed to fetch announcements",
|
||||||
oldVersion="Version $1 is now available",
|
oldVersion="Version $1 is now available",
|
||||||
needUpdate="Newer version required!",
|
needUpdate="Newer version required!",
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ return{
|
|||||||
},
|
},
|
||||||
|
|
||||||
-- tooFrequently="Request too frequently",
|
-- tooFrequently="Request too frequently",
|
||||||
|
-- roomPasswordChanged="Room password changed",
|
||||||
getNoticeFail="Error al buscar novedades.",
|
getNoticeFail="Error al buscar novedades.",
|
||||||
oldVersion="¡Está disponible la nueva versión $1!",
|
oldVersion="¡Está disponible la nueva versión $1!",
|
||||||
needUpdate="¡Nueva versión requerida!",
|
needUpdate="¡Nueva versión requerida!",
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ return{
|
|||||||
},
|
},
|
||||||
|
|
||||||
-- tooFrequently="Request too frequently",
|
-- tooFrequently="Request too frequently",
|
||||||
|
-- roomPasswordChanged="Room password changed",
|
||||||
getNoticeFail="Echec de l'obtention de la notice",
|
getNoticeFail="Echec de l'obtention de la notice",
|
||||||
oldVersion="La version $1 est disponible !",
|
oldVersion="La version $1 est disponible !",
|
||||||
-- versionNotMatch="Version do not match!",
|
-- versionNotMatch="Version do not match!",
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ return{
|
|||||||
},
|
},
|
||||||
|
|
||||||
-- tooFrequently="Request too frequently",
|
-- tooFrequently="Request too frequently",
|
||||||
|
-- roomPasswordChanged="Room password changed",
|
||||||
getNoticeFail="Gagal mengambil pengumuman-pengumuman",
|
getNoticeFail="Gagal mengambil pengumuman-pengumuman",
|
||||||
oldVersion="Versi $1 sekarang tersedia",
|
oldVersion="Versi $1 sekarang tersedia",
|
||||||
needUpdate="Butuh versi lebih baru!",
|
needUpdate="Butuh versi lebih baru!",
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ return{
|
|||||||
},
|
},
|
||||||
|
|
||||||
-- tooFrequently="Request too frequently",
|
-- tooFrequently="Request too frequently",
|
||||||
|
-- roomPasswordChanged="Room password changed",
|
||||||
getNoticeFail="お知らせ情報を取得できませんでした",
|
getNoticeFail="お知らせ情報を取得できませんでした",
|
||||||
oldVersion="バージョン$1のダウンロードが可能になりました",
|
oldVersion="バージョン$1のダウンロードが可能になりました",
|
||||||
needUpdate="最新バージョンに更新してください",
|
needUpdate="最新バージョンに更新してください",
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ return{
|
|||||||
},
|
},
|
||||||
|
|
||||||
-- tooFrequently="Request too frequently",
|
-- tooFrequently="Request too frequently",
|
||||||
|
-- roomPasswordChanged="Room password changed",
|
||||||
getNoticeFail="Não conseguiu ter anúncios",
|
getNoticeFail="Não conseguiu ter anúncios",
|
||||||
oldVersion="Versão $1 esta disponível agora!",
|
oldVersion="Versão $1 esta disponível agora!",
|
||||||
-- versionNotMatch="Version do not match!",
|
-- versionNotMatch="Version do not match!",
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ return{
|
|||||||
},
|
},
|
||||||
|
|
||||||
tooFrequently="操作太频繁",
|
tooFrequently="操作太频繁",
|
||||||
|
roomPasswordChanged="房间密码已更改",
|
||||||
getNoticeFail="拉取公告失败",
|
getNoticeFail="拉取公告失败",
|
||||||
oldVersion="最新版本$1可以下载了!",
|
oldVersion="最新版本$1可以下载了!",
|
||||||
needUpdate="请更新游戏!",
|
needUpdate="请更新游戏!",
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ return{
|
|||||||
},
|
},
|
||||||
|
|
||||||
tooFrequently="Error.requestTooFrequently();",
|
tooFrequently="Error.requestTooFrequently();",
|
||||||
|
roomPasswordChanged="Info.roomPwChanged();",
|
||||||
getNoticeFail="Error.FetchAnnouncement();",
|
getNoticeFail="Error.FetchAnnouncement();",
|
||||||
oldVersion="Version.New($1);",
|
oldVersion="Version.New($1);",
|
||||||
needUpdate="Version.NeedUpdate();",
|
needUpdate="Version.NeedUpdate();",
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ return{
|
|||||||
},
|
},
|
||||||
|
|
||||||
tooFrequently="操作太頻繁",
|
tooFrequently="操作太頻繁",
|
||||||
|
roomPasswordChanged="房間密碼已更改",
|
||||||
getNoticeFail="無法獲取公告",
|
getNoticeFail="無法獲取公告",
|
||||||
oldVersion="版本 $1 現已推出",
|
oldVersion="版本 $1 現已推出",
|
||||||
needUpdate="請更新遊戲!",
|
needUpdate="請更新遊戲!",
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ local NET={
|
|||||||
roomReadyState=false,
|
roomReadyState=false,
|
||||||
|
|
||||||
onlineCount="_",
|
onlineCount="_",
|
||||||
|
|
||||||
|
textBox=WIDGET.newTextBox{name='texts',x=340,y=80,w=600,h=560},
|
||||||
|
inputBox=WIDGET.newInputBox{name='input',x=340,y=660,w=600,h=50,limit=256},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -309,6 +312,15 @@ function NET.pwLogin(email,pw)
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--Remove player when leave
|
||||||
|
local function _removePlayer(L,sid)
|
||||||
|
for i=1,#L do
|
||||||
|
if L[i].sid==sid then
|
||||||
|
return table.remove(L,i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--------------------------<NEW WS API>
|
--------------------------<NEW WS API>
|
||||||
local actMap={
|
local actMap={
|
||||||
global_getOnlineCount= 1000,
|
global_getOnlineCount= 1000,
|
||||||
@@ -473,39 +485,77 @@ NET.wsCallBack={}
|
|||||||
function NET.wsCallBack.global_getOnlineCount(body)
|
function NET.wsCallBack.global_getOnlineCount(body)
|
||||||
NET.onlineCount=tonumber(body.data) or "_"
|
NET.onlineCount=tonumber(body.data) or "_"
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.room_chat(body)-- TODO
|
function NET.wsCallBack.room_chat(body)
|
||||||
|
if SCN.cur=='net_game' then
|
||||||
|
TASK.unlock('receiveMessage')
|
||||||
|
TASK.lock('receiveMessage',1)
|
||||||
|
NET.textBox:push{
|
||||||
|
COLOR.L,"[?]",-- TODO
|
||||||
|
COLOR.Y,"#"..body.playerId.." ",
|
||||||
|
COLOR.I,body.message,
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.room_create(body)
|
function NET.wsCallBack.room_create(body)
|
||||||
TASK.unlock('createRoom')
|
NET.wsCallBack.room_enter(body)
|
||||||
-- NET.roomState=...
|
|
||||||
-- SCN.go('net_game')
|
|
||||||
WAIT.interrupt()
|
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.room_getData(body)-- TODO
|
function NET.wsCallBack.room_getData(body)
|
||||||
|
NET.roomState.roomData=body.data
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.room_setData(body)-- TODO
|
function NET.wsCallBack.room_setData(body)
|
||||||
|
NET.wsCallBack.room_getData(body)
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.room_getInfo(body)-- TODO
|
function NET.wsCallBack.room_getInfo(body)
|
||||||
|
NET.roomState.roomInfo=body.info
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.room_setInfo(body)-- TODO
|
function NET.wsCallBack.room_setInfo(body)
|
||||||
|
NET.wsCallBack.room_getInfo(body)
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.room_enter(body)
|
function NET.wsCallBack.room_enter(body)-- TODO
|
||||||
TASK.unlock('enterRoom')
|
TASK.unlock('enterRoom')
|
||||||
-- NET.roomState=...
|
-- NET.roomState=...
|
||||||
-- SCN.go('net_game')
|
NET.textBox.hide=true
|
||||||
|
NET.inputBox.hide=true
|
||||||
|
NET.textBox:clear()
|
||||||
|
NET.inputBox:clear()
|
||||||
|
loadGame('netBattle',true,true)
|
||||||
WAIT.interrupt()
|
WAIT.interrupt()
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.room_kick(body)-- TODO
|
function NET.wsCallBack.room_kick(body)
|
||||||
|
if body.data then
|
||||||
|
-- local eid=body.data.executorId
|
||||||
|
local uid=body.data.targetId
|
||||||
|
NETPLY.remove(uid)
|
||||||
|
_removePlayer(PLAYERS,uid)
|
||||||
|
_removePlayer(PLY_ALIVE,uid)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.room_leave(body)-- TODO
|
function NET.wsCallBack.room_leave(body)
|
||||||
|
if body.data then
|
||||||
|
if body.type=='Server' then
|
||||||
|
if SCN.cur=='net_game' then
|
||||||
|
if SCN.stack[#SCN.stack-1]=='net_newRoom' then
|
||||||
|
SCN.pop()
|
||||||
|
end
|
||||||
|
SCN.back()
|
||||||
|
end
|
||||||
|
elseif body.type=='Client' then
|
||||||
|
local uid=body.data.playerId
|
||||||
|
NETPLY.remove(uid)
|
||||||
|
_removePlayer(PLAYERS,uid)
|
||||||
|
_removePlayer(PLY_ALIVE,uid)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.room_fetch(body)
|
function NET.wsCallBack.room_fetch(body)
|
||||||
TASK.unlock('fetchRoom')
|
TASK.unlock('fetchRoom')
|
||||||
if body.data then SCN.scenes.net_rooms.widgetList.roomList:setList(body.data) end
|
if body.data then SCN.scenes.net_rooms.widgetList.roomList:setList(body.data) end
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.room_setPW(body)-- TODO
|
function NET.wsCallBack.room_setPW()
|
||||||
|
MES.new(text.roomPasswordChanged)
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.room_remove(body)-- TODO
|
function NET.wsCallBack.room_remove(body)
|
||||||
|
NET.wsCallBack.room_leave(body)
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.player_updateConf(body)-- TODO
|
function NET.wsCallBack.player_updateConf(body)-- TODO
|
||||||
end
|
end
|
||||||
@@ -559,7 +609,7 @@ function NET.ws_update()
|
|||||||
local body=JSON.decode(msg)
|
local body=JSON.decode(msg)
|
||||||
if body then
|
if body then
|
||||||
-- print(("Recv: <-- $1 ($2)"):repD(body.action,body.type))
|
-- print(("Recv: <-- $1 ($2)"):repD(body.action,body.type))
|
||||||
-- print(("Recv: <-- $1 ($2)"):repD(body.action,body.type)) print(TABLE.dump(body),"\n")
|
print(("Recv: <-- $1 ($2)"):repD(body.action,body.type)) print(TABLE.dump(body),"\n")
|
||||||
if body.type=='Failed' then
|
if body.type=='Failed' then
|
||||||
parseError(body.message~=nil and body.message or msg)
|
parseError(body.message~=nil and body.message or msg)
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -10,15 +10,14 @@ local ins=table.insert
|
|||||||
local SCR,VK,NET,NETPLY=SCR,VK,NET,NETPLY
|
local SCR,VK,NET,NETPLY=SCR,VK,NET,NETPLY
|
||||||
local PLAYERS,GAME=PLAYERS,GAME
|
local PLAYERS,GAME=PLAYERS,GAME
|
||||||
|
|
||||||
local textBox=WIDGET.newTextBox{name='texts',x=340,y=80,w=600,h=560}
|
local textBox=NET.textBox
|
||||||
local inputBox=WIDGET.newInputBox{name='input',x=340,y=660,w=600,h=50,limit=256}
|
local inputBox=NET.inputBox
|
||||||
|
|
||||||
local playing
|
local playing
|
||||||
local lastUpstreamTime
|
local lastUpstreamTime
|
||||||
local upstreamProgress
|
local upstreamProgress
|
||||||
local noTouch,noKey=false,false
|
local noTouch,noKey=false,false
|
||||||
local touchMoveLastFrame=false
|
local touchMoveLastFrame=false
|
||||||
local newMessageTimer
|
|
||||||
|
|
||||||
local function _hideReadyUI()
|
local function _hideReadyUI()
|
||||||
return
|
return
|
||||||
@@ -66,15 +65,10 @@ end
|
|||||||
local scene={}
|
local scene={}
|
||||||
|
|
||||||
function scene.sceneInit()
|
function scene.sceneInit()
|
||||||
textBox.hide=true
|
|
||||||
textBox:clear()
|
|
||||||
inputBox.hide=true
|
|
||||||
|
|
||||||
noTouch=not SETTING.VKSwitch
|
noTouch=not SETTING.VKSwitch
|
||||||
playing=false
|
playing=false
|
||||||
lastUpstreamTime=0
|
lastUpstreamTime=0
|
||||||
upstreamProgress=1
|
upstreamProgress=1
|
||||||
newMessageTimer=0
|
|
||||||
|
|
||||||
if SCN.prev=='setting_game' then
|
if SCN.prev=='setting_game' then
|
||||||
NET.player_updateConf()
|
NET.player_updateConf()
|
||||||
@@ -216,7 +210,6 @@ function scene.socketRead(cmd,d)
|
|||||||
COLOR.Y,text.leaveRoom,
|
COLOR.Y,text.leaveRoom,
|
||||||
}
|
}
|
||||||
elseif cmd=='talk' then
|
elseif cmd=='talk' then
|
||||||
newMessageTimer=80
|
|
||||||
textBox:push{
|
textBox:push{
|
||||||
COLOR.Z,d.username,
|
COLOR.Z,d.username,
|
||||||
COLOR.dY,"#"..d.uid.." ",
|
COLOR.dY,"#"..d.uid.." ",
|
||||||
@@ -275,9 +268,6 @@ function scene.update(dt)
|
|||||||
else
|
else
|
||||||
NETPLY.update(dt)
|
NETPLY.update(dt)
|
||||||
end
|
end
|
||||||
if newMessageTimer>0 then
|
|
||||||
newMessageTimer=newMessageTimer-1
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.draw()
|
function scene.draw()
|
||||||
@@ -336,9 +326,10 @@ function scene.draw()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- New message
|
-- New message
|
||||||
if newMessageTimer>0 then
|
local a=TASK.getLock('receiveMessage')
|
||||||
|
if a then
|
||||||
setFont(40)
|
setFont(40)
|
||||||
gc_setColor(.3,.7,1,(newMessageTimer/60)^2)
|
gc_setColor(.3,.7,1,a^2)
|
||||||
gc_print("M",430,10)
|
gc_print("M",430,10)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user