修正玩家进出房间相关问题
修正获取玩家信息相关问题 实现操作录像传输 修改一些语言文本
This commit is contained in:
@@ -137,8 +137,8 @@ return{
|
|||||||
createRoomSuccessed="Room created",
|
createRoomSuccessed="Room created",
|
||||||
playerKicked="[$1] removed [$2] from room",
|
playerKicked="[$1] removed [$2] from room",
|
||||||
started="Playing",
|
started="Playing",
|
||||||
joinRoom="has entered the room.",
|
joinRoom="$1 has entered the room.",
|
||||||
leaveRoom="has left the room.",
|
leaveRoom="$1 has left the room.",
|
||||||
ready="Ready",
|
ready="Ready",
|
||||||
connStream="Connecting",
|
connStream="Connecting",
|
||||||
waitStream="Waiting",
|
waitStream="Waiting",
|
||||||
|
|||||||
@@ -136,8 +136,8 @@ return{
|
|||||||
createRoomSuccessed="¡Sala creada con éxito!",
|
createRoomSuccessed="¡Sala creada con éxito!",
|
||||||
-- playerKicked="[$1] removed [$2] from room",
|
-- playerKicked="[$1] removed [$2] from room",
|
||||||
started="En juego",
|
started="En juego",
|
||||||
joinRoom="entró a la sala.",
|
joinRoom="$1 entró a la sala.",
|
||||||
leaveRoom="salió de la sala.",
|
leaveRoom="$1 salió de la sala.",
|
||||||
ready="LISTO",
|
ready="LISTO",
|
||||||
connStream="CONECTANDO",
|
connStream="CONECTANDO",
|
||||||
waitStream="ESPERANDO",
|
waitStream="ESPERANDO",
|
||||||
|
|||||||
@@ -127,8 +127,8 @@ return{
|
|||||||
createRoomSuccessed="Salon créé avec succès !",
|
createRoomSuccessed="Salon créé avec succès !",
|
||||||
-- playerKicked="[$1] removed [$2] from room",
|
-- playerKicked="[$1] removed [$2] from room",
|
||||||
-- started="Playing",
|
-- started="Playing",
|
||||||
joinRoom="a rejoint le salon.",
|
joinRoom="$1 a rejoint le salon.",
|
||||||
leaveRoom="a quitté le salon.",
|
leaveRoom="$1 a quitté le salon.",
|
||||||
-- ready="READY",
|
-- ready="READY",
|
||||||
-- connStream="CONNECTING",
|
-- connStream="CONNECTING",
|
||||||
-- waitStream="WAITING",
|
-- waitStream="WAITING",
|
||||||
|
|||||||
@@ -138,8 +138,8 @@ return{
|
|||||||
createRoomSuccessed="Ruang terbuat",
|
createRoomSuccessed="Ruang terbuat",
|
||||||
-- playerKicked="[$1] removed [$2] from room",
|
-- playerKicked="[$1] removed [$2] from room",
|
||||||
started="Bermain",
|
started="Bermain",
|
||||||
joinRoom="telah memasuki ruangan.",
|
joinRoom="$1 telah memasuki ruangan.",
|
||||||
leaveRoom="telah keluar dari ruangan.",
|
leaveRoom="$1 telah keluar dari ruangan.",
|
||||||
ready="Siap",
|
ready="Siap",
|
||||||
connStream="Memuat",
|
connStream="Memuat",
|
||||||
waitStream="Menunggu",
|
waitStream="Menunggu",
|
||||||
|
|||||||
@@ -138,8 +138,8 @@ return{
|
|||||||
createRoomSuccessed="部屋を建てました",
|
createRoomSuccessed="部屋を建てました",
|
||||||
-- playerKicked="[$1] removed [$2] from room",
|
-- playerKicked="[$1] removed [$2] from room",
|
||||||
started="プレイ中",
|
started="プレイ中",
|
||||||
joinRoom="が入室しました",
|
joinRoom="$1 が入室しました",
|
||||||
leaveRoom="が退出しました",
|
leaveRoom="$1 が退出しました",
|
||||||
ready="準備OK",
|
ready="準備OK",
|
||||||
connStream="接続中……",
|
connStream="接続中……",
|
||||||
waitStream="待機中……",
|
waitStream="待機中……",
|
||||||
|
|||||||
@@ -125,8 +125,8 @@ return{
|
|||||||
-- createRoomSuccessed="Room successfully created!",
|
-- createRoomSuccessed="Room successfully created!",
|
||||||
-- playerKicked="[$1] removed [$2] from room",
|
-- playerKicked="[$1] removed [$2] from room",
|
||||||
-- started="Playing",
|
-- started="Playing",
|
||||||
joinRoom="Entrou a sala.",
|
joinRoom="$1 Entrou a sala.",
|
||||||
leaveRoom="Saiu da sala.",
|
leaveRoom="$1 Saiu da sala.",
|
||||||
-- ready="READY",
|
-- ready="READY",
|
||||||
-- connStream="CONNECTING",
|
-- connStream="CONNECTING",
|
||||||
-- waitStream="WAITING",
|
-- waitStream="WAITING",
|
||||||
|
|||||||
@@ -137,8 +137,8 @@ return{
|
|||||||
createRoomSuccessed="创建房间成功!",
|
createRoomSuccessed="创建房间成功!",
|
||||||
playerKicked="<$1>把<$2>移出了房间",
|
playerKicked="<$1>把<$2>移出了房间",
|
||||||
started="游戏中",
|
started="游戏中",
|
||||||
joinRoom="进入房间",
|
joinRoom="$1 进入房间",
|
||||||
leaveRoom="离开房间",
|
leaveRoom="$1 离开房间",
|
||||||
ready="各就各位!",
|
ready="各就各位!",
|
||||||
connStream="正在连接",
|
connStream="正在连接",
|
||||||
waitStream="等待其他人连接",
|
waitStream="等待其他人连接",
|
||||||
|
|||||||
@@ -137,8 +137,8 @@ return{
|
|||||||
createRoomSuccessed="CreateRoom.Successs=true",
|
createRoomSuccessed="CreateRoom.Successs=true",
|
||||||
playerKicked="[$1]: roomKick([$2])",
|
playerKicked="[$1]: roomKick([$2])",
|
||||||
started="Room.Playing();",
|
started="Room.Playing();",
|
||||||
joinRoom="Room.Join();",
|
joinRoom="Room.Join($1);",
|
||||||
leaveRoom="Room.Leave();",
|
leaveRoom="Room.Leave($1);",
|
||||||
ready="Ready();",
|
ready="Ready();",
|
||||||
connStream="Stream.Connecting();",
|
connStream="Stream.Connecting();",
|
||||||
waitStream="Stream.Waiting();",
|
waitStream="Stream.Waiting();",
|
||||||
|
|||||||
@@ -137,8 +137,8 @@ return{
|
|||||||
createRoomSuccessed="房間已創建!",
|
createRoomSuccessed="房間已創建!",
|
||||||
playerKicked="<$1>把<$2>移出了房間",
|
playerKicked="<$1>把<$2>移出了房間",
|
||||||
started="遊戲中",
|
started="遊戲中",
|
||||||
joinRoom="進入房間",
|
joinRoom="$1 進入房間",
|
||||||
leaveRoom="離開房間",
|
leaveRoom="$1 離開房間",
|
||||||
ready="準備!",
|
ready="準備!",
|
||||||
connStream="正在連接……",
|
connStream="正在連接……",
|
||||||
waitStream="等待其他用戶連接……",
|
waitStream="等待其他用戶連接……",
|
||||||
|
|||||||
@@ -441,6 +441,22 @@ local function _playerLeaveRoom(uid)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--Push stream data to players
|
||||||
|
local function _pumpStream(d)
|
||||||
|
if d.playerId==USER.uid then return end
|
||||||
|
for _,P in next,PLAYERS do
|
||||||
|
if P.uid==d.playerId then
|
||||||
|
local res,stream=pcall(love.data.decode,'string','base64',d.data)
|
||||||
|
if res then
|
||||||
|
DATA.pumpRecording(stream,P.stream)
|
||||||
|
else
|
||||||
|
MES.new('error',"Bad stream from "..P.username.."#"..P.uid,.1)
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Global
|
-- Global
|
||||||
function NET.global_getOnlineCount()
|
function NET.global_getOnlineCount()
|
||||||
wsSend(actMap.global_getOnlineCount)
|
wsSend(actMap.global_getOnlineCount)
|
||||||
@@ -546,7 +562,7 @@ function NET.player_setState(state)-- not used
|
|||||||
wsSend(actMap.player_setState,state)
|
wsSend(actMap.player_setState,state)
|
||||||
end
|
end
|
||||||
function NET.player_stream(stream)
|
function NET.player_stream(stream)
|
||||||
wsSend(actMap.player_stream,stream)
|
wsSend(actMap.player_stream,love.data.encode('string','base64',stream))
|
||||||
end
|
end
|
||||||
function NET.player_setPlayMode(mode)
|
function NET.player_setPlayMode(mode)
|
||||||
wsSend(actMap.player_setPlayMode,mode)
|
wsSend(actMap.player_setPlayMode,mode)
|
||||||
@@ -588,14 +604,16 @@ function NET.wsCallBack.room_setInfo(body)
|
|||||||
end
|
end
|
||||||
function NET.wsCallBack.room_enter(body)
|
function NET.wsCallBack.room_enter(body)
|
||||||
TASK.unlock('enterRoom')
|
TASK.unlock('enterRoom')
|
||||||
NET.textBox.hide=true
|
|
||||||
NET.inputBox.hide=true
|
|
||||||
NET.textBox:clear()
|
|
||||||
NET.inputBox:clear()
|
|
||||||
|
|
||||||
NET.roomState=body.data
|
|
||||||
NETPLY.clear()
|
|
||||||
if body.data.players then
|
if body.data.players then
|
||||||
|
NET.textBox.hide=true
|
||||||
|
NET.inputBox.hide=true
|
||||||
|
NET.textBox:clear()
|
||||||
|
NET.inputBox:clear()
|
||||||
|
|
||||||
|
NET.roomState=body.data
|
||||||
|
NETPLY.clear()
|
||||||
|
loadGame('netBattle',true,true)
|
||||||
for _,p in next,body.data.players do
|
for _,p in next,body.data.players do
|
||||||
NETPLY.add{
|
NETPLY.add{
|
||||||
uid=p.playerId,
|
uid=p.playerId,
|
||||||
@@ -604,9 +622,16 @@ function NET.wsCallBack.room_enter(body)
|
|||||||
config=p.config,
|
config=p.config,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
local p=body.data
|
||||||
|
NETPLY.add{
|
||||||
|
uid=p.playerId,
|
||||||
|
playMode=p.type,
|
||||||
|
readyMode=p.state,
|
||||||
|
config=p.config,
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
loadGame('netBattle',true,true)
|
|
||||||
WAIT.interrupt()
|
WAIT.interrupt()
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.room_kick(body)
|
function NET.wsCallBack.room_kick(body)
|
||||||
@@ -641,7 +666,8 @@ function NET.wsCallBack.player_setHost(body)-- TODO
|
|||||||
end
|
end
|
||||||
function NET.wsCallBack.player_setState(body)-- TODO (not used)
|
function NET.wsCallBack.player_setState(body)-- TODO (not used)
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.player_stream(body)-- TODO
|
function NET.wsCallBack.player_stream(body)
|
||||||
|
_pumpStream(body.data)
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.player_setPlayMode(body)
|
function NET.wsCallBack.player_setPlayMode(body)
|
||||||
NETPLY.setPlayMode(body.data.playerId,body.data.type)
|
NETPLY.setPlayMode(body.data.playerId,body.data.type)
|
||||||
|
|||||||
@@ -399,19 +399,19 @@ function PLY.newDemoPlayer(id)
|
|||||||
}
|
}
|
||||||
P:popNext()
|
P:popNext()
|
||||||
end
|
end
|
||||||
function PLY.newRemotePlayer(id,mini,ply)
|
function PLY.newRemotePlayer(id,mini,p)
|
||||||
local P=_newEmptyPlayer(id,mini)
|
local P=_newEmptyPlayer(id,mini)
|
||||||
P.type='remote'
|
P.type='remote'
|
||||||
|
|
||||||
P.draw=ply_draw.norm
|
P.draw=ply_draw.norm
|
||||||
P:startStreaming()
|
P:startStreaming()
|
||||||
|
|
||||||
NETPLY.setPlayerObj(ply,P)
|
NETPLY.setPlayerObj(p,P)
|
||||||
P.uid=ply.uid
|
P.uid=p.uid
|
||||||
P.username=ply.username
|
P.username=USERS.getUsername(p.uid)
|
||||||
P.sid=NET.uid_sid[ply.uid]
|
P.sid=NET.uid_sid[p.uid]
|
||||||
|
|
||||||
_loadRemoteEnv(P,ply.config)
|
_loadRemoteEnv(P,p.config)
|
||||||
_applyGameEnv(P)
|
_applyGameEnv(P)
|
||||||
end
|
end
|
||||||
function PLY.newAIPlayer(id,AIdata,mini)
|
function PLY.newAIPlayer(id,AIdata,mini)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ scene.widgetList={
|
|||||||
WIDGET.newButton{name='league',x=640, y=180,w=350,h=120,font=40,color='D',code=goScene'net_league'},
|
WIDGET.newButton{name='league',x=640, y=180,w=350,h=120,font=40,color='D',code=goScene'net_league'},
|
||||||
WIDGET.newButton{name='ffa', x=640, y=360,w=350,h=120,font=40,color='D',code=function() MES.new('warn',text.notFinished)--[[NET.enterRoom({name='ffa'})]] end},
|
WIDGET.newButton{name='ffa', x=640, y=360,w=350,h=120,font=40,color='D',code=function() MES.new('warn',text.notFinished)--[[NET.enterRoom({name='ffa'})]] end},
|
||||||
WIDGET.newButton{name='rooms', x=640, y=540,w=350,h=120,font=40,code=goScene'net_rooms'},
|
WIDGET.newButton{name='rooms', x=640, y=540,w=350,h=120,font=40,code=goScene'net_rooms'},
|
||||||
WIDGET.newButton{name='resetPW',x=680, y=40,w=180,h=60,color='dG',code=function() SCN.go('reset_password','none') end},
|
WIDGET.newButton{name='resetPW',x=680,y=40,w=180,h=60,color='dG',code=goScene'reset_password'},
|
||||||
WIDGET.newButton{name='logout',x=880, y=40,w=180, h=60,color='dR',
|
WIDGET.newButton{name='logout',x=880, y=40,w=180, h=60,color='dR',
|
||||||
code=function()
|
code=function()
|
||||||
if tryBack() then
|
if tryBack() then
|
||||||
|
|||||||
@@ -81,8 +81,8 @@ function USERS.updateAvatar(uid,imgData)
|
|||||||
db_img[uid]=_loadAvatar("cache/"..hash)
|
db_img[uid]=_loadAvatar("cache/"..hash)
|
||||||
end
|
end
|
||||||
|
|
||||||
function USERS.getUsername(uid) return db[uid].username end
|
function USERS.getUsername(uid) return db[uid].username or "" end
|
||||||
function USERS.getMotto(uid) return db[uid].motto end
|
function USERS.getMotto(uid) return db[uid].motto or "" end
|
||||||
function USERS.getAvatar(uid)
|
function USERS.getAvatar(uid)
|
||||||
if uid then
|
if uid then
|
||||||
if not db[uid].new then
|
if not db[uid].new then
|
||||||
|
|||||||
Reference in New Issue
Block a user