实现玩家准备状态相关
This commit is contained in:
@@ -617,7 +617,7 @@ function NET.wsCallBack.player_setPlayMode(body)
|
||||
NETPLY.setPlayMode(body.data.playerId,body.data.type)
|
||||
end
|
||||
function NET.wsCallBack.player_setReadyMode(body)
|
||||
NETPLY.setReadyMode(body.data.playerId,body.data.type)
|
||||
NETPLY.setReadyMode(body.data.playerId,body.data.isReady and 'Ready' or 'Standby')
|
||||
end
|
||||
function NET.wsCallBack.match_finish()
|
||||
TASK.new(function()
|
||||
|
||||
@@ -133,8 +133,7 @@ end
|
||||
|
||||
function NETPLY.getCount() return #PLYlist end
|
||||
function NETPLY.getSelfPlayMode() return PLYmap[USER.uid].playMode end
|
||||
function NETPLY.getSelfReadyMode() return PLYmap[USER.uid].playMode end
|
||||
function NETPLY.getSelfReady() return PLYmap[USER.uid].readyMode end
|
||||
function NETPLY.getSelfReadyMode() return PLYmap[USER.uid].readyMode end
|
||||
|
||||
function NETPLY.setPlayerObj(ply,p) ply.p=p end
|
||||
function NETPLY.setConf(uid,config) PLYmap[uid].config=config end
|
||||
@@ -147,8 +146,8 @@ function NETPLY.setPlayMode(uid,mode)
|
||||
end
|
||||
function NETPLY.setReadyMode(uid,mode)
|
||||
local p=PLYmap[uid]
|
||||
if p and p.ReadyMode~=mode then
|
||||
p.ReadyMode=mode
|
||||
if p and p.readyMode~=mode then
|
||||
p.readyMode=mode
|
||||
NET.freshRoomState()
|
||||
end
|
||||
end
|
||||
@@ -201,15 +200,11 @@ function NETPLY.draw()
|
||||
gc_translate(p.x,p.y)
|
||||
-- Rectangle
|
||||
if p.playMode=='Gamer' then
|
||||
gc_setColor(COLOR[
|
||||
p.playMode=='Spectator' and 'lH' or
|
||||
p.playMode=='Gamer' and (
|
||||
p.readyMode=='Standby' and 'Z' or
|
||||
'N'
|
||||
) or 'dH'
|
||||
])
|
||||
gc_setColor(p.readyMode=='Standby' and COLOR.Z or COLOR.N)
|
||||
else
|
||||
gc_setColor(COLOR.lH)
|
||||
gc_setColor(COLOR.dX)
|
||||
gc_rectangle('fill',0,0,p.w,p.h)
|
||||
gc_setColor(COLOR.dH)
|
||||
end
|
||||
gc_setLineWidth(2)
|
||||
gc_rectangle('line',0,0,p.w,p.h)
|
||||
|
||||
@@ -27,8 +27,11 @@ local function _hideReadyUI()
|
||||
end
|
||||
|
||||
local function _setCancel()
|
||||
NET.player_setPlayMode('Gamer')
|
||||
NET.player_setReadyMode(false)
|
||||
if NETPLY.getSelfPlayMode()=='Gamer' then
|
||||
NET.player_setReadyMode(false)
|
||||
else
|
||||
NET.player_setPlayMode('Gamer')
|
||||
end
|
||||
end
|
||||
local function _setReady()
|
||||
NET.player_setPlayMode('Gamer')
|
||||
@@ -311,15 +314,15 @@ function scene.draw()
|
||||
gc_print("M",430,10)
|
||||
end
|
||||
end
|
||||
local function _hideF_ingame() return _hideReadyUI() or NETPLY.getSelfReadyMode()=='Spectator' end
|
||||
local function _hideF_ingame2() return _hideReadyUI() or NETPLY.getSelfReadyMode()=='Gamer' end
|
||||
local function _hideF_ready() return _hideReadyUI() or (NETPLY.getSelfPlayMode()=='Spectator' or NETPLY.getSelfReadyMode()=='Ready') end
|
||||
local function _hideF_standby() return _hideReadyUI() or not (NETPLY.getSelfPlayMode()=='Spectator' or NETPLY.getSelfReadyMode()=='Ready') end
|
||||
scene.widgetList={
|
||||
textBox,
|
||||
inputBox,
|
||||
WIDGET.newKey{name='setting', x=1200,y=160,w=90,h=90,font=60,fText=CHAR.icon.settings,code=_gotoSetting,hideF=_hideF_ingame},
|
||||
WIDGET.newKey{name='ready', x=1060,y=510,w=360,h=90,color='lG',font=35, code=_setReady,hideF=_hideF_ingame},
|
||||
WIDGET.newKey{name='spectate',x=1060,y=610,w=360,h=90,color='lO',font=35, code=_setSpectate,hideF=_hideF_ingame},
|
||||
WIDGET.newKey{name='cancel', x=1060,y=560,w=360,h=120,color='lH',font=40,code=_setCancel,hideF=_hideF_ingame2},
|
||||
WIDGET.newKey{name='setting', x=1200,y=160,w=90,h=90,font=60,fText=CHAR.icon.settings,code=_gotoSetting,hideF=_hideF_ready},
|
||||
WIDGET.newKey{name='ready', x=1060,y=510,w=360,h=90,color='lG',font=35, code=_setReady,hideF=_hideF_ready},
|
||||
WIDGET.newKey{name='spectate',x=1060,y=610,w=360,h=90,color='lO',font=35, code=_setSpectate,hideF=_hideF_ready},
|
||||
WIDGET.newKey{name='cancel', x=1060,y=560,w=360,h=120,color='lH',font=40,code=_setCancel,hideF=_hideF_standby},
|
||||
WIDGET.newKey{name='chat', x=390,y=45,w=60,fText="···", code=_switchChat},
|
||||
WIDGET.newKey{name='quit', x=890,y=45,w=60,font=30,fText=CHAR.icon.cross_thick,code=_quit},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user