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