整理代码,配合修改一个联网命令类型,修改联网相关场景背景
This commit is contained in:
@@ -4,6 +4,7 @@ return{
|
|||||||
drop=30,
|
drop=30,
|
||||||
freshLimit=15,
|
freshLimit=15,
|
||||||
noMod=true,
|
noMod=true,
|
||||||
|
bg="space",
|
||||||
},
|
},
|
||||||
load=function()
|
load=function()
|
||||||
PLY.newPlayer(1)
|
PLY.newPlayer(1)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ local NET={
|
|||||||
}
|
}
|
||||||
|
|
||||||
local mesType={
|
local mesType={
|
||||||
Connected=true,
|
Connect=true,
|
||||||
Self=true,
|
Self=true,
|
||||||
Broadcast=true,
|
Broadcast=true,
|
||||||
Private=true,
|
Private=true,
|
||||||
@@ -175,7 +175,7 @@ function NET.quitChat()
|
|||||||
end
|
end
|
||||||
|
|
||||||
--WS tick funcs
|
--WS tick funcs
|
||||||
function NET.TICK_WS_app()
|
function NET.updateWS_app()
|
||||||
local retryTime=5
|
local retryTime=5
|
||||||
while true do
|
while true do
|
||||||
YIELD()
|
YIELD()
|
||||||
@@ -212,7 +212,7 @@ function NET.TICK_WS_app()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function NET.TICK_WS_user()
|
function NET.updateWS_user()
|
||||||
while true do
|
while true do
|
||||||
YIELD()
|
YIELD()
|
||||||
local status=WS.status("user")
|
local status=WS.status("user")
|
||||||
@@ -228,7 +228,7 @@ function NET.TICK_WS_user()
|
|||||||
else
|
else
|
||||||
local res=_parse(message)
|
local res=_parse(message)
|
||||||
if res then
|
if res then
|
||||||
if res.type=="Connected"then
|
if res.type=="Connect"then
|
||||||
NET.login=true
|
NET.login=true
|
||||||
if res.id then
|
if res.id then
|
||||||
USER.id=res.id
|
USER.id=res.id
|
||||||
@@ -256,7 +256,7 @@ function NET.TICK_WS_user()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function NET.TICK_WS_play()
|
function NET.updateWS_play()
|
||||||
while true do
|
while true do
|
||||||
YIELD()
|
YIELD()
|
||||||
local status=WS.status("play")
|
local status=WS.status("play")
|
||||||
@@ -272,7 +272,7 @@ function NET.TICK_WS_play()
|
|||||||
else
|
else
|
||||||
local res=_parse(message)
|
local res=_parse(message)
|
||||||
if res then
|
if res then
|
||||||
if res.type=="Connected"then
|
if res.type=="Connect"then
|
||||||
SCN.go("net_menu")
|
SCN.go("net_menu")
|
||||||
_unlock("connectPlay")
|
_unlock("connectPlay")
|
||||||
elseif res.action==0 then--Fetch rooms
|
elseif res.action==0 then--Fetch rooms
|
||||||
@@ -306,7 +306,7 @@ function NET.TICK_WS_play()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function NET.TICK_WS_stream()
|
function NET.updateWS_stream()
|
||||||
while true do
|
while true do
|
||||||
YIELD()
|
YIELD()
|
||||||
local status=WS.status("stream")
|
local status=WS.status("stream")
|
||||||
@@ -322,7 +322,7 @@ function NET.TICK_WS_stream()
|
|||||||
else
|
else
|
||||||
local res=_parse(message)
|
local res=_parse(message)
|
||||||
if res then
|
if res then
|
||||||
if res.type=="Connected"then
|
if res.type=="Connect"then
|
||||||
--?
|
--?
|
||||||
elseif res.action==0 then--Game start
|
elseif res.action==0 then--Game start
|
||||||
SCN.socketRead("Begin",res.data)
|
SCN.socketRead("Begin",res.data)
|
||||||
@@ -345,7 +345,7 @@ function NET.TICK_WS_stream()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function NET.TICK_WS_chat()
|
function NET.updateWS_chat()
|
||||||
while true do
|
while true do
|
||||||
YIELD()
|
YIELD()
|
||||||
local status=WS.status("chat")
|
local status=WS.status("chat")
|
||||||
|
|||||||
@@ -177,9 +177,9 @@ local loadingThread=coroutine.wrap(function()
|
|||||||
STAT.run=STAT.run+1
|
STAT.run=STAT.run+1
|
||||||
|
|
||||||
--Connect to server
|
--Connect to server
|
||||||
TASK.new(NET.TICK_WS_app)
|
TASK.new(NET.updateWS_app)
|
||||||
TASK.new(NET.TICK_WS_user)
|
TASK.new(NET.updateWS_user)
|
||||||
TASK.new(NET.TICK_WS_play)
|
TASK.new(NET.updateWS_play)
|
||||||
WS.connect("app","/app")
|
WS.connect("app","/app")
|
||||||
if USER.authToken then
|
if USER.authToken then
|
||||||
WS.connect("user","/user",JSON.encode{
|
WS.connect("user","/user",JSON.encode{
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
local scene={}
|
local scene={}
|
||||||
|
|
||||||
function scene.sceneInit()
|
function scene.sceneInit()
|
||||||
BG.set("matrix")
|
BG.set("space")
|
||||||
end
|
end
|
||||||
|
|
||||||
scene.widgetList={
|
scene.widgetList={
|
||||||
WIDGET.newButton{name="ffa", x=640, y=200,w=350,h=120,font=40,code=NULL},
|
-- WIDGET.newButton{name="ffa", x=640, y=200,w=350,h=120,font=40,code=NULL},
|
||||||
WIDGET.newButton{name="rooms", x=640, y=360,w=350,h=120,font=40,code=goScene"net_rooms"},
|
WIDGET.newButton{name="rooms", x=640, y=360,w=350,h=120,font=40,code=goScene"net_rooms"},
|
||||||
WIDGET.newButton{name="chat", x=640, y=540,w=350,h=120,font=40,code=goScene"net_chat",hide=function()return WS.status("chat")~="running"end},
|
-- WIDGET.newButton{name="chat", x=640, y=540,w=350,h=120,font=40,code=goScene"net_chat"},
|
||||||
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,font=40,code=backScene},
|
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,font=40,code=backScene},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ end
|
|||||||
local scene={}
|
local scene={}
|
||||||
|
|
||||||
function scene.sceneInit()
|
function scene.sceneInit()
|
||||||
BG.set("bg1")
|
BG.set("space")
|
||||||
scrollPos=0
|
scrollPos=0
|
||||||
selected=1
|
selected=1
|
||||||
fetchRoom()
|
fetchRoom()
|
||||||
|
|||||||
Reference in New Issue
Block a user