继续整联网,数字action填入一个大表方便统一管理

This commit is contained in:
MrZ_26
2022-10-06 22:30:35 +08:00
parent 8e99565a9d
commit 37b76a1cb4
9 changed files with 194 additions and 128 deletions

View File

@@ -9,7 +9,7 @@ function scene.sceneInit()
sysAndScn=SYSTEM.."-"..VERSION.string.." scene:"..Z.getErr('#').scene
errorText=LOADED and text.errorMsg or "An error has occurred while the game was loading.\nAn error log has been created so you can send it to the author."
errorShot,errorInfo=Z.getErr('#').shot,Z.getErr('#').mes
NET.ws.close()
NET.ws_close()
if SETTING then
SFX.fplay('error',SETTING.voc*.8 or 0)
end

View File

@@ -28,14 +28,14 @@ local function _hideReadyUI()
end
local function _setCancel()
NET.player.setPlaying(true)
NET.player.setReady(true)
NET.player_setPlaying(true)
NET.player_setReady(true)
end
local function _setReady()
NET.player.setReady(true)
NET.player_setReady(true)
end
local function _setSpectate()
NET.player.setPlaying(false)
NET.player_setPlaying(false)
end
local function _gotoSetting()
@@ -44,7 +44,7 @@ local function _gotoSetting()
end
local function _quit()
if tryBack() then
NET.room.leave()
NET.room_leave()
if SCN.stack[#SCN.stack-1]=='net_newRoom' then
SCN.pop()
end
@@ -77,7 +77,7 @@ function scene.sceneInit()
newMessageTimer=0
if SCN.prev=='setting_game' then
NET.player.updateConf()
NET.player_updateConf()
end
if GAME.prevBG then
BG.set(GAME.prevBG)
@@ -144,8 +144,9 @@ function scene.keyDown(key,isRep)
elseif key=='return' then
local mes=STRING.trim(inputBox:getText())
if not inputBox.hide and #mes>0 then
NET.room.chat(mes)
inputBox:clear()
if NET.room.chat(mes) then
inputBox:clear()
end
else
_switchChat()
end
@@ -239,7 +240,7 @@ end
function scene.update(dt)
if WS.status('game')~='running' then
NET.ws.close()
NET.ws_close()
SCN.back()
return
end
@@ -268,7 +269,7 @@ function scene.update(dt)
elseif #stream%3==2 then
stream=stream.."\0\0\0\0"
end
NET.player.stream(stream)
NET.player_stream(stream)
lastUpstreamTime=PLAYERS[1].alive and P1.frameRun or 1e99
end
else

View File

@@ -4,7 +4,7 @@ function scene.sceneInit()
BG.set()
end
function scene.sceneBack()
NET.ws.close()
NET.ws_close()
end
function scene.draw()
@@ -24,7 +24,7 @@ scene.widgetList={
USER.__data.password=false
USER.__data.rToken=false
USER.__data.aToken=false
NET.ws.close()
NET.ws_close()
SCN.back()
end
end},

View File

@@ -36,7 +36,7 @@ local function _createRoom()
if #roomname==0 then
roomname=(USERS.getUsername(USER.uid) or "Anonymous").."'s room"
end
NET.room.create(
NET.room_create(
roomname,
descriptionBox.value,
ROOMENV.capacity,

View File

@@ -67,7 +67,7 @@ local passwordBox=WIDGET.newInputBox{name='password',x=350,y=505,w=500,h=50,secr
}]]
local function _fetchRoom()
fetchTimer=10
NET.room.fetch()
NET.room_fetch()
end
local scene={}
@@ -84,11 +84,12 @@ function scene.keyDown(key)
end
elseif roomList:getLen()>0 and (key=='join' or key=='return' and love.keyboard.isDown('lctrl','rctrl')) then
local R=roomList:getSel()
if TASK.getLock('fetchRoom') or not R then return end
if R.info.version==VERSION.room then
NET.room.enter(R.roomId,passwordBox.value)
else
MES.new('error',text.versionNotMatch)
if R and not TASK.getLock('fetchRoom') then
if R.info.version==VERSION.room then
NET.room.enter(R.roomId,passwordBox.value)
else
MES.new('error',text.versionNotMatch)
end
end
else
return true