添加房主和队伍状态的显示方式
添加转交房主提示
This commit is contained in:
@@ -182,6 +182,7 @@ return{
|
|||||||
onlinePlayerCount="Online: $1",
|
onlinePlayerCount="Online: $1",
|
||||||
createRoomSuccessed="Room created",
|
createRoomSuccessed="Room created",
|
||||||
playerKicked="$1 removed $2 from room",
|
playerKicked="$1 removed $2 from room",
|
||||||
|
becomeHost="$1 become host",
|
||||||
started="Playing",
|
started="Playing",
|
||||||
joinRoom="$1 has entered the room.",
|
joinRoom="$1 has entered the room.",
|
||||||
leaveRoom="$1 has left the room.",
|
leaveRoom="$1 has left the room.",
|
||||||
|
|||||||
@@ -181,6 +181,7 @@ return{
|
|||||||
onlinePlayerCount="En línea: $1",
|
onlinePlayerCount="En línea: $1",
|
||||||
createRoomSuccessed="¡Sala creada con éxito!",
|
createRoomSuccessed="¡Sala creada con éxito!",
|
||||||
-- playerKicked="$1 removed $2 from room",
|
-- playerKicked="$1 removed $2 from room",
|
||||||
|
-- becomeHost="$1 become host",
|
||||||
started="En juego",
|
started="En juego",
|
||||||
joinRoom="$1 entró a la sala.",
|
joinRoom="$1 entró a la sala.",
|
||||||
leaveRoom="$1 salió de la sala.",
|
leaveRoom="$1 salió de la sala.",
|
||||||
|
|||||||
@@ -173,6 +173,7 @@ return{
|
|||||||
-- onlinePlayerCount="Online: $1",
|
-- onlinePlayerCount="Online: $1",
|
||||||
createRoomSuccessed="Salon créé avec succès !",
|
createRoomSuccessed="Salon créé avec succès !",
|
||||||
-- playerKicked="$1 removed $2 from room",
|
-- playerKicked="$1 removed $2 from room",
|
||||||
|
-- becomeHost="$1 become host",
|
||||||
-- started="Playing",
|
-- started="Playing",
|
||||||
joinRoom="$1 a rejoint le salon.",
|
joinRoom="$1 a rejoint le salon.",
|
||||||
leaveRoom="$1 a quitté le salon.",
|
leaveRoom="$1 a quitté le salon.",
|
||||||
|
|||||||
@@ -183,6 +183,7 @@ return{
|
|||||||
onlinePlayerCount="Online: $1",
|
onlinePlayerCount="Online: $1",
|
||||||
createRoomSuccessed="Ruang terbuat",
|
createRoomSuccessed="Ruang terbuat",
|
||||||
-- playerKicked="$1 removed $2 from room",
|
-- playerKicked="$1 removed $2 from room",
|
||||||
|
-- becomeHost="$1 become host",
|
||||||
started="Bermain",
|
started="Bermain",
|
||||||
joinRoom="$1 telah memasuki ruangan.",
|
joinRoom="$1 telah memasuki ruangan.",
|
||||||
leaveRoom="$1 telah keluar dari ruangan.",
|
leaveRoom="$1 telah keluar dari ruangan.",
|
||||||
|
|||||||
@@ -183,6 +183,7 @@ return{
|
|||||||
onlinePlayerCount="オンライン人数: $1",
|
onlinePlayerCount="オンライン人数: $1",
|
||||||
createRoomSuccessed="部屋を建てました",
|
createRoomSuccessed="部屋を建てました",
|
||||||
-- playerKicked="$1 removed $2 from room",
|
-- playerKicked="$1 removed $2 from room",
|
||||||
|
-- becomeHost="$1 become host",
|
||||||
started="プレイ中",
|
started="プレイ中",
|
||||||
joinRoom="$1 が入室しました",
|
joinRoom="$1 が入室しました",
|
||||||
leaveRoom="$1 が退出しました",
|
leaveRoom="$1 が退出しました",
|
||||||
|
|||||||
@@ -170,6 +170,7 @@ return{
|
|||||||
-- onlinePlayerCount="Online: $1",
|
-- onlinePlayerCount="Online: $1",
|
||||||
-- createRoomSuccessed="Room successfully created!",
|
-- createRoomSuccessed="Room successfully created!",
|
||||||
-- playerKicked="$1 removed $2 from room",
|
-- playerKicked="$1 removed $2 from room",
|
||||||
|
-- becomeHost="$1 become host",
|
||||||
-- started="Playing",
|
-- started="Playing",
|
||||||
joinRoom="$1 Entrou a sala.",
|
joinRoom="$1 Entrou a sala.",
|
||||||
leaveRoom="$1 Saiu da sala.",
|
leaveRoom="$1 Saiu da sala.",
|
||||||
|
|||||||
@@ -182,6 +182,7 @@ return{
|
|||||||
onlinePlayerCount="在线人数: $1",
|
onlinePlayerCount="在线人数: $1",
|
||||||
createRoomSuccessed="创建房间成功!",
|
createRoomSuccessed="创建房间成功!",
|
||||||
playerKicked="$1 把 $2 移出了房间",
|
playerKicked="$1 把 $2 移出了房间",
|
||||||
|
becomeHost="$1 成为了房主",
|
||||||
started="游戏中",
|
started="游戏中",
|
||||||
joinRoom="$1 进入房间",
|
joinRoom="$1 进入房间",
|
||||||
leaveRoom="$1 离开房间",
|
leaveRoom="$1 离开房间",
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ return{
|
|||||||
onlinePlayerCount="OnlinePlayerCount=$1",
|
onlinePlayerCount="OnlinePlayerCount=$1",
|
||||||
createRoomSuccessed="CreateRoom.Successs=true",
|
createRoomSuccessed="CreateRoom.Successs=true",
|
||||||
playerKicked="[$1]: roomKick([$2])",
|
playerKicked="[$1]: roomKick([$2])",
|
||||||
|
-- becomeHost="$1 become host",
|
||||||
started="Room.Playing();",
|
started="Room.Playing();",
|
||||||
joinRoom="Room.Join($1);",
|
joinRoom="Room.Join($1);",
|
||||||
leaveRoom="Room.Leave($1);",
|
leaveRoom="Room.Leave($1);",
|
||||||
|
|||||||
@@ -182,6 +182,7 @@ return{
|
|||||||
onlinePlayerCount="在線用戶數: $1",
|
onlinePlayerCount="在線用戶數: $1",
|
||||||
createRoomSuccessed="房間已創建!",
|
createRoomSuccessed="房間已創建!",
|
||||||
playerKicked="#$1 把 #$2 移出了房間",
|
playerKicked="#$1 把 #$2 移出了房間",
|
||||||
|
becomeHost="$1 成為了房主",
|
||||||
started="遊戲中",
|
started="遊戲中",
|
||||||
joinRoom="$1 進入房間",
|
joinRoom="$1 進入房間",
|
||||||
leaveRoom="$1 離開房間",
|
leaveRoom="$1 離開房間",
|
||||||
|
|||||||
@@ -433,6 +433,10 @@ local function wsSend(act,data)
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function _getFullName(uid)
|
||||||
|
return USERS.getUsername(uid).."#"..uid
|
||||||
|
end
|
||||||
|
|
||||||
--Remove player when leave
|
--Remove player when leave
|
||||||
local function _playerLeaveRoom(uid)
|
local function _playerLeaveRoom(uid)
|
||||||
for i=1,#PLAYERS do if PLAYERS[i].uid==uid then table.remove(PLAYERS,i) break end end
|
for i=1,#PLAYERS do if PLAYERS[i].uid==uid then table.remove(PLAYERS,i) break end end
|
||||||
@@ -455,7 +459,7 @@ local function _pumpStream(d)
|
|||||||
if res then
|
if res then
|
||||||
DATA.pumpRecording(stream,P.stream)
|
DATA.pumpRecording(stream,P.stream)
|
||||||
else
|
else
|
||||||
MES.new('error',"Bad stream from "..USERS.getUsername(P.uid).."#"..P.uid,.1)
|
MES.new('error',"Bad stream from ".._getFullName(P.uid),.1)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -585,8 +589,7 @@ function NET.wsCallBack.room_chat(body)
|
|||||||
TASK.unlock('receiveMessage')
|
TASK.unlock('receiveMessage')
|
||||||
TASK.lock('receiveMessage',1)
|
TASK.lock('receiveMessage',1)
|
||||||
NET.textBox:push{
|
NET.textBox:push{
|
||||||
COLOR.Z,USERS.getUsername(body.data.playerId),
|
COLOR.Z,_getFullName(body.data.playerId),
|
||||||
COLOR.Y,"#"..body.data.playerId.." ",
|
|
||||||
COLOR.N,body.data.message,
|
COLOR.N,body.data.message,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@@ -624,6 +627,8 @@ function NET.wsCallBack.room_enter(body)
|
|||||||
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,
|
||||||
|
group=p.group,
|
||||||
|
role=p.role,
|
||||||
playMode=p.type,
|
playMode=p.type,
|
||||||
readyMode=p.state,
|
readyMode=p.state,
|
||||||
config=p.config,
|
config=p.config,
|
||||||
@@ -634,11 +639,13 @@ function NET.wsCallBack.room_enter(body)
|
|||||||
local p=body.data
|
local p=body.data
|
||||||
NETPLY.add{
|
NETPLY.add{
|
||||||
uid=p.playerId,
|
uid=p.playerId,
|
||||||
|
group=p.group,
|
||||||
|
role=p.role,
|
||||||
playMode=p.type,
|
playMode=p.type,
|
||||||
readyMode=p.state,
|
readyMode=p.state,
|
||||||
config=p.config,
|
config=p.config,
|
||||||
}
|
}
|
||||||
NET.textBox:push{COLOR.Y,text.joinRoom:repD(USERS.getUsername(p.playerId).."#"..p.playerId)}
|
NET.textBox:push{COLOR.Y,text.joinRoom:repD(_getFullName(p.playerId))}
|
||||||
if not GAME.playing then
|
if not GAME.playing then
|
||||||
SFX.play('connected')
|
SFX.play('connected')
|
||||||
NET.freshRoomAllReady()
|
NET.freshRoomAllReady()
|
||||||
@@ -646,13 +653,13 @@ function NET.wsCallBack.room_enter(body)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.room_kick(body)
|
function NET.wsCallBack.room_kick(body)
|
||||||
MES.new('info',text.playerKicked:repD(USERS.getUsername(body.data.executorId).."#"..body.data.executorId,USERS.getUsername(body.data.playerId).."#"..body.data.playerId))
|
MES.new('info',text.playerKicked:repD(_getFullName(body.data.executorId),_getFullName(body.data.playerId)))
|
||||||
_playerLeaveRoom(body.data.playerId)
|
_playerLeaveRoom(body.data.playerId)
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.room_leave(body)
|
function NET.wsCallBack.room_leave(body)
|
||||||
local uid=body.data and body.data.playerId or USER.uid
|
local uid=body.data and body.data.playerId or USER.uid
|
||||||
if body.data then
|
if body.data then
|
||||||
NET.textBox:push{COLOR.Y,text.leaveRoom:repD(USERS.getUsername(uid).."#"..uid.." ")}
|
NET.textBox:push{COLOR.Y,text.leaveRoom:repD(_getFullName(uid))}
|
||||||
end
|
end
|
||||||
_playerLeaveRoom(uid)
|
_playerLeaveRoom(uid)
|
||||||
NET.freshRoomAllReady()
|
NET.freshRoomAllReady()
|
||||||
@@ -674,11 +681,21 @@ function NET.wsCallBack.player_updateConf(body)
|
|||||||
NETPLY.map[body.data.playerId].config=body.data.config
|
NETPLY.map[body.data.playerId].config=body.data.config
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.player_finish(body)-- TODO
|
function NET.wsCallBack.player_finish(body)
|
||||||
|
for _,P in next,PLY_ALIVE do
|
||||||
|
if P.uid==body.data.playerId then
|
||||||
|
P:lose(true)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.player_joinGroup(body)-- TODO
|
function NET.wsCallBack.player_joinGroup(body)-- TODO
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.player_setHost(body)-- TODO
|
function NET.wsCallBack.player_setHost(body)
|
||||||
|
if body.data.role=='Admin' then
|
||||||
|
MES.new('info',text.becomeHost:repD(_getFullName(body.data.playerId)))
|
||||||
|
end
|
||||||
|
NETPLY.map[body.data.playerId].role=body.data.role
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.player_setState(body)-- TODO (not used)
|
function NET.wsCallBack.player_setState(body)-- TODO (not used)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,6 +6,16 @@ local gc_stencil,gc_setStencilTest=gc.stencil,gc.setStencilTest
|
|||||||
local ins,rem=table.insert,table.remove
|
local ins,rem=table.insert,table.remove
|
||||||
local setFont=FONT.set
|
local setFont=FONT.set
|
||||||
|
|
||||||
|
local groupColor={
|
||||||
|
[0]=COLOR.Z,
|
||||||
|
[1]=COLOR.R,
|
||||||
|
[2]=COLOR.G,
|
||||||
|
[3]=COLOR.B,
|
||||||
|
[4]=COLOR.Y,
|
||||||
|
[5]=COLOR.M,
|
||||||
|
[6]=COLOR.C,
|
||||||
|
}
|
||||||
|
|
||||||
local posLists={
|
local posLists={
|
||||||
-- 1~5
|
-- 1~5
|
||||||
(function()
|
(function()
|
||||||
@@ -71,9 +81,13 @@ local nullIndex={
|
|||||||
MES.new('error',"User not loaded: "..k)
|
MES.new('error',"User not loaded: "..k)
|
||||||
NETPLY.add{
|
NETPLY.add{
|
||||||
uid=k,
|
uid=k,
|
||||||
|
group=-1,
|
||||||
|
role='Normal',-- 'Normal'|'Admin'
|
||||||
playMode='Spectator',
|
playMode='Spectator',
|
||||||
readyMode='Standby',
|
readyMode='Standby',
|
||||||
config="",
|
config="",
|
||||||
|
place=1e99,
|
||||||
|
stat=false,
|
||||||
}
|
}
|
||||||
return self[k]
|
return self[k]
|
||||||
end
|
end
|
||||||
@@ -106,10 +120,14 @@ end
|
|||||||
function NETPLY.add(d)
|
function NETPLY.add(d)
|
||||||
local p={
|
local p={
|
||||||
uid=d.uid,
|
uid=d.uid,
|
||||||
|
|
||||||
|
group=d.group,
|
||||||
|
role=d.role,-- 'Normal'|'Admin'
|
||||||
|
|
||||||
playMode=d.playMode,-- 'Gamer'|'Spectator'
|
playMode=d.playMode,-- 'Gamer'|'Spectator'
|
||||||
readyMode=d.readyMode,-- 'Standby'|'Ready'|'Playing'|'Finished'
|
readyMode=d.readyMode,-- 'Standby'|'Ready'|'Playing'|'Finished'
|
||||||
config=d.config,-- A long string generated by dumpBasicConfig()
|
|
||||||
|
|
||||||
|
config=d.config,-- A long string generated by dumpBasicConfig()
|
||||||
place=1e99,
|
place=1e99,
|
||||||
stat=false,
|
stat=false,
|
||||||
}
|
}
|
||||||
@@ -189,7 +207,7 @@ function NETPLY.draw()
|
|||||||
gc_rectangle('fill',0,0,p.w,p.h)
|
gc_rectangle('fill',0,0,p.w,p.h)
|
||||||
gc_setColor(COLOR.dH)
|
gc_setColor(COLOR.dH)
|
||||||
end
|
end
|
||||||
gc_setLineWidth(2)
|
gc_setLineWidth(p.role=='Admin' and 4 or 2)
|
||||||
gc_rectangle('line',0,0,p.w,p.h)
|
gc_rectangle('line',0,0,p.w,p.h)
|
||||||
|
|
||||||
-- Stencil
|
-- Stencil
|
||||||
@@ -202,18 +220,6 @@ function NETPLY.draw()
|
|||||||
local avatarSize=math.min(p.h,50)/128*.9
|
local avatarSize=math.min(p.h,50)/128*.9
|
||||||
gc_draw(USERS.getAvatar(p.uid),2,2,nil,avatarSize)
|
gc_draw(USERS.getAvatar(p.uid),2,2,nil,avatarSize)
|
||||||
|
|
||||||
-- UID & Username
|
|
||||||
if p.h>=47 then
|
|
||||||
setFont(40)
|
|
||||||
gc_print("#"..p.uid,50,-5)
|
|
||||||
gc_print(USERS.getUsername(p.uid),210,-5)
|
|
||||||
else
|
|
||||||
setFont(15)
|
|
||||||
gc_print("#"..p.uid,46,-1)
|
|
||||||
setFont(30)
|
|
||||||
gc_print(USERS.getUsername(p.uid),p.h,8)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Stat
|
-- Stat
|
||||||
local S=p.stat
|
local S=p.stat
|
||||||
if S and (p.h>=55 or p.w>=180) then
|
if S and (p.h>=55 or p.w>=180) then
|
||||||
@@ -228,6 +234,19 @@ function NETPLY.draw()
|
|||||||
gc_printf(S.lpm,x,19,150,'right')
|
gc_printf(S.lpm,x,19,150,'right')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- UID & Username
|
||||||
|
gc_setColor(groupColor[p.group] or COLOR.dH)
|
||||||
|
if p.h>=47 then
|
||||||
|
setFont(40)
|
||||||
|
gc_print("#"..p.uid,50,-5)
|
||||||
|
gc_print(USERS.getUsername(p.uid),210,-5)
|
||||||
|
else
|
||||||
|
setFont(15)
|
||||||
|
gc_print("#"..p.uid,46,-1)
|
||||||
|
setFont(30)
|
||||||
|
gc_print(USERS.getUsername(p.uid),p.h,8)
|
||||||
|
end
|
||||||
gc_setStencilTest()
|
gc_setStencilTest()
|
||||||
gc_translate(-p.x,-p.y)
|
gc_translate(-p.x,-p.y)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user