console添加切换服务器的命令
This commit is contained in:
@@ -233,6 +233,15 @@ local wsList=setmetatable({},{
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function WS.switchHost(_1,_2,_3)
|
||||||
|
for k in next,wsList do
|
||||||
|
WS.close(k)
|
||||||
|
end
|
||||||
|
host=_1
|
||||||
|
port=_2 or port
|
||||||
|
path=_3 or path
|
||||||
|
end
|
||||||
|
|
||||||
function WS.connect(name,subPath,body,timeout)
|
function WS.connect(name,subPath,body,timeout)
|
||||||
local ws={
|
local ws={
|
||||||
real=true,
|
real=true,
|
||||||
|
|||||||
@@ -236,6 +236,18 @@ do--commands.help(arg)
|
|||||||
"Usage: test",
|
"Usage: test",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
switchhost={
|
||||||
|
description="Switch another host",
|
||||||
|
details={
|
||||||
|
"Disconnect all connections and switch to another host",
|
||||||
|
"",
|
||||||
|
"Usage:",
|
||||||
|
"switchhost [host]",
|
||||||
|
"switchhost [host] [port]",
|
||||||
|
"switchhost [host] [port] [path]",
|
||||||
|
"Example: switchhost 127.0.0.1 26000 /sock",
|
||||||
|
},
|
||||||
|
},
|
||||||
applet={
|
applet={
|
||||||
description="Go to an applet scene",
|
description="Go to an applet scene",
|
||||||
details={
|
details={
|
||||||
@@ -275,6 +287,7 @@ do--commands.help(arg)
|
|||||||
"setbg",
|
"setbg",
|
||||||
"theme",
|
"theme",
|
||||||
"test",
|
"test",
|
||||||
|
"switchhost",
|
||||||
"applet",
|
"applet",
|
||||||
}
|
}
|
||||||
function commands.help(arg)
|
function commands.help(arg)
|
||||||
@@ -583,6 +596,19 @@ end
|
|||||||
function commands.test()
|
function commands.test()
|
||||||
SCN.go('test','none')
|
SCN.go('test','none')
|
||||||
end
|
end
|
||||||
|
function commands.switchhost(arg)
|
||||||
|
arg=STRING.split(arg," ")
|
||||||
|
if arg[1]and #arg<=3 then
|
||||||
|
WS.switchHost(unpack(arg))
|
||||||
|
log{C.Y,"Host switched"}
|
||||||
|
else
|
||||||
|
log{C.A,"Usage:"}
|
||||||
|
log{C.A,"switchhost [host]"}
|
||||||
|
log{C.A,"switchhost [host] [port]"}
|
||||||
|
log{C.A,"switchhost [host] [port] [path]"}
|
||||||
|
log{C.A,"Example: switchhost 127.0.0.1 26000 /sock"}
|
||||||
|
end
|
||||||
|
end
|
||||||
do--commands.applet(name)
|
do--commands.applet(name)
|
||||||
local appList={"15p","grid","pong","atoz","uttt","cube","2048","ten","tap","dtw","cannon","dropper","calc","reflect","polyforge"}
|
local appList={"15p","grid","pong","atoz","uttt","cube","2048","ten","tap","dtw","cannon","dropper","calc","reflect","polyforge"}
|
||||||
local appScene={'app_15p','app_schulteG','app_pong','app_AtoZ','app_UTTT','app_cubefield','app_2048','app_ten','app_tap','app_dtw','app_cannon','app_dropper','app_calc','app_reflect','app_polyforge'}
|
local appScene={'app_15p','app_schulteG','app_pong','app_AtoZ','app_UTTT','app_cubefield','app_2048','app_ten','app_tap','app_dtw','app_cannon','app_dropper','app_calc','app_reflect','app_polyforge'}
|
||||||
|
|||||||
Reference in New Issue
Block a user