【不能用】继续改联网,实现并替换一些发送ws请求的方法
框架跟进
This commit is contained in:
@@ -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.wsclose()
|
||||
NET.closeWS()
|
||||
if SETTING then
|
||||
SFX.fplay('error',SETTING.voc*.8 or 0)
|
||||
end
|
||||
|
||||
@@ -27,16 +27,24 @@ local function _hideReadyUI()
|
||||
TASK.getLock('ready')
|
||||
end
|
||||
|
||||
local function _setCancel()NET.signal_setMode(0)end
|
||||
local function _setReady()NET.signal_setMode(1)end
|
||||
local function _setSpectate()NET.signal_setMode(2)end
|
||||
local function _setCancel()
|
||||
NET.player.setPlaying(true)
|
||||
NET.player.setReady(true)
|
||||
end
|
||||
local function _setReady()
|
||||
NET.player.setReady(true)
|
||||
end
|
||||
local function _setSpectate()
|
||||
NET.player.setPlaying(false)
|
||||
end
|
||||
|
||||
local function _gotoSetting()
|
||||
GAME.prevBG=BG.cur
|
||||
SCN.go('setting_game')
|
||||
end
|
||||
local function _quit()
|
||||
if tryBack()then
|
||||
NET.signal_quit()
|
||||
NET.room.leave()
|
||||
if SCN.stack[#SCN.stack-1]=='net_newRoom'then
|
||||
SCN.pop()
|
||||
end
|
||||
@@ -69,14 +77,13 @@ function scene.sceneInit()
|
||||
newMessageTimer=0
|
||||
|
||||
if SCN.prev=='setting_game'then
|
||||
NET.changeConfig()
|
||||
NET.player.updateConf()
|
||||
end
|
||||
if GAME.prevBG then
|
||||
BG.set(GAME.prevBG)
|
||||
GAME.prevBG=false
|
||||
end
|
||||
if NET.specSRID then
|
||||
NET.wsconn_stream(NET.specSRID)
|
||||
NET.specSRID=false
|
||||
end
|
||||
end
|
||||
@@ -137,7 +144,7 @@ function scene.keyDown(key,isRep)
|
||||
elseif key=='return'then
|
||||
local mes=STRING.trim(inputBox:getText())
|
||||
if not inputBox.hide and #mes>0 then
|
||||
NET.sendMessage(mes)
|
||||
NET.room.chat(mes)
|
||||
inputBox:clear()
|
||||
else
|
||||
_switchChat()
|
||||
@@ -231,8 +238,8 @@ function scene.socketRead(cmd,d)
|
||||
end
|
||||
|
||||
function scene.update(dt)
|
||||
if NET.checkPlayDisconn()then
|
||||
NET.wsclose()
|
||||
if WS.status('game')~='running' then
|
||||
NET.closeWS()
|
||||
SCN.back()
|
||||
return
|
||||
end
|
||||
@@ -261,7 +268,7 @@ function scene.update(dt)
|
||||
elseif #stream%3==2 then
|
||||
stream=stream.."\0\0\0\0"
|
||||
end
|
||||
NET.uploadRecStream(stream)
|
||||
NET.player.stream(stream)
|
||||
lastUpstreamTime=PLAYERS[1].alive and P1.frameRun or 1e99
|
||||
end
|
||||
else
|
||||
|
||||
@@ -4,7 +4,7 @@ function scene.sceneInit()
|
||||
BG.set()
|
||||
end
|
||||
function scene.sceneBack()
|
||||
NET.wsclose()
|
||||
NET.closeWS()
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
@@ -21,7 +21,7 @@ scene.widgetList={
|
||||
code=function()
|
||||
if tryBack()then
|
||||
if USER.uid then
|
||||
NET.wsclose()
|
||||
NET.closeWS()
|
||||
USER.uid=false
|
||||
USER.authToken=false
|
||||
SCN.back()
|
||||
|
||||
@@ -36,7 +36,7 @@ local function _createRoom()
|
||||
if #roomname==0 then
|
||||
roomname=(USERS.getUsername(USER.uid)or"Anonymous").."'s room"
|
||||
end
|
||||
NET.createRoom(
|
||||
NET.room.create(
|
||||
roomname,
|
||||
descriptionBox.value,
|
||||
ROOMENV.capacity,
|
||||
|
||||
@@ -51,7 +51,7 @@ local passwordBox=WIDGET.newInputBox{name='password',x=350,y=505,w=500,h=50,secr
|
||||
}]]
|
||||
local function _fetchRoom()
|
||||
fetchTimer=10
|
||||
NET.fetchRoom()
|
||||
NET.room.fetch()
|
||||
end
|
||||
local scene={}
|
||||
|
||||
@@ -70,7 +70,7 @@ function scene.keyDown(key)
|
||||
local R=roomList:getSel()
|
||||
if TASK.getLock('fetchRoom')or not R then return end
|
||||
if R.roomInfo.version==VERSION.room then
|
||||
NET.enterRoom(R,passwordBox.value)
|
||||
NET.room.enter(R,passwordBox.value)
|
||||
else
|
||||
MES.new('error',text.versionNotMatch)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user