实现玩家设置同步到服务器
实现玩家离开房间(各种途径) 修改云存读档代码(还未实现) 移除sid,准备之后用uid本地排序序号代替(排序还未实现) 整理代码,框架跟进
This commit is contained in:
@@ -77,9 +77,6 @@ function scene.sceneInit()
|
||||
BG.set(GAME.prevBG)
|
||||
GAME.prevBG=false
|
||||
end
|
||||
if NET.specSRID then
|
||||
NET.specSRID=false
|
||||
end
|
||||
end
|
||||
function scene.sceneBack()
|
||||
GAME.playing=false
|
||||
@@ -195,7 +192,7 @@ function scene.gamepadUp(key)
|
||||
end
|
||||
end
|
||||
|
||||
function scene.socketRead(cmd,d)
|
||||
function scene._(cmd,d)
|
||||
if cmd=='join' then
|
||||
textBox:push{
|
||||
COLOR.lR,d.username,
|
||||
@@ -209,12 +206,6 @@ function scene.socketRead(cmd,d)
|
||||
COLOR.dY,"#"..d.uid.." ",
|
||||
COLOR.Y,text.leaveRoom,
|
||||
}
|
||||
elseif cmd=='talk' then
|
||||
textBox:push{
|
||||
COLOR.Z,d.username,
|
||||
COLOR.dY,"#"..d.uid.." ",
|
||||
COLOR.N,d.message or "[_]",
|
||||
}
|
||||
elseif cmd=='go' then
|
||||
if not playing then
|
||||
playing=true
|
||||
@@ -222,8 +213,6 @@ function scene.socketRead(cmd,d)
|
||||
upstreamProgress=1
|
||||
resetGameData('n',NET.seed)
|
||||
NETPLY.mouseMove(0,0)
|
||||
else
|
||||
MES.new('warn',"Redundant [Go]")
|
||||
end
|
||||
elseif cmd=='finish' then
|
||||
playing=false
|
||||
@@ -315,7 +304,8 @@ function scene.draw()
|
||||
gc_draw(IMG.lock,30,668)
|
||||
end
|
||||
if NET.roomState.start then
|
||||
gc_setColor(0,1,0)gc_print(text.started,230,655)
|
||||
gc_setColor(0,1,0)
|
||||
gc_print(text.started,230,655)
|
||||
end
|
||||
|
||||
-- Profile
|
||||
|
||||
@@ -20,10 +20,12 @@ scene.widgetList={
|
||||
WIDGET.newButton{name='logout',x=880, y=40,w=180, h=60,color='dR',
|
||||
code=function()
|
||||
if tryBack() then
|
||||
USER.__data.uid=false
|
||||
USER.__data.email=false
|
||||
USER.__data.password=false
|
||||
USER.__data.rToken=false
|
||||
USER.__data.aToken=false
|
||||
love.filesystem.remove('conf/user')
|
||||
NET.ws_close()
|
||||
SCN.back()
|
||||
end
|
||||
|
||||
@@ -88,7 +88,7 @@ scene.widgetList={
|
||||
-- Capacity & Create & Back
|
||||
WIDGET.newSelector{name='capacity', x=1070,y=330,w=310,color='lY',list={2,3,4,5,7,10,17,31,49,99},disp=ROOMval('capacity'),code=ROOMsto('capacity')},
|
||||
WIDGET.newButton{name='create', x=1070,y=480,w=310,h=140,color='lN',font=40,code=_createRoom},
|
||||
WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene},
|
||||
WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=swapScene'net_rooms'},
|
||||
|
||||
-- Special rules
|
||||
WIDGET.newSwitch{name='ospin', x=850, y=850, lim=210,disp=ROOMval('ospin'), code=ROOMrev('ospin')},
|
||||
|
||||
@@ -147,7 +147,7 @@ scene.widgetList={
|
||||
WIDGET.newText{name='refreshing',x=450,y=240,font=45,hideF=function() return not TASK.getLock('fetchRoom') end},
|
||||
WIDGET.newText{name='noRoom', x=450,y=245,font=40,hideF=function() return roomList:getLen()>0 or TASK.getLock('fetchRoom') end},
|
||||
WIDGET.newKey{name='refresh', x=250,y=630,w=140,h=120,code=_fetchRoom,hideF=function() return fetchTimer>7 end},
|
||||
WIDGET.newKey{name='new', x=510,y=630,w=260,h=120,code=goScene'net_newRoom'},
|
||||
WIDGET.newKey{name='new', x=510,y=630,w=260,h=120,code=swapScene'net_newRoom'},
|
||||
WIDGET.newKey{name='join', x=780,y=630,w=140,h=120,code=pressKey'join',hideF=function() return roomList:getLen()==0 or TASK.getLock('enterRoom') end},
|
||||
WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=pressKey'escape'},
|
||||
}
|
||||
|
||||
@@ -123,8 +123,8 @@ end
|
||||
function scene.keyDown(key,isRep)
|
||||
if isRep then return true end
|
||||
if key=='q' then
|
||||
SCN.back()
|
||||
GAME.playing=false
|
||||
SCN.back()
|
||||
elseif key=='escape' then
|
||||
SCN.swapTo(GAME.result and 'game' or 'depause','none')
|
||||
elseif key=='s' then
|
||||
|
||||
Reference in New Issue
Block a user