联网推进(观战功能测试)
This commit is contained in:
@@ -105,10 +105,11 @@ return{
|
|||||||
started="Playing",
|
started="Playing",
|
||||||
joinRoom="has joined the room.",
|
joinRoom="has joined the room.",
|
||||||
leaveRoom="has left the room.",
|
leaveRoom="has left the room.",
|
||||||
ready="READY",
|
ready="Ready",
|
||||||
connStream="CONNECTING",
|
connStream="Connecting",
|
||||||
waitStream="WAITING",
|
waitStream="Waiting",
|
||||||
champion="$1 won",
|
champion="$1 won",
|
||||||
|
spectating="Spectating",
|
||||||
chatRemain="Online",
|
chatRemain="Online",
|
||||||
chatStart="------Beginning of log------",
|
chatStart="------Beginning of log------",
|
||||||
chatHistory="------New messages below------",
|
chatHistory="------New messages below------",
|
||||||
@@ -266,6 +267,7 @@ return{
|
|||||||
},
|
},
|
||||||
net_game={
|
net_game={
|
||||||
ready="Ready",
|
ready="Ready",
|
||||||
|
spectate="Spectate",
|
||||||
cancel="Cancel",
|
cancel="Cancel",
|
||||||
},
|
},
|
||||||
setting_game={
|
setting_game={
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ return{
|
|||||||
-- connStream="CONNECTING",
|
-- connStream="CONNECTING",
|
||||||
-- waitStream="WAITING",
|
-- waitStream="WAITING",
|
||||||
champion="$1 a gagné",
|
champion="$1 a gagné",
|
||||||
|
-- spectating="Spectating",
|
||||||
chatRemain="En ligne : ",
|
chatRemain="En ligne : ",
|
||||||
chatStart="--------Début des logs--------",
|
chatStart="--------Début des logs--------",
|
||||||
chatHistory="-Nouveaux messages en dessous-",
|
chatHistory="-Nouveaux messages en dessous-",
|
||||||
@@ -236,6 +237,7 @@ return{
|
|||||||
},
|
},
|
||||||
net_game={
|
net_game={
|
||||||
-- ready="Ready",
|
-- ready="Ready",
|
||||||
|
-- spectate="Spectate",
|
||||||
-- cancel="Cancel",
|
-- cancel="Cancel",
|
||||||
},
|
},
|
||||||
setting_game={
|
setting_game={
|
||||||
|
|||||||
@@ -266,6 +266,7 @@ return{
|
|||||||
},
|
},
|
||||||
net_game={
|
net_game={
|
||||||
-- ready="Ready",
|
-- ready="Ready",
|
||||||
|
-- spectate="Spectate",
|
||||||
-- cancel="Cancel",
|
-- cancel="Cancel",
|
||||||
},
|
},
|
||||||
setting_game={
|
setting_game={
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ return{
|
|||||||
-- connStream="CONNECTING",
|
-- connStream="CONNECTING",
|
||||||
-- waitStream="WAITING",
|
-- waitStream="WAITING",
|
||||||
champion="$1 ganó!",
|
champion="$1 ganó!",
|
||||||
|
-- spectating="Spectating",
|
||||||
chatRemain="Usuarios en línea: ",
|
chatRemain="Usuarios en línea: ",
|
||||||
chatStart="------Comienzo del historial------",
|
chatStart="------Comienzo del historial------",
|
||||||
chatHistory="------Nuevos mensajes------",
|
chatHistory="------Nuevos mensajes------",
|
||||||
@@ -243,6 +244,7 @@ return{
|
|||||||
},
|
},
|
||||||
net_game={
|
net_game={
|
||||||
ready="Estoy Listo",
|
ready="Estoy Listo",
|
||||||
|
-- spectate="Spectate",
|
||||||
-- cancel="Cancel",
|
-- cancel="Cancel",
|
||||||
},
|
},
|
||||||
setting_game={
|
setting_game={
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ return{
|
|||||||
createRoomSuccessed="创好了",
|
createRoomSuccessed="创好了",
|
||||||
started="开了",
|
started="开了",
|
||||||
champion="神仙是 $1",
|
champion="神仙是 $1",
|
||||||
|
spectating="看戏中",
|
||||||
|
|
||||||
stat={
|
stat={
|
||||||
"开了几次:",
|
"开了几次:",
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ return{
|
|||||||
connStream="正在连接",
|
connStream="正在连接",
|
||||||
waitStream="等待其他人连接",
|
waitStream="等待其他人连接",
|
||||||
champion="$1 获胜",
|
champion="$1 获胜",
|
||||||
|
spectating="观战中",
|
||||||
chatRemain="人数:",
|
chatRemain="人数:",
|
||||||
chatStart="------消息的开头------",
|
chatStart="------消息的开头------",
|
||||||
chatHistory="------以上是历史消息------",
|
chatHistory="------以上是历史消息------",
|
||||||
@@ -266,6 +267,7 @@ return{
|
|||||||
},
|
},
|
||||||
net_game={
|
net_game={
|
||||||
ready="准备",
|
ready="准备",
|
||||||
|
spectate="观战",
|
||||||
cancel="取消",
|
cancel="取消",
|
||||||
},
|
},
|
||||||
setting_game={
|
setting_game={
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ local NET={
|
|||||||
connected=false,
|
connected=false,
|
||||||
allow_online=false,
|
allow_online=false,
|
||||||
accessToken=false,
|
accessToken=false,
|
||||||
roomList={},
|
roomList={},--Local roomlist, updated frequently
|
||||||
roomState={
|
roomState={--A copy of room structure on server
|
||||||
roomInfo={
|
roomInfo={
|
||||||
name=false,
|
name=false,
|
||||||
type=false,
|
type=false,
|
||||||
@@ -21,10 +21,13 @@ local NET={
|
|||||||
private=false,
|
private=false,
|
||||||
start=false,
|
start=false,
|
||||||
},
|
},
|
||||||
watch=false,
|
spectate=false,--If player is spectating
|
||||||
allReady=false,
|
|
||||||
waitingStream=false,
|
|
||||||
streamRoomID=false,
|
streamRoomID=false,
|
||||||
|
seed=false,
|
||||||
|
|
||||||
|
allReady=false,
|
||||||
|
connectingStream=false,
|
||||||
|
waitingStream=false,
|
||||||
|
|
||||||
UserCount="_",
|
UserCount="_",
|
||||||
PlayCount="_",
|
PlayCount="_",
|
||||||
@@ -136,7 +139,7 @@ function NET.wsconn_stream()
|
|||||||
WS.connect('stream','/stream',JSON.encode{
|
WS.connect('stream','/stream',JSON.encode{
|
||||||
uid=USER.uid,
|
uid=USER.uid,
|
||||||
accessToken=NET.accessToken,
|
accessToken=NET.accessToken,
|
||||||
rid=NET.streamRoomID,
|
srid=NET.streamRoomID,
|
||||||
})
|
})
|
||||||
TASK.new(NET.updateWS_stream)
|
TASK.new(NET.updateWS_stream)
|
||||||
end
|
end
|
||||||
@@ -266,9 +269,9 @@ end
|
|||||||
function NET.changeConfig()
|
function NET.changeConfig()
|
||||||
WS.send('play','{"action":5,"data":'..JSON.encode({config=dumpBasicConfig()})..'}')
|
WS.send('play','{"action":5,"data":'..JSON.encode({config=dumpBasicConfig()})..'}')
|
||||||
end
|
end
|
||||||
function NET.signal_ready(ready)
|
function NET.signal_joinMode(ready)
|
||||||
if NET.lock('ready',3)and not NET.roomState.start then
|
if NET.lock('ready',3)and not NET.roomState.start then
|
||||||
WS.send('play','{"action":6,"data":{"ready":'..tostring(ready)..'}}')
|
WS.send('play','{"action":6,"data":'..JSON.encode{mode=ready}..'}')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function NET.signal_die()
|
function NET.signal_die()
|
||||||
@@ -423,7 +426,7 @@ function NET.updateWS_play()
|
|||||||
uid=p.uid,
|
uid=p.uid,
|
||||||
username=p.username,
|
username=p.username,
|
||||||
sid=p.sid,
|
sid=p.sid,
|
||||||
ready=p.ready,
|
mode=p.mode,
|
||||||
config=p.config,
|
config=p.config,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@@ -434,15 +437,27 @@ function NET.updateWS_play()
|
|||||||
NET.roomState.capacity=d.capacity
|
NET.roomState.capacity=d.capacity
|
||||||
NET.roomState.private=d.private
|
NET.roomState.private=d.private
|
||||||
NET.roomState.start=d.start
|
NET.roomState.start=d.start
|
||||||
NET.srid=d.srid
|
|
||||||
|
NET.allReady=false
|
||||||
|
NET.connectingStream=false
|
||||||
|
NET.waitingStream=false
|
||||||
|
|
||||||
|
NET.spectate=false
|
||||||
|
NET.streamRoomID=false
|
||||||
|
|
||||||
loadGame('netBattle',true,true)
|
loadGame('netBattle',true,true)
|
||||||
|
if d.srid then
|
||||||
|
NET.spectate=true
|
||||||
|
NET.streamRoomID=d.srid
|
||||||
|
NET.connectingStream=true
|
||||||
|
end
|
||||||
else
|
else
|
||||||
--Load other players
|
--Load other players
|
||||||
netPLY.add{
|
netPLY.add{
|
||||||
uid=d.uid,
|
uid=d.uid,
|
||||||
username=d.username,
|
username=d.username,
|
||||||
sid=d.sid,
|
sid=d.sid,
|
||||||
ready=d.ready,
|
mode=d.mode,
|
||||||
config=d.config,
|
config=d.config,
|
||||||
}
|
}
|
||||||
if SCN.socketRead then SCN.socketRead('join',d)end
|
if SCN.socketRead then SCN.socketRead('join',d)end
|
||||||
@@ -464,13 +479,13 @@ function NET.updateWS_play()
|
|||||||
if SCN.socketRead then SCN.socketRead('talk',d)end
|
if SCN.socketRead then SCN.socketRead('talk',d)end
|
||||||
elseif res.action==5 then--Player change settings
|
elseif res.action==5 then--Player change settings
|
||||||
netPLY.setConf(d.uid,d.config)
|
netPLY.setConf(d.uid,d.config)
|
||||||
elseif res.action==6 then--One ready
|
elseif res.action==6 then--Player change join mode
|
||||||
netPLY.setReady(d.uid,d.ready)
|
netPLY.setJoinMode(d.uid,d.mode)
|
||||||
elseif res.action==7 then--All Ready
|
elseif res.action==7 then--All Ready
|
||||||
SFX.play('reach',.6)
|
SFX.play('reach',.6)
|
||||||
NET.allReady=true
|
NET.allReady=true
|
||||||
elseif res.action==8 then--Set
|
elseif res.action==8 then--Set
|
||||||
NET.streamRoomID=d.rid
|
NET.streamRoomID=d.srid
|
||||||
NET.allReady=false
|
NET.allReady=false
|
||||||
NET.connectingStream=true
|
NET.connectingStream=true
|
||||||
NET.wsconn_stream()
|
NET.wsconn_stream()
|
||||||
@@ -507,25 +522,34 @@ function NET.updateWS_stream()
|
|||||||
if res.type=='Connect'then
|
if res.type=='Connect'then
|
||||||
NET.unlock('wsc_stream')
|
NET.unlock('wsc_stream')
|
||||||
NET.connectingStream=false
|
NET.connectingStream=false
|
||||||
NET.waitingStream=true
|
|
||||||
elseif res.action==0 then--Game start
|
elseif res.action==0 then--Game start
|
||||||
NET.waitingStream=false
|
NET.waitingStream=false
|
||||||
NET.roomState.start=true
|
SCN.socketRead('go')
|
||||||
if SCN.socketRead then SCN.socketRead('go',d)end
|
|
||||||
elseif res.action==1 then--Game finished
|
elseif res.action==1 then--Game finished
|
||||||
--?
|
--?
|
||||||
elseif res.action==2 then--Player join
|
elseif res.action==2 then--Player join
|
||||||
if res.type=='Self'then
|
if res.type=='Self'then
|
||||||
|
NET.seed=d.seed
|
||||||
|
NET.spectate=d.spectate
|
||||||
|
netPLY.setConnect(d.uid)
|
||||||
for _,p in next,d.connected do
|
for _,p in next,d.connected do
|
||||||
if not p.watch then
|
if not p.spectate then
|
||||||
netPLY.setConnect(p.uid)
|
netPLY.setConnect(p.uid)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
netPLY.setConnect(d.uid)
|
if d.spectate then
|
||||||
NET.spectate=d.watch==true
|
if d.start then
|
||||||
|
SCN.socketRead('go')
|
||||||
|
for _,v in next,d.history or{}do
|
||||||
|
SCN.socketRead('stream',v)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
NET.waitingStream=true
|
||||||
|
end
|
||||||
else
|
else
|
||||||
if d.watch then
|
if d.spectate then
|
||||||
netPLY.setWatch(d.uid)
|
netPLY.setJoinMode(d.uid,2)
|
||||||
else
|
else
|
||||||
netPLY.setConnect(d.uid)
|
netPLY.setConnect(d.uid)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ end
|
|||||||
|
|
||||||
function netPLY.clear()for _=1,netPLY.getCount()do rem(PLY)end end
|
function netPLY.clear()for _=1,netPLY.getCount()do rem(PLY)end end
|
||||||
function netPLY.add(p)
|
function netPLY.add(p)
|
||||||
p.watch=false
|
p.mode=0
|
||||||
p.connected=false
|
p.connected=false
|
||||||
ins(PLY,p.uid==USER.uid and 1 or #PLY+1,p)
|
ins(PLY,p.uid==USER.uid and 1 or #PLY+1,p)
|
||||||
local a=rnd()*6.2832
|
local a=rnd()*6.2832
|
||||||
@@ -101,21 +101,22 @@ end
|
|||||||
function netPLY.getCount()return #PLY end
|
function netPLY.getCount()return #PLY end
|
||||||
function netPLY.rawgetPLY(i)return PLY[i]end
|
function netPLY.rawgetPLY(i)return PLY[i]end
|
||||||
function netPLY.getSID(uid)return getPLY(uid).sid end
|
function netPLY.getSID(uid)return getPLY(uid).sid end
|
||||||
function netPLY.getSelfReady()return PLY[1].ready end
|
function netPLY.getSelfJoinMode()return PLY[1].mode end
|
||||||
|
function netPLY.getSelfReady()return PLY[1].mode>0 end
|
||||||
function netPLY.setPlayerObj(ply,p)ply.p=p end
|
function netPLY.setPlayerObj(ply,p)ply.p=p end
|
||||||
function netPLY.setConf(uid,config)getPLY(uid).config=config end
|
function netPLY.setConf(uid,config)getPLY(uid).config=config end
|
||||||
function netPLY.setReady(uid,ready)
|
function netPLY.setJoinMode(uid,ready)
|
||||||
for i,p in next,PLY do
|
for i,p in next,PLY do
|
||||||
if p.uid==uid then
|
if p.uid==uid then
|
||||||
if p.ready~=ready then
|
if p.mode~=ready then
|
||||||
p.ready=ready
|
p.mode=ready
|
||||||
if not ready then NET.allReady=false end
|
if ready==0 then NET.allReady=false end
|
||||||
SFX.play('spin_0',.6)
|
SFX.play('spin_0',.6)
|
||||||
if i==1 then
|
if i==1 then
|
||||||
NET.unlock('ready')
|
NET.unlock('ready')
|
||||||
elseif not PLY[1].ready then
|
elseif PLY[1].mode==0 then
|
||||||
for j=2,#PLY do
|
for j=2,#PLY do
|
||||||
if not PLY[j].ready then
|
if PLY[j].mode==0 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -127,11 +128,9 @@ function netPLY.setReady(uid,ready)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
function netPLY.setConnect(uid)getPLY(uid).connected=true end
|
function netPLY.setConnect(uid)getPLY(uid).connected=true end
|
||||||
function netPLY.setWatch(uid)getPLY(uid).watch=true end
|
|
||||||
function netPLY.resetState()
|
function netPLY.resetState()
|
||||||
for i=1,#PLY do
|
for i=1,#PLY do
|
||||||
PLY[i].ready=false
|
PLY[i].mode=0
|
||||||
PLY[i].watch=false
|
|
||||||
PLY[i].connected=false
|
PLY[i].connected=false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -169,7 +168,11 @@ function netPLY.draw()
|
|||||||
local p=PLY[i]
|
local p=PLY[i]
|
||||||
gc.translate(p.x,p.y)
|
gc.translate(p.x,p.y)
|
||||||
--Rectangle
|
--Rectangle
|
||||||
gc.setColor(COLOR[p.watch and"L"or p.connected and"N"or p.ready and'G'or'Z'])
|
gc.setColor(COLOR[
|
||||||
|
p.mode==0 and'Z'or
|
||||||
|
p.mode==1 and(p.connected and"N"or"G")or
|
||||||
|
p.mode==2 and(p.connected and"Y"or"F")
|
||||||
|
])
|
||||||
gc.setLineWidth(2)
|
gc.setLineWidth(2)
|
||||||
gc.rectangle('line',0,0,p.w,p.h)
|
gc.rectangle('line',0,0,p.w,p.h)
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ local scene={}
|
|||||||
function scene.sceneInit(org)
|
function scene.sceneInit(org)
|
||||||
BG.set()
|
BG.set()
|
||||||
destroyPlayers()
|
destroyPlayers()
|
||||||
mapCam.zoomK=org=="main"and 5 or 1
|
mapCam.zoomK=org=='main'and 5 or 1
|
||||||
end
|
end
|
||||||
|
|
||||||
local function getK()
|
local function getK()
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
local gc,tc=love.graphics,love.touch
|
local gc,tc=love.graphics,love.touch
|
||||||
|
|
||||||
|
local gc_setColor,gc_print=gc.setColor,gc.print
|
||||||
|
local setFont,mStr=setFont,mStr
|
||||||
|
|
||||||
local ins=table.insert
|
local ins=table.insert
|
||||||
|
|
||||||
local SCR,VK,NET,netPLY=SCR,VK,NET,netPLY
|
local SCR,VK,NET,netPLY=SCR,VK,NET,netPLY
|
||||||
@@ -15,9 +18,9 @@ local lastBackTime=0
|
|||||||
local noTouch,noKey=false,false
|
local noTouch,noKey=false,false
|
||||||
local touchMoveLastFrame=false
|
local touchMoveLastFrame=false
|
||||||
|
|
||||||
local function _switchReady()
|
local function _setReady()NET.signal_joinMode(1)end
|
||||||
NET.signal_ready(not netPLY.getSelfReady())
|
local function _setSpectate()NET.signal_joinMode(2)end
|
||||||
end
|
local function _setCancel()NET.signal_joinMode(0)end
|
||||||
local function _gotoSetting()
|
local function _gotoSetting()
|
||||||
if not(netPLY.getSelfReady()or NET.getlock('ready'))then
|
if not(netPLY.getSelfReady()or NET.getlock('ready'))then
|
||||||
SCN.go('setting_game')
|
SCN.go('setting_game')
|
||||||
@@ -36,8 +39,10 @@ function scene.sceneInit(org)
|
|||||||
lastUpstreamTime=0
|
lastUpstreamTime=0
|
||||||
upstreamProgress=1
|
upstreamProgress=1
|
||||||
|
|
||||||
if org=="setting_game"then
|
if org=='setting_game'then NET.changeConfig()end
|
||||||
NET.changeConfig()
|
if NET.streamRoomID then
|
||||||
|
NET.wsconn_stream()
|
||||||
|
NET.streamRoomID=false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function scene.sceneBack()
|
function scene.sceneBack()
|
||||||
@@ -123,7 +128,15 @@ function scene.keyDown(key)
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
if key=="space"then
|
if key=="space"then
|
||||||
_switchReady()
|
if netPLY.getSelfJoinMode()==0 then
|
||||||
|
_setReady()
|
||||||
|
else
|
||||||
|
_setCancel()
|
||||||
|
end
|
||||||
|
elseif key=="p"then
|
||||||
|
if netPLY.getSelfJoinMode()==0 then
|
||||||
|
_setSpectate()
|
||||||
|
end
|
||||||
elseif key=="s"then
|
elseif key=="s"then
|
||||||
_gotoSetting()
|
_gotoSetting()
|
||||||
end
|
end
|
||||||
@@ -184,7 +197,7 @@ function scene.socketRead(cmd,d)
|
|||||||
love.keyboard.setKeyRepeat(false)
|
love.keyboard.setKeyRepeat(false)
|
||||||
lastUpstreamTime=0
|
lastUpstreamTime=0
|
||||||
upstreamProgress=1
|
upstreamProgress=1
|
||||||
resetGameData('n',d.seed)
|
resetGameData('n',NET.seed)
|
||||||
netPLY.mouseMove(0,0)
|
netPLY.mouseMove(0,0)
|
||||||
else
|
else
|
||||||
LOG.print("Redundant [Go]",'warn')
|
LOG.print("Redundant [Go]",'warn')
|
||||||
@@ -204,7 +217,7 @@ function scene.socketRead(cmd,d)
|
|||||||
end
|
end
|
||||||
netPLY.resetState()
|
netPLY.resetState()
|
||||||
elseif cmd=='stream'then
|
elseif cmd=='stream'then
|
||||||
if d.uid~=USER.uid and playing then
|
if d.uid~=USER.uid then
|
||||||
for _,P in next,PLAYERS do
|
for _,P in next,PLAYERS do
|
||||||
if P.uid==d.uid then
|
if P.uid==d.uid then
|
||||||
local res,stream=pcall(love.data.decode,'string','base64',d.stream)
|
local res,stream=pcall(love.data.decode,'string','base64',d.stream)
|
||||||
@@ -213,9 +226,11 @@ function scene.socketRead(cmd,d)
|
|||||||
else
|
else
|
||||||
LOG.print("Bad stream from "..P.username.."#"..P.uid,30)
|
LOG.print("Bad stream from "..P.username.."#"..P.uid,30)
|
||||||
end
|
end
|
||||||
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -271,6 +286,12 @@ function scene.draw()
|
|||||||
|
|
||||||
--Warning
|
--Warning
|
||||||
drawWarning()
|
drawWarning()
|
||||||
|
|
||||||
|
if NET.spectate then
|
||||||
|
setFont(30)
|
||||||
|
gc_setColor(.2,1,0,.8)
|
||||||
|
gc_print(text.spectating,940,0)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
--Users
|
--Users
|
||||||
netPLY.draw()
|
netPLY.draw()
|
||||||
@@ -278,24 +299,24 @@ function scene.draw()
|
|||||||
--Ready & Set mark
|
--Ready & Set mark
|
||||||
setFont(50)
|
setFont(50)
|
||||||
if NET.allReady then
|
if NET.allReady then
|
||||||
gc.setColor(0,1,.5,.9)
|
gc_setColor(0,1,.5,.9)
|
||||||
mStr(text.ready,640,15)
|
mStr(text.ready,640,15)
|
||||||
elseif NET.connectingStream then
|
elseif NET.connectingStream then
|
||||||
gc.setColor(.1,1,.8,.9)
|
gc_setColor(.1,1,.8,.9)
|
||||||
mStr(text.connStream,640,15)
|
mStr(text.connStream,640,15)
|
||||||
elseif NET.waitingStream then
|
elseif NET.waitingStream then
|
||||||
gc.setColor(0,.8,1,.9)
|
gc_setColor(0,.8,1,.9)
|
||||||
mStr(text.waitStream,640,15)
|
mStr(text.waitStream,640,15)
|
||||||
end
|
end
|
||||||
|
|
||||||
--Room info.
|
--Room info.
|
||||||
gc.setColor(1,1,1)
|
gc_setColor(1,1,1)
|
||||||
setFont(25)
|
setFont(25)
|
||||||
gc.printf(NET.roomState.roomInfo.name,0,685,1270,'right')
|
gc.printf(NET.roomState.roomInfo.name,0,685,1270,'right')
|
||||||
setFont(40)
|
setFont(40)
|
||||||
gc.print(netPLY.getCount().."/"..NET.roomState.capacity,70,655)
|
gc.print(netPLY.getCount().."/"..NET.roomState.capacity,70,655)
|
||||||
if NET.roomState.private then gc.draw(IMG.lock,30,668)end
|
if NET.roomState.private then gc.draw(IMG.lock,30,668)end
|
||||||
if NET.roomState.start then gc.setColor(0,1,0)gc.print(text.started,230,655)end
|
if NET.roomState.start then gc_setColor(0,1,0)gc_print(text.started,230,655)end
|
||||||
|
|
||||||
--Profile
|
--Profile
|
||||||
drawSelfProfile()
|
drawSelfProfile()
|
||||||
@@ -307,7 +328,7 @@ function scene.draw()
|
|||||||
--New message
|
--New message
|
||||||
if textBox.new then
|
if textBox.new then
|
||||||
setFont(40)
|
setFont(40)
|
||||||
gc.setColor(1,1,0)
|
gc_setColor(1,1,0)
|
||||||
gc.print("M",430,10)
|
gc.print("M",430,10)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -315,20 +336,28 @@ scene.widgetList={
|
|||||||
textBox,
|
textBox,
|
||||||
inputBox,
|
inputBox,
|
||||||
WIDGET.newKey{name="setting",fText=TEXTURE.setting,x=1200,y=160,w=90,h=90,code=_gotoSetting,hideF=function()return playing or netPLY.getSelfReady()or NET.getlock('ready')end},
|
WIDGET.newKey{name="setting",fText=TEXTURE.setting,x=1200,y=160,w=90,h=90,code=_gotoSetting,hideF=function()return playing or netPLY.getSelfReady()or NET.getlock('ready')end},
|
||||||
WIDGET.newKey{name="ready",x=1060,y=630,w=300,h=80,color='lB',font=40,code=_switchReady,
|
WIDGET.newKey{name="ready",x=950,y=630,w=190,h=80,color='lG',font=35,code=_setReady,
|
||||||
hideF=function()
|
hideF=function()
|
||||||
return
|
return
|
||||||
playing or
|
playing or
|
||||||
NET.roomState.start or
|
NET.roomState.start or
|
||||||
netPLY.getSelfReady()or
|
netPLY.getSelfReady() or
|
||||||
NET.getlock('ready')
|
NET.getlock('ready')
|
||||||
end},
|
end},
|
||||||
WIDGET.newKey{name="cancel",x=1060,y=630,w=300,h=80,color='H',font=40,code=_switchReady,
|
WIDGET.newKey{name="spectate",x=1150,y=630,w=190,h=80,color='lO',font=35,code=_setSpectate,
|
||||||
hideF=function()
|
hideF=function()
|
||||||
return
|
return
|
||||||
playing or
|
playing or
|
||||||
NET.roomState.start or
|
NET.roomState.start or
|
||||||
not netPLY.getSelfReady()or
|
netPLY.getSelfReady() or
|
||||||
|
NET.getlock('ready')
|
||||||
|
end},
|
||||||
|
WIDGET.newKey{name="cancel",x=1050,y=630,w=390,h=80,color='lH',font=40,code=_setCancel,
|
||||||
|
hideF=function()
|
||||||
|
return
|
||||||
|
playing or
|
||||||
|
NET.roomState.start or
|
||||||
|
not netPLY.getSelfReady() or
|
||||||
NET.getlock('ready')
|
NET.getlock('ready')
|
||||||
end},
|
end},
|
||||||
WIDGET.newKey{name="hideChat",fText="...",x=380,y=35,w=60,font=35,code=pressKey"return"},
|
WIDGET.newKey{name="hideChat",fText="...",x=380,y=35,w=60,font=35,code=pressKey"return"},
|
||||||
|
|||||||
@@ -29,10 +29,6 @@ local scene={}
|
|||||||
|
|
||||||
function scene.sceneInit()
|
function scene.sceneInit()
|
||||||
BG.set()
|
BG.set()
|
||||||
NET.spectate=false
|
|
||||||
NET.allReady=false
|
|
||||||
NET.connectingStream=false
|
|
||||||
NET.waitingStream=false
|
|
||||||
scrollPos=0
|
scrollPos=0
|
||||||
selected=1
|
selected=1
|
||||||
fetchRoom()
|
fetchRoom()
|
||||||
@@ -113,7 +109,6 @@ function scene.mouseClick(x,y)
|
|||||||
if NET.roomList[s]then
|
if NET.roomList[s]then
|
||||||
if selected~=s then
|
if selected~=s then
|
||||||
selected=s
|
selected=s
|
||||||
print(1)
|
|
||||||
SFX.play('click',.4)
|
SFX.play('click',.4)
|
||||||
else
|
else
|
||||||
scene.keyDown("return")
|
scene.keyDown("return")
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ function scene.sceneInit(org)
|
|||||||
local P=PLAYERS[1]
|
local P=PLAYERS[1]
|
||||||
local S=P.stat
|
local S=P.stat
|
||||||
|
|
||||||
timer=org=="game"and 0 or 50
|
timer=org=='game'and 0 or 50
|
||||||
|
|
||||||
local frameLostRate=(S.frame/S.time/60-1)*100
|
local frameLostRate=(S.frame/S.time/60-1)*100
|
||||||
form={
|
form={
|
||||||
|
|||||||
Reference in New Issue
Block a user