主菜单按钮行为更容易理解,添加连接音效和连接成功音效

This commit is contained in:
MrZ626
2021-05-15 20:17:31 +08:00
parent ed2ad35dde
commit 95a33c0e6c
9 changed files with 18 additions and 17 deletions

BIN
media/SFX/connect.ogg Normal file

Binary file not shown.

BIN
media/SFX/connected.ogg Normal file

Binary file not shown.

View File

@@ -78,7 +78,6 @@ return{
getVersionFail="Update detection failed",
oldVersion="Version $1 is now available!",
needUpdate="Newer version required!",
noInternet="Not connected to the network",
notFinished="Coming soon!",
jsonError="JSON error",

View File

@@ -78,7 +78,6 @@ return{
getVersionFail="Echec d'obtention de la dernière version",
oldVersion="La version $1 est disponible !",
-- needUpdate="Newer version required!",
-- noInternet="Not connected to the network",
-- notFinished="Coming soon!",
jsonError="Erreur json",

View File

@@ -78,7 +78,6 @@ return{
getVersionFail="Falha ao detectar uma versão nova",
oldVersion="Versão $1 esta disponível agora!",
-- needUpdate="Newer version required!",
-- noInternet="Not connected to the network",
-- notFinished="Coming soon!",
jsonError="Json error",

View File

@@ -78,7 +78,6 @@ return{
getVersionFail="Error al buscar nuevas versiones.",
oldVersion="¡Está disponible la nueva versión $1!",
needUpdate="¡Nueva versión requerida!",
-- noInternet="Not connected to the network",
notFinished="Próximamente",
jsonError="Error en Json",

View File

@@ -78,7 +78,6 @@ return{
getVersionFail="检测新版本失败",
oldVersion="最新版本$1可以下载了!",
needUpdate="请更新游戏!",
noInternet="还未连接到网络",
notFinished="暂未完成,敬请期待!",
jsonError="json错误",

View File

@@ -162,6 +162,18 @@ function NET.register(username,email,password)
})
end
end
function NET.tryLogin(ifAuto)
if NET.allow_online then
if WS.status('user')=='running'then
NET.getAccessToken()
elseif not ifAuto then
SCN.go('login')
end
else
TEXT.show(text.needUpdate,640,450,60,'flicker')
SFX.play('finesseError')
end
end
function NET.pong(wsName,message)
WS.send(wsName,type(message)=='string'and message or"",'pong')
end
@@ -296,12 +308,15 @@ function NET.updateWS_app()
NET.allow_online=true
if USER.authToken then
NET.wsconn_user_token(USER.uid,USER.authToken)
else
SCN.go('login')
end
end
if VERSION.code<res.newestCode then
LOG.print(text.oldVersion:gsub("$1",res.newestName),180,'message')
end
LOG.print(res.notice,300,'message')
NET.tryLogin(true)
elseif res.action==0 then--Get new version info
--?
elseif res.action==1 then--Get notice
@@ -361,6 +376,7 @@ function NET.updateWS_user()
NET.accessToken=res.accessToken
LOG.print(text.accessSuccessed,'message')
NET.wsconn_play()
SFX.play('connected')
elseif res.action==1 then--Get userInfo
USERS.updateUserData(res.data)
end

View File

@@ -64,21 +64,11 @@ function scene.keyDown(key)
elseif key=="a"then
if testButton(3)then
if NET.connected then
if NET.allow_online then
if WS.status('user')=='running'then
NET.getAccessToken()
else
SCN.go('login')
end
else
TEXT.show(text.needUpdate,640,450,60,'flicker')
SFX.play('finesseError')
end
NET.tryLogin(false)
else
TEXT.show(text.noInternet,640,450,60,'flicker')
NET.wsconn_app()
LOG.print(text.wsConnecting,'message')
SFX.play('finesseError')
SFX.play('connect')
end
end
elseif key=="z"then