实现玩家设置同步到服务器
实现玩家离开房间(各种途径) 修改云存读档代码(还未实现) 移除sid,准备之后用uid本地排序序号代替(排序还未实现) 整理代码,框架跟进
This commit is contained in:
Submodule Zframework updated: 98f0fff6b0...d86dba11ea
@@ -7,7 +7,7 @@ local function getRollGoal(P)
|
|||||||
if rem<=0 then return 0 end
|
if rem<=0 then return 0 end
|
||||||
local goal=math.floor(rem)*4
|
local goal=math.floor(rem)*4
|
||||||
rem=rem%1
|
rem=rem%1
|
||||||
return goal + (rem>0.3 and 4 or rem*10)
|
return goal+(rem>0.3 and 4 or rem*10)
|
||||||
end
|
end
|
||||||
|
|
||||||
return{
|
return{
|
||||||
|
|||||||
@@ -111,11 +111,11 @@ local function getRollGoal()
|
|||||||
if cools>8 then
|
if cools>8 then
|
||||||
goal=math.floor(rem)*4
|
goal=math.floor(rem)*4
|
||||||
rem=rem%1
|
rem=rem%1
|
||||||
return goal + (rem>0.3 and 4 or rem*10)
|
return goal+(rem>0.3 and 4 or rem*10)
|
||||||
else
|
else
|
||||||
goal=math.floor(rem/0.26)*4
|
goal=math.floor(rem/0.26)*4
|
||||||
rem=rem%0.26
|
rem=rem%0.26
|
||||||
return goal + (rem>0.12 and 4 or rem*25)
|
return goal+(rem>0.12 and 4 or rem*25)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -100,8 +100,14 @@ function saveProgress()
|
|||||||
return saveFile(RANKS,'conf/unlock')
|
return saveFile(RANKS,'conf/unlock')
|
||||||
end
|
end
|
||||||
function saveSettings()
|
function saveSettings()
|
||||||
|
if WS.status('game')=='running' then
|
||||||
|
NET.player_updateConf()
|
||||||
|
end
|
||||||
return saveFile(SETTING,'conf/settings')
|
return saveFile(SETTING,'conf/settings')
|
||||||
end
|
end
|
||||||
|
function saveUser()
|
||||||
|
return saveFile(USER.__data,'conf/user')
|
||||||
|
end
|
||||||
do-- function applySettings()
|
do-- function applySettings()
|
||||||
local saturateValues={
|
local saturateValues={
|
||||||
normal={0,1},
|
normal={0,1},
|
||||||
@@ -857,7 +863,7 @@ function drawOnlinePlayerCount()
|
|||||||
gc_setColor(1,1,1)
|
gc_setColor(1,1,1)
|
||||||
gc_push('transform')
|
gc_push('transform')
|
||||||
gc_replaceTransform(SCR.xOy_ur)
|
gc_replaceTransform(SCR.xOy_ur)
|
||||||
gc_printf(text.onlinePlayerCount..":"..NET.onlineCount,-600,80,594,'right')
|
gc_printf(text.onlinePlayerCount:repD(NET.onlineCount),-600,80,594,'right')
|
||||||
gc_pop()
|
gc_pop()
|
||||||
end
|
end
|
||||||
function drawWarning()
|
function drawWarning()
|
||||||
|
|||||||
@@ -576,6 +576,7 @@ end
|
|||||||
do-- Userdata tables
|
do-- Userdata tables
|
||||||
USER=setmetatable({-- User infomation
|
USER=setmetatable({-- User infomation
|
||||||
__data={
|
__data={
|
||||||
|
uid=false,
|
||||||
email=false,
|
email=false,
|
||||||
password=false,
|
password=false,
|
||||||
rToken=false,
|
rToken=false,
|
||||||
@@ -588,7 +589,6 @@ do-- Userdata tables
|
|||||||
__newindex=function(self,k,v)
|
__newindex=function(self,k,v)
|
||||||
if self.__data[k]~=nil and v~=nil then
|
if self.__data[k]~=nil and v~=nil then
|
||||||
self.__data[k]=v
|
self.__data[k]=v
|
||||||
saveFile(USER.__data,'conf/user')
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -133,8 +133,9 @@ return{
|
|||||||
serverDown="Oops! Server is down",
|
serverDown="Oops! Server is down",
|
||||||
requestFailed="Request failed",
|
requestFailed="Request failed",
|
||||||
|
|
||||||
onlinePlayerCount="Online",
|
onlinePlayerCount="Online: $1",
|
||||||
createRoomSuccessed="Room created",
|
createRoomSuccessed="Room created",
|
||||||
|
playerKicked="[$1] removed [$2] from room",
|
||||||
started="Playing",
|
started="Playing",
|
||||||
joinRoom="has entered the room.",
|
joinRoom="has entered the room.",
|
||||||
leaveRoom="has left the room.",
|
leaveRoom="has left the room.",
|
||||||
|
|||||||
@@ -132,8 +132,9 @@ return{
|
|||||||
-- serverDown="Oops! Server is down",
|
-- serverDown="Oops! Server is down",
|
||||||
-- requestFailed="Request failed",
|
-- requestFailed="Request failed",
|
||||||
|
|
||||||
onlinePlayerCount="En línea",
|
onlinePlayerCount="En línea: $1",
|
||||||
createRoomSuccessed="¡Sala creada con éxito!",
|
createRoomSuccessed="¡Sala creada con éxito!",
|
||||||
|
-- playerKicked="[$1] removed [$2] from room",
|
||||||
started="En juego",
|
started="En juego",
|
||||||
joinRoom="entró a la sala.",
|
joinRoom="entró a la sala.",
|
||||||
leaveRoom="salió de la sala.",
|
leaveRoom="salió de la sala.",
|
||||||
|
|||||||
@@ -123,8 +123,9 @@ return{
|
|||||||
-- serverDown="Oops! Server is down",
|
-- serverDown="Oops! Server is down",
|
||||||
-- requestFailed="Request failed",
|
-- requestFailed="Request failed",
|
||||||
|
|
||||||
-- onlinePlayerCount="Online",
|
-- onlinePlayerCount="Online: $1",
|
||||||
createRoomSuccessed="Salon créé avec succès !",
|
createRoomSuccessed="Salon créé avec succès !",
|
||||||
|
-- playerKicked="[$1] removed [$2] from room",
|
||||||
-- started="Playing",
|
-- started="Playing",
|
||||||
joinRoom="a rejoint le salon.",
|
joinRoom="a rejoint le salon.",
|
||||||
leaveRoom="a quitté le salon.",
|
leaveRoom="a quitté le salon.",
|
||||||
|
|||||||
@@ -134,8 +134,9 @@ return{
|
|||||||
-- serverDown="Oops! Server is down",
|
-- serverDown="Oops! Server is down",
|
||||||
-- requestFailed="Request failed",
|
-- requestFailed="Request failed",
|
||||||
|
|
||||||
onlinePlayerCount="Online",
|
onlinePlayerCount="Online: $1",
|
||||||
createRoomSuccessed="Ruang terbuat",
|
createRoomSuccessed="Ruang terbuat",
|
||||||
|
-- playerKicked="[$1] removed [$2] from room",
|
||||||
started="Bermain",
|
started="Bermain",
|
||||||
joinRoom="telah memasuki ruangan.",
|
joinRoom="telah memasuki ruangan.",
|
||||||
leaveRoom="telah keluar dari ruangan.",
|
leaveRoom="telah keluar dari ruangan.",
|
||||||
|
|||||||
@@ -134,8 +134,9 @@ return{
|
|||||||
-- serverDown="Oops! Server is down",
|
-- serverDown="Oops! Server is down",
|
||||||
-- requestFailed="Request failed",
|
-- requestFailed="Request failed",
|
||||||
|
|
||||||
onlinePlayerCount="オンライン人数",
|
onlinePlayerCount="オンライン人数: $1",
|
||||||
createRoomSuccessed="部屋を建てました",
|
createRoomSuccessed="部屋を建てました",
|
||||||
|
-- playerKicked="[$1] removed [$2] from room",
|
||||||
started="プレイ中",
|
started="プレイ中",
|
||||||
joinRoom="が入室しました",
|
joinRoom="が入室しました",
|
||||||
leaveRoom="が退出しました",
|
leaveRoom="が退出しました",
|
||||||
|
|||||||
@@ -121,8 +121,9 @@ return{
|
|||||||
-- serverDown="Oops! Server is down",
|
-- serverDown="Oops! Server is down",
|
||||||
-- requestFailed="Request failed",
|
-- requestFailed="Request failed",
|
||||||
|
|
||||||
-- onlinePlayerCount="Online",
|
-- onlinePlayerCount="Online: $1",
|
||||||
-- createRoomSuccessed="Room successfully created!",
|
-- createRoomSuccessed="Room successfully created!",
|
||||||
|
-- playerKicked="[$1] removed [$2] from room",
|
||||||
-- started="Playing",
|
-- started="Playing",
|
||||||
joinRoom="Entrou a sala.",
|
joinRoom="Entrou a sala.",
|
||||||
leaveRoom="Saiu da sala.",
|
leaveRoom="Saiu da sala.",
|
||||||
|
|||||||
@@ -133,8 +133,9 @@ return{
|
|||||||
serverDown="唉哟!服务器不在线",
|
serverDown="唉哟!服务器不在线",
|
||||||
requestFailed="请求失败",
|
requestFailed="请求失败",
|
||||||
|
|
||||||
onlinePlayerCount="在线人数",
|
onlinePlayerCount="在线人数: $1",
|
||||||
createRoomSuccessed="创建房间成功!",
|
createRoomSuccessed="创建房间成功!",
|
||||||
|
playerKicked="<$1>把<$2>移出了房间",
|
||||||
started="游戏中",
|
started="游戏中",
|
||||||
joinRoom="进入房间",
|
joinRoom="进入房间",
|
||||||
leaveRoom="离开房间",
|
leaveRoom="离开房间",
|
||||||
@@ -153,7 +154,7 @@ return{
|
|||||||
customBGloadFailed="自定义背景的图片文件格式不支持",
|
customBGloadFailed="自定义背景的图片文件格式不支持",
|
||||||
|
|
||||||
errorMsg="Techmino遭受了雷击,需要重新启动。\n我们已收集了一些错误信息,你可以向作者进行反馈。",
|
errorMsg="Techmino遭受了雷击,需要重新启动。\n我们已收集了一些错误信息,你可以向作者进行反馈。",
|
||||||
tryAnotherBuild="[解码UTF-8错误] 如果你现在用的是Windows系统,请重新下载 Techmino-32位 或者 Techmino-64位 (和现在运行的不一样的那个)。",
|
tryAnotherBuild="[解码UTF-8错误] 如果你现在用的是Windows系统,请重新下载 Techmino-32/64位 (和现在运行的不一样的那个)。",
|
||||||
|
|
||||||
modInstruction="选择你要使用的Mod!\n不同Mod会用不同的方式改变初始游戏规则(可能导致不能正常游玩)\n来开发新玩法或者挑战自我吧!\n提醒:开启一些Mod会让成绩无效,你也可以用键盘开关Mod,按住shift反向",
|
modInstruction="选择你要使用的Mod!\n不同Mod会用不同的方式改变初始游戏规则(可能导致不能正常游玩)\n来开发新玩法或者挑战自我吧!\n提醒:开启一些Mod会让成绩无效,你也可以用键盘开关Mod,按住shift反向",
|
||||||
modInfo={
|
modInfo={
|
||||||
|
|||||||
@@ -133,8 +133,9 @@ return{
|
|||||||
serverDown="Error.ServerDown();",
|
serverDown="Error.ServerDown();",
|
||||||
requestFailed="Error.RequestFailed();",
|
requestFailed="Error.RequestFailed();",
|
||||||
|
|
||||||
onlinePlayerCount="OnlinePlayerCount",
|
onlinePlayerCount="OnlinePlayerCount=$1",
|
||||||
createRoomSuccessed="CreateRoom.Successs=true",
|
createRoomSuccessed="CreateRoom.Successs=true",
|
||||||
|
playerKicked="[$1]: roomKick([$2])",
|
||||||
started="Room.Playing();",
|
started="Room.Playing();",
|
||||||
joinRoom="Room.Join();",
|
joinRoom="Room.Join();",
|
||||||
leaveRoom="Room.Leave();",
|
leaveRoom="Room.Leave();",
|
||||||
@@ -153,7 +154,7 @@ return{
|
|||||||
customBGloadFailed="Error.Ctm.BG(UnsupportFormat);",
|
customBGloadFailed="Error.Ctm.BG(UnsupportFormat);",
|
||||||
|
|
||||||
errorMsg="Error.Fatal();\n//请检查语法错误或向作者进行反馈。",
|
errorMsg="Error.Fatal();\n//请检查语法错误或向作者进行反馈。",
|
||||||
tryAnotherBuild="Error.DecodeUTF8(); //如果你现在用的是Windows系统,请重新下载 Techmino-32位 或者 Techmino-64位 (和现在运行的不一样的那个)。",
|
tryAnotherBuild="Error.DecodeUTF8(); //如果你现在用的是Windows系统,请重新下载 Techmino-32/64位 (和现在运行的不一样的那个)。",
|
||||||
|
|
||||||
modInstruction="Mod.Instruction();\n/*选择你要使用的Mod\n不同Mod会用不同的方式改变初始游戏规则(可能导致不能正常游玩)\n提醒:开启一些Mod会让成绩无效,你也可以用键盘开关Mod,按住shift反向*/",
|
modInstruction="Mod.Instruction();\n/*选择你要使用的Mod\n不同Mod会用不同的方式改变初始游戏规则(可能导致不能正常游玩)\n提醒:开启一些Mod会让成绩无效,你也可以用键盘开关Mod,按住shift反向*/",
|
||||||
modInfo={
|
modInfo={
|
||||||
|
|||||||
@@ -133,8 +133,9 @@ return{
|
|||||||
serverDown="哎唷!服務器不在线",
|
serverDown="哎唷!服務器不在线",
|
||||||
requestFailed="請求失敗",
|
requestFailed="請求失敗",
|
||||||
|
|
||||||
onlinePlayerCount="在線用戶數",
|
onlinePlayerCount="在線用戶數: $1",
|
||||||
createRoomSuccessed="房間已創建!",
|
createRoomSuccessed="房間已創建!",
|
||||||
|
playerKicked="<$1>把<$2>移出了房間",
|
||||||
started="遊戲中",
|
started="遊戲中",
|
||||||
joinRoom="進入房間",
|
joinRoom="進入房間",
|
||||||
leaveRoom="離開房間",
|
leaveRoom="離開房間",
|
||||||
@@ -153,7 +154,7 @@ return{
|
|||||||
customBGloadFailed="自定義背景的圖片檔案格式不支持",
|
customBGloadFailed="自定義背景的圖片檔案格式不支持",
|
||||||
|
|
||||||
errorMsg="Techmino遇到問題,需要重新啟動。\n我們已經收集了一些錯誤信息,你可以反饋給作者。",
|
errorMsg="Techmino遇到問題,需要重新啟動。\n我們已經收集了一些錯誤信息,你可以反饋給作者。",
|
||||||
tryAnotherBuild="[無效的 UTF-8] 如果你使用的是Windows作業系統,請嘗試下載Techmino-win32或Techmino-win64(與你現在使用的不同的版本)。",
|
tryAnotherBuild="[無效的UTF-8] 如果你使用的是Windows作業系統,請嘗試下載Techmino-win32或Techmino-win64(與你現在使用的不同的版本)。",
|
||||||
|
|
||||||
modInstruction="選擇你想使用的Mod!\n不同的Mod會以不同的方式改變遊戲規則(可能導致遊戲異常)\n快來開發新玩法或挑戰自我吧!\n提醒:開啟Mod會使成績無效,你可以使用鍵盤開關Mod,按下shift反向",
|
modInstruction="選擇你想使用的Mod!\n不同的Mod會以不同的方式改變遊戲規則(可能導致遊戲異常)\n快來開發新玩法或挑戰自我吧!\n提醒:開啟Mod會使成績無效,你可以使用鍵盤開關Mod,按下shift反向",
|
||||||
modInfo={
|
modInfo={
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ return{
|
|||||||
if p.uid==USER.uid then
|
if p.uid==USER.uid then
|
||||||
if p.connected then
|
if p.connected then
|
||||||
PLY.newPlayer(1)
|
PLY.newPlayer(1)
|
||||||
PLAYERS[1].sid=NETPLY.getSID(USER.uid)
|
|
||||||
N=2
|
N=2
|
||||||
end
|
end
|
||||||
table.remove(L,i)
|
table.remove(L,i)
|
||||||
|
|||||||
211
parts/net.lua
211
parts/net.lua
@@ -1,9 +1,8 @@
|
|||||||
local WS=WS
|
local WS=WS
|
||||||
|
|
||||||
local NET={
|
local NET={
|
||||||
allow_online=false,
|
uid=false,
|
||||||
accessToken=false,
|
uid_sid={},
|
||||||
cloudData={},
|
|
||||||
|
|
||||||
roomState={-- A copy of room structure on server
|
roomState={-- A copy of room structure on server
|
||||||
info={
|
info={
|
||||||
@@ -17,8 +16,8 @@ local NET={
|
|||||||
private=false,
|
private=false,
|
||||||
start=false,
|
start=false,
|
||||||
},
|
},
|
||||||
|
|
||||||
spectate=false,-- If player is spectating
|
spectate=false,-- If player is spectating
|
||||||
specSRID=false,-- Cached SRID when enter playing room, for connect WS after scene swapped
|
|
||||||
seed=false,
|
seed=false,
|
||||||
|
|
||||||
roomReadyState=false,
|
roomReadyState=false,
|
||||||
@@ -116,6 +115,7 @@ function NET.getCode(email)
|
|||||||
if res then
|
if res then
|
||||||
if res.code==200 then
|
if res.code==200 then
|
||||||
USER.email=email
|
USER.email=email
|
||||||
|
saveUser()
|
||||||
SCN.fileDropped(2)
|
SCN.fileDropped(2)
|
||||||
MES.new('info',text.checkEmail,5)
|
MES.new('info',text.checkEmail,5)
|
||||||
end
|
end
|
||||||
@@ -148,6 +148,7 @@ function NET.codeLogin(code)
|
|||||||
if res.code==200 then
|
if res.code==200 then
|
||||||
USER.rToken=res.data.refreshToken
|
USER.rToken=res.data.refreshToken
|
||||||
USER.aToken=res.data.accessToken
|
USER.aToken=res.data.accessToken
|
||||||
|
USER.uid=res.data.playerId
|
||||||
NET.ws_connect()
|
NET.ws_connect()
|
||||||
SCN.pop()SCN.go('net_menu')
|
SCN.pop()SCN.go('net_menu')
|
||||||
elseif res.code==201 then
|
elseif res.code==201 then
|
||||||
@@ -156,6 +157,7 @@ function NET.codeLogin(code)
|
|||||||
SCN.pop()SCN.push('net_menu')
|
SCN.pop()SCN.push('net_menu')
|
||||||
SCN.fileDropped(3)
|
SCN.fileDropped(3)
|
||||||
end
|
end
|
||||||
|
saveUser()
|
||||||
end
|
end
|
||||||
|
|
||||||
WAIT.interrupt()
|
WAIT.interrupt()
|
||||||
@@ -188,6 +190,7 @@ function NET.setPW(code,pw)
|
|||||||
if res then
|
if res then
|
||||||
if res.code==200 then
|
if res.code==200 then
|
||||||
USER.password=pw
|
USER.password=pw
|
||||||
|
saveUser()
|
||||||
SCN.back()
|
SCN.back()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -216,6 +219,8 @@ function NET.autoLogin()
|
|||||||
|
|
||||||
if res then
|
if res then
|
||||||
if res.code==200 then
|
if res.code==200 then
|
||||||
|
USER.uid=res.data.playerId
|
||||||
|
saveUser()
|
||||||
NET.ws_connect()
|
NET.ws_connect()
|
||||||
SCN.go('net_menu')
|
SCN.go('net_menu')
|
||||||
WAIT.interrupt()
|
WAIT.interrupt()
|
||||||
@@ -237,6 +242,8 @@ function NET.autoLogin()
|
|||||||
if res.code==200 then
|
if res.code==200 then
|
||||||
USER.rToken=res.data.refreshToken
|
USER.rToken=res.data.refreshToken
|
||||||
USER.aToken=res.data.accessToken
|
USER.aToken=res.data.accessToken
|
||||||
|
USER.uid=res.data.playerId
|
||||||
|
saveUser()
|
||||||
NET.ws_connect()
|
NET.ws_connect()
|
||||||
SCN.go('net_menu')
|
SCN.go('net_menu')
|
||||||
WAIT.interrupt()
|
WAIT.interrupt()
|
||||||
@@ -260,6 +267,8 @@ function NET.autoLogin()
|
|||||||
if res.code==200 then
|
if res.code==200 then
|
||||||
USER.rToken=res.data.refreshToken
|
USER.rToken=res.data.refreshToken
|
||||||
USER.aToken=res.data.accessToken
|
USER.aToken=res.data.accessToken
|
||||||
|
USER.uid=res.data.playerId
|
||||||
|
saveUser()
|
||||||
NET.ws_connect()
|
NET.ws_connect()
|
||||||
SCN.go('net_menu')
|
SCN.go('net_menu')
|
||||||
WAIT.interrupt()
|
WAIT.interrupt()
|
||||||
@@ -303,6 +312,8 @@ function NET.pwLogin(email,pw)
|
|||||||
USER.password=pw
|
USER.password=pw
|
||||||
USER.rToken=res.data.refreshToken
|
USER.rToken=res.data.refreshToken
|
||||||
USER.aToken=res.data.accessToken
|
USER.aToken=res.data.accessToken
|
||||||
|
USER.uid=res.data.playerId
|
||||||
|
saveUser()
|
||||||
NET.ws_connect()
|
NET.ws_connect()
|
||||||
SCN.go('net_menu')
|
SCN.go('net_menu')
|
||||||
end
|
end
|
||||||
@@ -312,13 +323,11 @@ function NET.pwLogin(email,pw)
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
--Remove player when leave
|
function NET.getUserInfo(uid)
|
||||||
local function _removePlayer(L,sid)
|
wsSend({
|
||||||
for i=1,#L do
|
uid=uid,
|
||||||
if L[i].sid==sid then
|
hash=USERS.getHash(uid),
|
||||||
return table.remove(L,i)
|
})
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------<NEW WS API>
|
--------------------------<NEW WS API>
|
||||||
@@ -351,13 +360,23 @@ local actMap={
|
|||||||
|
|
||||||
local function wsSend(act,data)
|
local function wsSend(act,data)
|
||||||
-- print(("Send: $1 -->"):repD(act))
|
-- print(("Send: $1 -->"):repD(act))
|
||||||
-- print(("Send: $1 -->"):repD(act)) print(TABLE.dump(data),"\n")
|
-- print(("Send: $1 -->"):repD(act)) print(type(data)=='table' and TABLE.dump(data) or tostring(data),"\n")
|
||||||
WS.send('game',JSON.encode{
|
WS.send('game',JSON.encode{
|
||||||
action=assert(act),
|
action=assert(act),
|
||||||
data=data,
|
data=data,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--Remove player when leave
|
||||||
|
local function _playerLeaveRoom(uid)
|
||||||
|
NETPLY.remove(uid)
|
||||||
|
for i=1,#PLAYERS do if PLAYERS[i].uid==uid then table.remove(PLAYERS,i) break end end
|
||||||
|
for i=1,#PLY_ALIVE do if PLY_ALIVE[i].uid==uid then table.remove(PLAYERS,i) break end end
|
||||||
|
if uid==USER.uid and SCN.cur=='net_game' then
|
||||||
|
SCN.back()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Global
|
-- Global
|
||||||
function NET.global_getOnlineCount()
|
function NET.global_getOnlineCount()
|
||||||
wsSend(actMap.global_getOnlineCount)
|
wsSend(actMap.global_getOnlineCount)
|
||||||
@@ -479,6 +498,8 @@ function NET.player_setPlaying(playing)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Match
|
-- Match
|
||||||
|
function NET.match_techminohaowan(arg)
|
||||||
|
end
|
||||||
|
|
||||||
-- WS
|
-- WS
|
||||||
NET.wsCallBack={}
|
NET.wsCallBack={}
|
||||||
@@ -497,6 +518,7 @@ function NET.wsCallBack.room_chat(body)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.room_create(body)
|
function NET.wsCallBack.room_create(body)
|
||||||
|
MES.new('check',text.createRoomSuccessed)
|
||||||
NET.wsCallBack.room_enter(body)
|
NET.wsCallBack.room_enter(body)
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.room_getData(body)
|
function NET.wsCallBack.room_getData(body)
|
||||||
@@ -522,30 +544,14 @@ function NET.wsCallBack.room_enter(body)-- TODO
|
|||||||
WAIT.interrupt()
|
WAIT.interrupt()
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.room_kick(body)
|
function NET.wsCallBack.room_kick(body)
|
||||||
if body.data then
|
MES.new('info',text.playerKicked:repD(body.data.executorId,body.data.playerId))
|
||||||
-- local eid=body.data.executorId
|
_playerLeaveRoom(body.data.playerId)
|
||||||
local uid=body.data.targetId
|
|
||||||
NETPLY.remove(uid)
|
|
||||||
_removePlayer(PLAYERS,uid)
|
|
||||||
_removePlayer(PLY_ALIVE,uid)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.room_leave(body)
|
function NET.wsCallBack.room_leave(body)
|
||||||
if body.data then
|
if body.data.playerId~=USER.uid then
|
||||||
if body.type=='Server' then
|
MES.new('info',text.leaveRoom:repD(body.data.playerId))
|
||||||
if SCN.cur=='net_game' then
|
|
||||||
if SCN.stack[#SCN.stack-1]=='net_newRoom' then
|
|
||||||
SCN.pop()
|
|
||||||
end
|
|
||||||
SCN.back()
|
|
||||||
end
|
|
||||||
elseif body.type=='Client' then
|
|
||||||
local uid=body.data.playerId
|
|
||||||
NETPLY.remove(uid)
|
|
||||||
_removePlayer(PLAYERS,uid)
|
|
||||||
_removePlayer(PLY_ALIVE,uid)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
_playerLeaveRoom(body.data.playerId)
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.room_fetch(body)
|
function NET.wsCallBack.room_fetch(body)
|
||||||
TASK.unlock('fetchRoom')
|
TASK.unlock('fetchRoom')
|
||||||
@@ -554,8 +560,9 @@ end
|
|||||||
function NET.wsCallBack.room_setPW()
|
function NET.wsCallBack.room_setPW()
|
||||||
MES.new(text.roomPasswordChanged)
|
MES.new(text.roomPasswordChanged)
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.room_remove(body)
|
function NET.wsCallBack.room_remove()
|
||||||
NET.wsCallBack.room_leave(body)
|
MES.new('info',text.roomRemoved)
|
||||||
|
_playerLeaveRoom(USER.uid)
|
||||||
end
|
end
|
||||||
function NET.wsCallBack.player_updateConf(body)-- TODO
|
function NET.wsCallBack.player_updateConf(body)-- TODO
|
||||||
end
|
end
|
||||||
@@ -577,6 +584,7 @@ end
|
|||||||
function NET.ws_connect()
|
function NET.ws_connect()
|
||||||
if WS.status('game')=='dead' then
|
if WS.status('game')=='dead' then
|
||||||
WS.connect('game','',{['x-access-token']=USER.aToken},6)
|
WS.connect('game','',{['x-access-token']=USER.aToken},6)
|
||||||
|
TASK.removeTask_code(NET.ws_update)
|
||||||
TASK.new(NET.ws_update)
|
TASK.new(NET.ws_update)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -584,56 +592,59 @@ function NET.ws_close()
|
|||||||
WS.close('game')
|
WS.close('game')
|
||||||
end
|
end
|
||||||
function NET.ws_update()
|
function NET.ws_update()
|
||||||
local updateOnlineTimer=0
|
-- Wait until connected then initialize player setting
|
||||||
while WS.status('game')~='dead' do
|
while true do
|
||||||
local dt=coroutine.yield()
|
TEST.yieldT(1/26)
|
||||||
|
if WS.status('game')=='dead' then
|
||||||
updateOnlineTimer=updateOnlineTimer+dt
|
return
|
||||||
if updateOnlineTimer>6.26 then
|
elseif WS.status('game')=='running' then
|
||||||
NET.global_getOnlineCount()
|
NET.player_updateConf()
|
||||||
updateOnlineTimer=0
|
break
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Websocket main loop
|
||||||
|
local updateOnlineCD=0
|
||||||
|
while true do
|
||||||
|
TEST.yieldT(.01)-- Network messages, max 126 FPS is enough
|
||||||
|
|
||||||
|
if WS.status('game')=='dead' then return end
|
||||||
|
|
||||||
|
updateOnlineCD=updateOnlineCD%626+1
|
||||||
|
if updateOnlineCD==0 then NET.global_getOnlineCount() end
|
||||||
|
|
||||||
local msg,op=WS.read('game')
|
local msg,op=WS.read('game')
|
||||||
if msg then
|
if msg then
|
||||||
if op=='ping' then
|
if op=='ping' then
|
||||||
elseif op=='pong' then
|
elseif op=='pong' then
|
||||||
elseif op=='close' then
|
elseif op=='close' then
|
||||||
local res=JSON.decode(msg)
|
msg=JSON.decode(msg)
|
||||||
MES.new('info',text.wsClose:repD(res and res.message or msg))
|
if msg then
|
||||||
if res and res.message then LOG(res.message) end
|
MES.new('info',text.wsClose:repD(msg and msg.message or msg))
|
||||||
|
if msg and msg.message then LOG(msg.message) end
|
||||||
|
end
|
||||||
TEST.yieldUntilNextScene()
|
TEST.yieldUntilNextScene()
|
||||||
NET.connectLost()
|
NET.connectLost()
|
||||||
return
|
return
|
||||||
else
|
elseif msg then
|
||||||
local body=JSON.decode(msg)
|
msg=JSON.decode(msg)
|
||||||
if body then
|
-- print(("Recv: <-- $1 err:$2"):repD(msg.action,msg.errno))
|
||||||
-- print(("Recv: <-- $1 ($2)"):repD(body.action,body.type))
|
-- print(("Recv: <-- $1 err:$2"):repD(msg.action,msg.errno)) print(TABLE.dump(msg),"\n")
|
||||||
print(("Recv: <-- $1 ($2)"):repD(body.action,body.type)) print(TABLE.dump(body),"\n")
|
if msg.errno~=0 then
|
||||||
if body.type=='Failed' then
|
parseError(msg.message~=nil and msg.message or msg)
|
||||||
parseError(body.message~=nil and body.message or msg)
|
|
||||||
else
|
|
||||||
local f=NET.wsCallBack[actMap[body.action]]
|
|
||||||
if f then f(body) end
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
MES.new('warn',"Wrong json: "..msg,5)
|
local f=NET.wsCallBack[actMap[msg.action]]
|
||||||
WS.alert('user')
|
if f then f(msg) end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
MES.new('warn',"Wrong json: "..msg,5)
|
||||||
|
WS.alert('user')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------<OLD ONLINE API>
|
--------------------------<OLD ONLINE API>
|
||||||
-- Account & User
|
|
||||||
function NET.getUserInfo(uid)
|
|
||||||
wsSend({
|
|
||||||
uid=uid,
|
|
||||||
hash=USERS.getHash(uid),
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Save
|
-- Save
|
||||||
function NET.uploadSave()
|
function NET.uploadSave()
|
||||||
if not TASK.lock('uploadSave',8) then return end
|
if not TASK.lock('uploadSave',8) then return end
|
||||||
@@ -654,46 +665,48 @@ function NET.downloadSave()
|
|||||||
MES.new('info',"Downloading")
|
MES.new('info',"Downloading")
|
||||||
end
|
end
|
||||||
function NET.loadSavedData(sections)
|
function NET.loadSavedData(sections)
|
||||||
|
local cloudData={}
|
||||||
|
local secNameList={'STAT','RANKS','SETTING','keyMap','VK_org','vkSave1','vkSave2'}
|
||||||
for _,sec in next,sections do
|
for _,sec in next,sections do
|
||||||
if sec.section==1 then
|
cloudData[secNameList[sec.section]]=STRING.unpackTable(sec.data)
|
||||||
NET.cloudData.STAT=STRING.unpackTable(sec.data)
|
|
||||||
elseif sec.section==2 then
|
|
||||||
NET.cloudData.RANKS=STRING.unpackTable(sec.data)
|
|
||||||
elseif sec.section==3 then
|
|
||||||
NET.cloudData.SETTING=STRING.unpackTable(sec.data)
|
|
||||||
elseif sec.section==4 then
|
|
||||||
NET.cloudData.keyMap=STRING.unpackTable(sec.data)
|
|
||||||
elseif sec.section==5 then
|
|
||||||
NET.cloudData.VK_org=STRING.unpackTable(sec.data)
|
|
||||||
elseif sec.section==6 then
|
|
||||||
NET.cloudData.vkSave1=STRING.unpackTable(sec.data)
|
|
||||||
elseif sec.section==7 then
|
|
||||||
NET.cloudData.vkSave2=STRING.unpackTable(sec.data)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
local success=true
|
|
||||||
TABLE.cover(NET.cloudData.STAT,STAT)
|
|
||||||
success=success and saveStats()
|
|
||||||
|
|
||||||
TABLE.cover(NET.cloudData.RANKS,RANKS)
|
local fail
|
||||||
success=success and saveProgress()
|
repeat
|
||||||
|
if cloudData.STAT then
|
||||||
|
TABLE.cover(cloudData.STAT,STAT)
|
||||||
|
if not saveStats() then fail=true end
|
||||||
|
end
|
||||||
|
|
||||||
TABLE.cover(NET.cloudData.SETTING,SETTING)
|
if cloudData.RANKS then
|
||||||
success=success and saveSettings()
|
TABLE.cover(cloudData.RANKS,RANKS)
|
||||||
applySettings()
|
if not saveProgress() then fail=true end
|
||||||
|
end
|
||||||
|
|
||||||
TABLE.cover(NET.cloudData.keyMap,KEY_MAP)
|
if cloudData.SETTING then
|
||||||
success=success and saveFile(KEY_MAP,'conf/key')
|
TABLE.cover(cloudData.SETTING,SETTING)
|
||||||
|
if not saveSettings() then fail=true end
|
||||||
|
end
|
||||||
|
applySettings()
|
||||||
|
|
||||||
TABLE.cover(NET.cloudData.VK_org,VK_ORG)
|
if cloudData.keyMap then
|
||||||
success=success and saveFile(VK_ORG,'conf/virtualkey')
|
TABLE.cover(cloudData.keyMap,KEY_MAP)
|
||||||
|
if not saveFile(KEY_MAP,'conf/key') then fail=true end
|
||||||
|
end
|
||||||
|
|
||||||
if #NET.cloudData.vkSave1[1] then success=success and saveFile(NET.cloudData.vkSave1,'conf/vkSave1') end
|
if cloudData.VK_org then
|
||||||
if #NET.cloudData.vkSave2[1] then success=success and saveFile(NET.cloudData.vkSave2,'conf/vkSave2') end
|
TABLE.cover(cloudData.VK_org,VK_ORG)
|
||||||
if success then
|
if not saveFile(VK_ORG,'conf/virtualkey') then fail=true end
|
||||||
MES.new('check',text.saveDone)
|
end
|
||||||
|
|
||||||
|
if #cloudData.vkSave1[1] and not saveFile(cloudData.vkSave1,'conf/vkSave1') then fail=true end
|
||||||
|
if #cloudData.vkSave2[1] and not saveFile(cloudData.vkSave2,'conf/vkSave2') then fail=true end
|
||||||
|
until true
|
||||||
|
|
||||||
|
if fail then
|
||||||
|
MES.new('error',text.dataCorrupted)
|
||||||
else
|
else
|
||||||
MES.new('warn',text.dataCorrupted)
|
MES.new('check',text.saveDone)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ local nullIndex={
|
|||||||
NETPLY.add{
|
NETPLY.add{
|
||||||
uid=k,
|
uid=k,
|
||||||
username="Stacker",
|
username="Stacker",
|
||||||
sid=-1,
|
|
||||||
mode=0,
|
mode=0,
|
||||||
config="",
|
config="",
|
||||||
}
|
}
|
||||||
@@ -108,7 +107,6 @@ function NETPLY.add(d)
|
|||||||
local p={
|
local p={
|
||||||
uid=d.uid,
|
uid=d.uid,
|
||||||
username=d.username,
|
username=d.username,
|
||||||
sid=d.sid,
|
|
||||||
mode=d.mode,
|
mode=d.mode,
|
||||||
config=d.config,
|
config=d.config,
|
||||||
connected=false,
|
connected=false,
|
||||||
@@ -122,9 +120,9 @@ function NETPLY.add(d)
|
|||||||
PLYmap[p.uid]=p
|
PLYmap[p.uid]=p
|
||||||
_freshPos()
|
_freshPos()
|
||||||
end
|
end
|
||||||
function NETPLY.remove(sid)
|
function NETPLY.remove(uid)
|
||||||
for i=1,#PLYlist do
|
for i=1,#PLYlist do
|
||||||
if PLYlist[i].sid==sid then
|
if PLYlist[i].uid==uid then
|
||||||
PLYmap[PLYlist[i].uid]=nil
|
PLYmap[PLYlist[i].uid]=nil
|
||||||
rem(PLYlist,i)
|
rem(PLYlist,i)
|
||||||
_freshPos()
|
_freshPos()
|
||||||
@@ -134,7 +132,6 @@ function NETPLY.remove(sid)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function NETPLY.getCount() return #PLYlist end
|
function NETPLY.getCount() return #PLYlist end
|
||||||
function NETPLY.getSID(uid) return PLYmap[uid].sid end
|
|
||||||
function NETPLY.getSelfJoinMode() return PLYmap[USER.uid].mode end
|
function NETPLY.getSelfJoinMode() return PLYmap[USER.uid].mode end
|
||||||
function NETPLY.getSelfReady() return PLYmap[USER.uid].mode>0 end
|
function NETPLY.getSelfReady() return PLYmap[USER.uid].mode>0 end
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ local function _newEmptyPlayer(id,mini)
|
|||||||
-- User-related
|
-- User-related
|
||||||
P.username=""
|
P.username=""
|
||||||
P.uid=false
|
P.uid=false
|
||||||
P.sid=id
|
P.sid=false
|
||||||
|
|
||||||
-- Block states
|
-- Block states
|
||||||
--[[
|
--[[
|
||||||
@@ -409,7 +409,7 @@ function PLY.newRemotePlayer(id,mini,ply)
|
|||||||
NETPLY.setPlayerObj(ply,P)
|
NETPLY.setPlayerObj(ply,P)
|
||||||
P.uid=ply.uid
|
P.uid=ply.uid
|
||||||
P.username=ply.username
|
P.username=ply.username
|
||||||
P.sid=ply.sid
|
P.sid=NET.uid_sid[ply.uid]
|
||||||
|
|
||||||
_loadRemoteEnv(P,ply.config)
|
_loadRemoteEnv(P,ply.config)
|
||||||
_applyGameEnv(P)
|
_applyGameEnv(P)
|
||||||
@@ -430,8 +430,9 @@ function PLY.newPlayer(id,mini)
|
|||||||
P.type='human'
|
P.type='human'
|
||||||
P.sound=true
|
P.sound=true
|
||||||
|
|
||||||
P.uid=USER.uid
|
|
||||||
P.username=USERS.getUsername(USER.uid)
|
P.username=USERS.getUsername(USER.uid)
|
||||||
|
P.uid=USER.uid
|
||||||
|
P.sid=NET.uid_sid[USER.uid]
|
||||||
|
|
||||||
_loadGameEnv(P)
|
_loadGameEnv(P)
|
||||||
_applyGameEnv(P)
|
_applyGameEnv(P)
|
||||||
|
|||||||
@@ -77,9 +77,6 @@ function scene.sceneInit()
|
|||||||
BG.set(GAME.prevBG)
|
BG.set(GAME.prevBG)
|
||||||
GAME.prevBG=false
|
GAME.prevBG=false
|
||||||
end
|
end
|
||||||
if NET.specSRID then
|
|
||||||
NET.specSRID=false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
function scene.sceneBack()
|
function scene.sceneBack()
|
||||||
GAME.playing=false
|
GAME.playing=false
|
||||||
@@ -195,7 +192,7 @@ function scene.gamepadUp(key)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.socketRead(cmd,d)
|
function scene._(cmd,d)
|
||||||
if cmd=='join' then
|
if cmd=='join' then
|
||||||
textBox:push{
|
textBox:push{
|
||||||
COLOR.lR,d.username,
|
COLOR.lR,d.username,
|
||||||
@@ -209,12 +206,6 @@ function scene.socketRead(cmd,d)
|
|||||||
COLOR.dY,"#"..d.uid.." ",
|
COLOR.dY,"#"..d.uid.." ",
|
||||||
COLOR.Y,text.leaveRoom,
|
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
|
elseif cmd=='go' then
|
||||||
if not playing then
|
if not playing then
|
||||||
playing=true
|
playing=true
|
||||||
@@ -222,8 +213,6 @@ function scene.socketRead(cmd,d)
|
|||||||
upstreamProgress=1
|
upstreamProgress=1
|
||||||
resetGameData('n',NET.seed)
|
resetGameData('n',NET.seed)
|
||||||
NETPLY.mouseMove(0,0)
|
NETPLY.mouseMove(0,0)
|
||||||
else
|
|
||||||
MES.new('warn',"Redundant [Go]")
|
|
||||||
end
|
end
|
||||||
elseif cmd=='finish' then
|
elseif cmd=='finish' then
|
||||||
playing=false
|
playing=false
|
||||||
@@ -315,7 +304,8 @@ function scene.draw()
|
|||||||
gc_draw(IMG.lock,30,668)
|
gc_draw(IMG.lock,30,668)
|
||||||
end
|
end
|
||||||
if NET.roomState.start then
|
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
|
end
|
||||||
|
|
||||||
-- Profile
|
-- Profile
|
||||||
|
|||||||
@@ -20,10 +20,12 @@ scene.widgetList={
|
|||||||
WIDGET.newButton{name='logout',x=880, y=40,w=180, h=60,color='dR',
|
WIDGET.newButton{name='logout',x=880, y=40,w=180, h=60,color='dR',
|
||||||
code=function()
|
code=function()
|
||||||
if tryBack() then
|
if tryBack() then
|
||||||
|
USER.__data.uid=false
|
||||||
USER.__data.email=false
|
USER.__data.email=false
|
||||||
USER.__data.password=false
|
USER.__data.password=false
|
||||||
USER.__data.rToken=false
|
USER.__data.rToken=false
|
||||||
USER.__data.aToken=false
|
USER.__data.aToken=false
|
||||||
|
love.filesystem.remove('conf/user')
|
||||||
NET.ws_close()
|
NET.ws_close()
|
||||||
SCN.back()
|
SCN.back()
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ scene.widgetList={
|
|||||||
-- Capacity & Create & Back
|
-- 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.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='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
|
-- Special rules
|
||||||
WIDGET.newSwitch{name='ospin', x=850, y=850, lim=210,disp=ROOMval('ospin'), code=ROOMrev('ospin')},
|
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='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.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='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.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'},
|
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)
|
function scene.keyDown(key,isRep)
|
||||||
if isRep then return true end
|
if isRep then return true end
|
||||||
if key=='q' then
|
if key=='q' then
|
||||||
SCN.back()
|
|
||||||
GAME.playing=false
|
GAME.playing=false
|
||||||
|
SCN.back()
|
||||||
elseif key=='escape' then
|
elseif key=='escape' then
|
||||||
SCN.swapTo(GAME.result and 'game' or 'depause','none')
|
SCN.swapTo(GAME.result and 'game' or 'depause','none')
|
||||||
elseif key=='s' then
|
elseif key=='s' then
|
||||||
|
|||||||
Reference in New Issue
Block a user