更新联网相关代码(非最终,但不会运行到)
This commit is contained in:
@@ -132,19 +132,10 @@ function scene.update()
|
||||
SFX.play("welcome_sfx")
|
||||
VOC.play("welcome_voc")
|
||||
--[[TODO
|
||||
httpRequest(tick_httpREQ_launch,PATH.http..PATH.appInfo)
|
||||
if USER.auth_token and USER.email then
|
||||
httpRequest(
|
||||
tick_httpREQ_autoLogin,
|
||||
PATH.http..PATH.auth,
|
||||
"GET",
|
||||
{["Content-Type"]="application/json"},
|
||||
json.encode{
|
||||
email=USER.email,
|
||||
auth_token=USER.auth_token,
|
||||
}
|
||||
)
|
||||
end
|
||||
WS.send("user",json.encode{
|
||||
id=USER.id,
|
||||
authToken=USER.authToken,
|
||||
})
|
||||
]]
|
||||
if FESTIVAL=="Xmas"then
|
||||
LOG.print("==============",COLOR.red)
|
||||
|
||||
@@ -7,10 +7,10 @@ local function login()
|
||||
LOG.print(text.noPassword)return
|
||||
end
|
||||
--[[TODO
|
||||
json.encode{
|
||||
WS.send("user",json.encode{
|
||||
email=email,
|
||||
password=password,
|
||||
}
|
||||
})
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
@@ -71,28 +71,18 @@ scene.widgetList={
|
||||
WIDGET.newButton{name="online", x=370,y=220,w=200,h=140,color="lCyan", font=40,code=function()
|
||||
if LOGIN then
|
||||
--[[TODO
|
||||
if USER.access_token then
|
||||
httpRequest(
|
||||
tick_httpREQ_manualAutoLogin,
|
||||
PATH.http..PATH.access,
|
||||
"GET",
|
||||
{["Content-Type"]="application/json"},
|
||||
json.encode{
|
||||
email=USER.email,
|
||||
access_token=USER.access_token,
|
||||
}
|
||||
)
|
||||
if USER.accessToken then
|
||||
WS.send("app",json.encode{
|
||||
opration="access",
|
||||
email=USER.email,
|
||||
accessToken=USER.accessToken,
|
||||
})
|
||||
else
|
||||
httpRequest(
|
||||
TICK_httpREQ_getAccessToken,
|
||||
PATH.http..PATH.access,
|
||||
"POST",
|
||||
{["Content-Type"]="application/json"},
|
||||
json.encode{
|
||||
email=USER.email,
|
||||
auth_token=USER.auth_token,
|
||||
}
|
||||
)
|
||||
WS.send("app",json.encode{
|
||||
opration="access",
|
||||
email=USER.email,
|
||||
authToken=USER.authToken,
|
||||
})
|
||||
end
|
||||
]]
|
||||
else
|
||||
|
||||
@@ -7,14 +7,7 @@ end
|
||||
scene.widgetList={
|
||||
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="chat", x=640, y=540,w=350,h=120,font=40,code=function()
|
||||
--[[TODO
|
||||
wsConnect("chat","/chat",json.encode{
|
||||
email=USER.email,
|
||||
token=USER.access_token,
|
||||
})
|
||||
]]
|
||||
end},
|
||||
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="back", x=1140, y=640,w=170,h=80,font=40,code=backScene},
|
||||
}
|
||||
|
||||
|
||||
@@ -8,23 +8,23 @@ local lastCreateRoomTime=0
|
||||
|
||||
local function enterRoom(roomID)
|
||||
--[[TODO
|
||||
WS.connect("play","/play",json.encode{
|
||||
email=USER.email,
|
||||
token=USER.access_token,
|
||||
id=roomID,
|
||||
conf=dumpBasicConfig(),
|
||||
-- password=password,
|
||||
})
|
||||
WS.connect("play","/play",json.encode{
|
||||
email=USER.email,
|
||||
token=USER.accessToken,
|
||||
id=roomID,
|
||||
conf=dumpBasicConfig(),
|
||||
-- password=password,
|
||||
})
|
||||
]]
|
||||
end
|
||||
local function fresh()
|
||||
lastfreshTime=TIME()
|
||||
rooms=nil
|
||||
--[[TODO
|
||||
WS.connect("play","/play",json.encode{
|
||||
email=USER.email,
|
||||
access_token=USER.access_token,
|
||||
})
|
||||
WS.connect("play","/play",json.encode{
|
||||
email=USER.email,
|
||||
accessToken=USER.accessToken,
|
||||
})
|
||||
]]
|
||||
end
|
||||
|
||||
@@ -48,12 +48,12 @@ function scene.keyDown(k)
|
||||
elseif k=="n"then
|
||||
if TIME()-lastCreateRoomTime>26 then
|
||||
--[[TODO
|
||||
WS.send("room",json.encode{
|
||||
email=USER.email,
|
||||
access_token=USER.access_token,
|
||||
room_name=(USER.name or"???").."'s room",
|
||||
room_password=nil,
|
||||
})
|
||||
WS.send("room",json.encode{
|
||||
email=USER.email,
|
||||
accessToken=USER.accessToken,
|
||||
room_name=(USER.name or"???").."'s room",
|
||||
room_password=nil,
|
||||
})
|
||||
]]
|
||||
lastCreateRoomTime=TIME()
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user