【警告】联网不能用,不要随便试
联网重制ing,提交一下做个中继点
This commit is contained in:
Submodule Zframework updated: 5bd04c8ce2...2ba3ffea4c
6
main.lua
6
main.lua
@@ -546,7 +546,7 @@ do
|
|||||||
STAT.version=VERSION.code
|
STAT.version=VERSION.code
|
||||||
needSave=true
|
needSave=true
|
||||||
end
|
end
|
||||||
SETTING.appLock,SETTING.dataSaving,SETTING.swap=nil
|
SETTING.appLock,SETTING.dataSaving,SETTING.swap,SETTING.autoLogin=nil
|
||||||
if not SETTING.VKSkin then SETTING.VKSkin=1 end
|
if not SETTING.VKSkin then SETTING.VKSkin=1 end
|
||||||
for _,v in next,SETTING.skin do if v<1 or v>17 then v=17 end end
|
for _,v in next,SETTING.skin do if v<1 or v>17 then v=17 end end
|
||||||
if not RSlist[SETTING.RS]then SETTING.RS='TRS'end
|
if not RSlist[SETTING.RS]then SETTING.RS='TRS'end
|
||||||
@@ -692,4 +692,6 @@ if TABLE.find(arg,'--test')then
|
|||||||
love.event.quit(1)
|
love.event.quit(1)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
WS.switchHost('101.43.110.22','10026','/tech/socket/v1')
|
WS.switchHost('cafuuchino1.3322.org','10026','/tech/socket/v1')
|
||||||
|
HTTP.setHost("cafuuchino1.3322.org:10026")
|
||||||
|
HTTP.setThreadCount(1)
|
||||||
|
|||||||
@@ -873,11 +873,6 @@ do--function drawSelfProfile()
|
|||||||
end
|
end
|
||||||
gc_draw(textObj,-82,26,nil,scaleK,nil,width,offY)
|
gc_draw(textObj,-82,26,nil,scaleK,nil,width,offY)
|
||||||
|
|
||||||
--Draw lv. & xp.
|
|
||||||
gc_draw(lvIcon[USER.lv],-295,50)
|
|
||||||
gc_line(-270,55,-80,55,-80,70,-270,70)
|
|
||||||
gc_rectangle('fill',-210,55,150*USER.xp/USER.lv/USER.lv,15)
|
|
||||||
|
|
||||||
gc_pop()
|
gc_pop()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -575,12 +575,10 @@ do--Game data tables
|
|||||||
end
|
end
|
||||||
do--Userdata tables
|
do--Userdata tables
|
||||||
USER={--User infomation
|
USER={--User infomation
|
||||||
--Network infos
|
email=false,
|
||||||
uid=false,
|
password=false,
|
||||||
authToken=false,
|
rToken=false,
|
||||||
|
aToken=false,
|
||||||
--Local data
|
|
||||||
xp=0,lv=1,
|
|
||||||
}
|
}
|
||||||
SETTING={--Settings
|
SETTING={--Settings
|
||||||
--Tuning
|
--Tuning
|
||||||
@@ -598,7 +596,6 @@ do--Userdata tables
|
|||||||
menuPos='middle',
|
menuPos='middle',
|
||||||
fine=false,
|
fine=false,
|
||||||
autoSave=false,
|
autoSave=false,
|
||||||
autoLogin=true,
|
|
||||||
simpMode=false,
|
simpMode=false,
|
||||||
sysCursor=true,
|
sysCursor=true,
|
||||||
maxFPS=60,
|
maxFPS=60,
|
||||||
|
|||||||
@@ -322,6 +322,7 @@ return{
|
|||||||
Cold_Clear [MinusKelvin]
|
Cold_Clear [MinusKelvin]
|
||||||
json.lua [rxi]
|
json.lua [rxi]
|
||||||
profile.lua [itraykov]
|
profile.lua [itraykov]
|
||||||
|
sha2 [Egor Skriptunoff]
|
||||||
]],
|
]],
|
||||||
support="Support the author",
|
support="Support the author",
|
||||||
WidgetText={
|
WidgetText={
|
||||||
@@ -437,7 +438,6 @@ return{
|
|||||||
sysCursor="Use System Cursor",
|
sysCursor="Use System Cursor",
|
||||||
autoPause="Pause When Unfocused",
|
autoPause="Pause When Unfocused",
|
||||||
autoSave="Auto-save New Records",
|
autoSave="Auto-save New Records",
|
||||||
autoLogin="Auto-login on Start",
|
|
||||||
simpMode="Simplistic Mode",
|
simpMode="Simplistic Mode",
|
||||||
},
|
},
|
||||||
setting_video={
|
setting_video={
|
||||||
@@ -694,18 +694,18 @@ return{
|
|||||||
email="Email Address",
|
email="Email Address",
|
||||||
password="Password",
|
password="Password",
|
||||||
showEmail="Show Email",
|
showEmail="Show Email",
|
||||||
keepPW="Remember me",
|
|
||||||
login="Log In",
|
login="Log In",
|
||||||
},
|
},
|
||||||
register={
|
register={
|
||||||
title="Sign Up",
|
title="Sign Up",
|
||||||
login="Sign In",
|
login="Sign In",
|
||||||
username="Username",
|
|
||||||
email="Email Address",
|
email="Email Address",
|
||||||
|
send="Send code",
|
||||||
|
code="Verification Code",
|
||||||
|
verify="Verify",
|
||||||
password="Password",
|
password="Password",
|
||||||
password2="Re-enter Password",
|
password2="Re-enter Password",
|
||||||
register="Sign Up",
|
setPW="Set Password",
|
||||||
registering="Waiting for response…",
|
|
||||||
},
|
},
|
||||||
account={
|
account={
|
||||||
title="Account",
|
title="Account",
|
||||||
|
|||||||
@@ -322,6 +322,7 @@ return{
|
|||||||
Cold_Clear [MinusKelvin]
|
Cold_Clear [MinusKelvin]
|
||||||
json.lua [rxi]
|
json.lua [rxi]
|
||||||
profile.lua [itraykov]
|
profile.lua [itraykov]
|
||||||
|
sha2 [Egor Skriptunoff]
|
||||||
]],
|
]],
|
||||||
support="Apoyen al Autor",
|
support="Apoyen al Autor",
|
||||||
WidgetText={
|
WidgetText={
|
||||||
@@ -437,7 +438,6 @@ return{
|
|||||||
sysCursor="Usar cursor del sistema",
|
sysCursor="Usar cursor del sistema",
|
||||||
autoPause="Pausar cuando la ventana no está enfocada",
|
autoPause="Pausar cuando la ventana no está enfocada",
|
||||||
autoSave="Autograbar Récords",
|
autoSave="Autograbar Récords",
|
||||||
autoLogin="Autologueo al Iniciar",
|
|
||||||
simpMode="Modo Sencillo",
|
simpMode="Modo Sencillo",
|
||||||
},
|
},
|
||||||
setting_video={
|
setting_video={
|
||||||
@@ -686,18 +686,18 @@ return{
|
|||||||
email="Correo Elec.",
|
email="Correo Elec.",
|
||||||
password="Contraseña",
|
password="Contraseña",
|
||||||
showEmail="Mostrar Correo",
|
showEmail="Mostrar Correo",
|
||||||
keepPW="Recordar credenciales",
|
|
||||||
login="Entrar",
|
login="Entrar",
|
||||||
},
|
},
|
||||||
register={
|
register={
|
||||||
title="Registrarse",
|
title="Registrarse",
|
||||||
login="Entrar",
|
login="Entrar",
|
||||||
username="Nombre de Usuario",
|
|
||||||
email="Correo Elec.",
|
email="Correo Elec.",
|
||||||
|
-- send="Send code",
|
||||||
|
-- code="Verification Code",
|
||||||
|
-- verify="Verify",
|
||||||
password="Contraseña",
|
password="Contraseña",
|
||||||
password2="Repetir Contr.",
|
password2="Repetir Contr.",
|
||||||
register="Registrarse",
|
-- setPW="Set Password",
|
||||||
registering="Esperando respuesta...",
|
|
||||||
},
|
},
|
||||||
account={
|
account={
|
||||||
title="Cuenta",
|
title="Cuenta",
|
||||||
|
|||||||
@@ -289,6 +289,7 @@ return{
|
|||||||
Cold_Clear [MinusKelvin]
|
Cold_Clear [MinusKelvin]
|
||||||
json.lua [rxi]
|
json.lua [rxi]
|
||||||
profile.lua [itraykov]
|
profile.lua [itraykov]
|
||||||
|
sha2 [Egor Skriptunoff]
|
||||||
]],
|
]],
|
||||||
support="Aider le créateur",
|
support="Aider le créateur",
|
||||||
WidgetText={
|
WidgetText={
|
||||||
@@ -400,7 +401,6 @@ return{
|
|||||||
-- sysCursor="Use system cursor",
|
-- sysCursor="Use system cursor",
|
||||||
autoPause="Mettre en pause en cas de perte de focus",
|
autoPause="Mettre en pause en cas de perte de focus",
|
||||||
-- autoSave="Auto save new-best",
|
-- autoSave="Auto save new-best",
|
||||||
-- autoLogin="Auto Login on Start",
|
|
||||||
-- simpMode="Simple mode",
|
-- simpMode="Simple mode",
|
||||||
},
|
},
|
||||||
setting_video={
|
setting_video={
|
||||||
@@ -648,18 +648,18 @@ return{
|
|||||||
email="E-mail",
|
email="E-mail",
|
||||||
password="Mot de passe",
|
password="Mot de passe",
|
||||||
-- showEmail="Show Email",
|
-- showEmail="Show Email",
|
||||||
-- keepPW="Remember me",
|
|
||||||
login="Connexion",
|
login="Connexion",
|
||||||
},
|
},
|
||||||
register={
|
register={
|
||||||
title="Enregistrement",
|
title="Enregistrement",
|
||||||
login="Connexion",
|
login="Connexion",
|
||||||
username="Nom d'utilisateur",
|
|
||||||
email="E-mail",
|
email="E-mail",
|
||||||
|
-- send="Send code",
|
||||||
|
-- code="Verification Code",
|
||||||
|
-- verify="Verify",
|
||||||
password="Mot de passe",
|
password="Mot de passe",
|
||||||
password2="Confirmer le mot de passe",
|
password2="Confirmer le mot de passe",
|
||||||
register="Enregistrement",
|
-- setPW="Set Password",
|
||||||
-- registering="Waiting for response...",
|
|
||||||
},
|
},
|
||||||
account={
|
account={
|
||||||
title="Compte",
|
title="Compte",
|
||||||
|
|||||||
@@ -323,6 +323,7 @@ return{
|
|||||||
Cold_Clear [MinusKelvin]
|
Cold_Clear [MinusKelvin]
|
||||||
json.lua [rxi]
|
json.lua [rxi]
|
||||||
profile.lua [itraykov]
|
profile.lua [itraykov]
|
||||||
|
sha2 [Egor Skriptunoff]
|
||||||
]],
|
]],
|
||||||
support="Dukung pencipta",
|
support="Dukung pencipta",
|
||||||
WidgetText={
|
WidgetText={
|
||||||
@@ -438,7 +439,6 @@ return{
|
|||||||
sysCursor="Guna Mouse Bawaan",
|
sysCursor="Guna Mouse Bawaan",
|
||||||
autoPause="Jeda Jika Tidak Difokus",
|
autoPause="Jeda Jika Tidak Difokus",
|
||||||
autoSave="Simpan Rekor Otomatis",
|
autoSave="Simpan Rekor Otomatis",
|
||||||
autoLogin="Auto-login Saat Membuka",
|
|
||||||
simpMode="Mode Sederhana",
|
simpMode="Mode Sederhana",
|
||||||
},
|
},
|
||||||
setting_video={
|
setting_video={
|
||||||
@@ -695,18 +695,18 @@ return{
|
|||||||
email="Alamat Email",
|
email="Alamat Email",
|
||||||
password="Password",
|
password="Password",
|
||||||
showEmail="Tunjukkan Email",
|
showEmail="Tunjukkan Email",
|
||||||
keepPW="Ingat Saya",
|
|
||||||
login="Masuk",
|
login="Masuk",
|
||||||
},
|
},
|
||||||
register={
|
register={
|
||||||
title="Daftar",
|
title="Daftar",
|
||||||
login="Masuk",
|
login="Masuk",
|
||||||
username="Username",
|
|
||||||
email="Alamat Email",
|
email="Alamat Email",
|
||||||
|
-- send="Send code",
|
||||||
|
-- code="Verification Code",
|
||||||
|
-- verify="Verify",
|
||||||
password="Password",
|
password="Password",
|
||||||
password2="Ulangi Password",
|
password2="Ulangi Password",
|
||||||
register="Daftar",
|
-- setPW="Set Password",
|
||||||
registering="Menunggu respon…",
|
|
||||||
},
|
},
|
||||||
account={
|
account={
|
||||||
title="Akun",
|
title="Akun",
|
||||||
|
|||||||
@@ -324,6 +324,7 @@ return{
|
|||||||
Cold_Clear [MinusKelvin]
|
Cold_Clear [MinusKelvin]
|
||||||
json.lua [rxi]
|
json.lua [rxi]
|
||||||
profile.lua [itraykov]
|
profile.lua [itraykov]
|
||||||
|
sha2 [Egor Skriptunoff]
|
||||||
]],
|
]],
|
||||||
support="Support the Author",
|
support="Support the Author",
|
||||||
WidgetText={
|
WidgetText={
|
||||||
@@ -439,7 +440,6 @@ return{
|
|||||||
sysCursor="システムカーソル",
|
sysCursor="システムカーソル",
|
||||||
autoPause="ゲーム中断時のオートポーズ",
|
autoPause="ゲーム中断時のオートポーズ",
|
||||||
autoSave="最高得点を更新したときオートセーブ",
|
autoSave="最高得点を更新したときオートセーブ",
|
||||||
autoLogin="オートログイン",
|
|
||||||
simpMode="シンプルなホーム画面",
|
simpMode="シンプルなホーム画面",
|
||||||
},
|
},
|
||||||
setting_video={
|
setting_video={
|
||||||
@@ -696,18 +696,18 @@ return{
|
|||||||
email="Eメールアドレス",
|
email="Eメールアドレス",
|
||||||
password="パスワード",
|
password="パスワード",
|
||||||
-- showEmail="Show Email",
|
-- showEmail="Show Email",
|
||||||
keepPW="常にログイン",
|
|
||||||
login="ログイン",
|
login="ログイン",
|
||||||
},
|
},
|
||||||
register={
|
register={
|
||||||
title="サインアップ",
|
title="サインアップ",
|
||||||
login="サインイン",
|
login="サインイン",
|
||||||
username="ユーザーネーム",
|
|
||||||
email="Eメールアドレス",
|
email="Eメールアドレス",
|
||||||
|
-- send="Send code",
|
||||||
|
-- code="Verification Code",
|
||||||
|
-- verify="Verify",
|
||||||
password="パスワード",
|
password="パスワード",
|
||||||
password2="パスワード(確認)",
|
password2="パスワード(確認)",
|
||||||
register="これで登録する",
|
-- setPW="Set Password",
|
||||||
registering="応答待機中...",
|
|
||||||
},
|
},
|
||||||
account={
|
account={
|
||||||
title="アカウント",
|
title="アカウント",
|
||||||
|
|||||||
@@ -311,6 +311,7 @@ return{
|
|||||||
Cold_Clear [MinusKelvin]
|
Cold_Clear [MinusKelvin]
|
||||||
json.lua [rxi]
|
json.lua [rxi]
|
||||||
profile.lua [itraykov]
|
profile.lua [itraykov]
|
||||||
|
sha2 [Egor Skriptunoff]
|
||||||
]],
|
]],
|
||||||
support="Support author",
|
support="Support author",
|
||||||
WidgetText={
|
WidgetText={
|
||||||
@@ -426,7 +427,6 @@ return{
|
|||||||
-- sysCursor="Use system cursor",
|
-- sysCursor="Use system cursor",
|
||||||
autoPause="Pausar quando foco for perco",
|
autoPause="Pausar quando foco for perco",
|
||||||
-- autoSave="Auto save new-best",
|
-- autoSave="Auto save new-best",
|
||||||
-- autoLogin="Auto Login on Start",
|
|
||||||
-- simpMode="Simple mode",
|
-- simpMode="Simple mode",
|
||||||
},
|
},
|
||||||
setting_video={
|
setting_video={
|
||||||
@@ -684,18 +684,18 @@ return{
|
|||||||
email="Endereço De Email",
|
email="Endereço De Email",
|
||||||
password="Senha",
|
password="Senha",
|
||||||
-- showEmail="Show Email",
|
-- showEmail="Show Email",
|
||||||
-- keepPW="Remember me",
|
|
||||||
login="Log in",
|
login="Log in",
|
||||||
},
|
},
|
||||||
register={
|
register={
|
||||||
title="Registrar",
|
title="Registrar",
|
||||||
login="Log in",
|
login="Log in",
|
||||||
username="Nome De Usuário",
|
|
||||||
email="Endereço De Email",
|
email="Endereço De Email",
|
||||||
|
-- send="Send code",
|
||||||
|
-- code="Verification Code",
|
||||||
|
-- verify="Verify",
|
||||||
password="Senha",
|
password="Senha",
|
||||||
password2="Entre Senha Novamente",
|
password2="Entre Senha Novamente",
|
||||||
register="Registrar",
|
-- setPW="Set Password",
|
||||||
-- registering="Waiting for response...",
|
|
||||||
},
|
},
|
||||||
account={
|
account={
|
||||||
title="Conta",
|
title="Conta",
|
||||||
|
|||||||
@@ -242,7 +242,6 @@ return{
|
|||||||
sysCursor="?→*",
|
sysCursor="?→*",
|
||||||
autoPause="A||",
|
autoPause="A||",
|
||||||
autoSave="!!!>%",
|
autoSave="!!!>%",
|
||||||
autoLogin="#Log in#",
|
|
||||||
simpMode=".",
|
simpMode=".",
|
||||||
},
|
},
|
||||||
setting_video={
|
setting_video={
|
||||||
@@ -490,18 +489,18 @@ return{
|
|||||||
email="@",
|
email="@",
|
||||||
password="*",
|
password="*",
|
||||||
showEmail="?",
|
showEmail="?",
|
||||||
keepPW="!",
|
|
||||||
login="Log in",
|
login="Log in",
|
||||||
},
|
},
|
||||||
register={
|
register={
|
||||||
title="Sign up",
|
title="Sign up",
|
||||||
login="Log in",
|
login="Log in",
|
||||||
username="#",
|
|
||||||
email="@",
|
email="@",
|
||||||
|
send="→",
|
||||||
|
code="←",
|
||||||
|
verify="!",
|
||||||
password="*",
|
password="*",
|
||||||
password2="*",
|
password2="*",
|
||||||
register="Sign up",
|
setPW="##",
|
||||||
registering="......",
|
|
||||||
},
|
},
|
||||||
account={
|
account={
|
||||||
title="@_@",
|
title="@_@",
|
||||||
|
|||||||
@@ -323,6 +323,7 @@ return{
|
|||||||
Cold_Clear [MinusKelvin]
|
Cold_Clear [MinusKelvin]
|
||||||
json.lua [rxi]
|
json.lua [rxi]
|
||||||
profile.lua [itraykov]
|
profile.lua [itraykov]
|
||||||
|
sha2 [Egor Skriptunoff]
|
||||||
]],
|
]],
|
||||||
support="支持作者",
|
support="支持作者",
|
||||||
WidgetText={
|
WidgetText={
|
||||||
@@ -438,7 +439,6 @@ return{
|
|||||||
sysCursor="使用系统光标",
|
sysCursor="使用系统光标",
|
||||||
autoPause="失去焦点自动暂停",
|
autoPause="失去焦点自动暂停",
|
||||||
autoSave="破纪录自动保存",
|
autoSave="破纪录自动保存",
|
||||||
autoLogin="启动时自动登录",
|
|
||||||
simpMode="简洁模式",
|
simpMode="简洁模式",
|
||||||
},
|
},
|
||||||
setting_video={
|
setting_video={
|
||||||
@@ -694,18 +694,18 @@ return{
|
|||||||
email="邮箱",
|
email="邮箱",
|
||||||
password="密码",
|
password="密码",
|
||||||
showEmail="显示邮箱",
|
showEmail="显示邮箱",
|
||||||
keepPW="保存密码",
|
|
||||||
login="登录",
|
login="登录",
|
||||||
},
|
},
|
||||||
register={
|
register={
|
||||||
title="注册",
|
title="注册",
|
||||||
login="登录",
|
login="登录",
|
||||||
username="用户名",
|
|
||||||
email="邮箱:",
|
email="邮箱:",
|
||||||
|
send="发送验证码",
|
||||||
|
code="验证码",
|
||||||
|
verify="验证邮箱",
|
||||||
password="密码:",
|
password="密码:",
|
||||||
password2="确认密码:",
|
password2="确认密码:",
|
||||||
register="注册",
|
setPW="设置密码",
|
||||||
registering="等待服务器响应……",
|
|
||||||
},
|
},
|
||||||
account={
|
account={
|
||||||
title="帐户",
|
title="帐户",
|
||||||
|
|||||||
@@ -324,6 +324,7 @@ return{
|
|||||||
Cold_Clear [MinusKelvin]
|
Cold_Clear [MinusKelvin]
|
||||||
json.lua [rxi]
|
json.lua [rxi]
|
||||||
profile.lua [itraykov]
|
profile.lua [itraykov]
|
||||||
|
sha2 [Egor Skriptunoff]
|
||||||
]],
|
]],
|
||||||
support="支持作者",
|
support="支持作者",
|
||||||
WidgetText={
|
WidgetText={
|
||||||
@@ -439,7 +440,6 @@ return{
|
|||||||
sysCursor="Set.SysCursor",
|
sysCursor="Set.SysCursor",
|
||||||
autoPause="Set.AutoPause",
|
autoPause="Set.AutoPause",
|
||||||
autoSave="Set.AutoSave",
|
autoSave="Set.AutoSave",
|
||||||
autoLogin="Set.AutoLogin",
|
|
||||||
simpMode="Set.SimpMode",
|
simpMode="Set.SimpMode",
|
||||||
},
|
},
|
||||||
setting_video={
|
setting_video={
|
||||||
@@ -695,18 +695,18 @@ return{
|
|||||||
email="Email=",
|
email="Email=",
|
||||||
password="Password=",
|
password="Password=",
|
||||||
showEmail="ShowEmail",
|
showEmail="ShowEmail",
|
||||||
keepPW="KeepPassword",
|
|
||||||
login="Login();",
|
login="Login();",
|
||||||
},
|
},
|
||||||
register={
|
register={
|
||||||
title="Register.UI",
|
title="Register.UI",
|
||||||
login="Login();",
|
login="Login();",
|
||||||
username="Username=",
|
|
||||||
email="Email=",
|
email="Email=",
|
||||||
|
send="Send()",
|
||||||
|
code="V-code=",
|
||||||
|
verify="Verify()",
|
||||||
password="Password=",
|
password="Password=",
|
||||||
password2="RePassword=",
|
password2="RePassword=",
|
||||||
register="Register();",
|
setPW="SetPassword()",
|
||||||
registering="Waiting();",
|
|
||||||
},
|
},
|
||||||
account={
|
account={
|
||||||
title="Account.UI",
|
title="Account.UI",
|
||||||
|
|||||||
@@ -323,6 +323,7 @@ return{
|
|||||||
Cold_Clear [MinusKelvin]
|
Cold_Clear [MinusKelvin]
|
||||||
json.lua [rxi]
|
json.lua [rxi]
|
||||||
profile.lua [itraykov]
|
profile.lua [itraykov]
|
||||||
|
sha2 [Egor Skriptunoff]
|
||||||
]],
|
]],
|
||||||
support="支持作者",
|
support="支持作者",
|
||||||
WidgetText={
|
WidgetText={
|
||||||
@@ -438,7 +439,6 @@ return{
|
|||||||
sysCursor="使用系統光標",
|
sysCursor="使用系統光標",
|
||||||
autoPause="失去焦點時暫停",
|
autoPause="失去焦點時暫停",
|
||||||
autoSave="打破紀錄時自動保存",
|
autoSave="打破紀錄時自動保存",
|
||||||
autoLogin="啟動時自動登錄",
|
|
||||||
simpMode="簡潔模式",
|
simpMode="簡潔模式",
|
||||||
},
|
},
|
||||||
setting_video={
|
setting_video={
|
||||||
@@ -694,18 +694,18 @@ return{
|
|||||||
email="電郵",
|
email="電郵",
|
||||||
password="密碼",
|
password="密碼",
|
||||||
showEmail="顯示郵箱",
|
showEmail="顯示郵箱",
|
||||||
keepPW="保存密碼",
|
|
||||||
login="登錄",
|
login="登錄",
|
||||||
},
|
},
|
||||||
register={
|
register={
|
||||||
title="註冊",
|
title="註冊",
|
||||||
login="登錄",
|
login="登錄",
|
||||||
username="用戶名",
|
|
||||||
email="電郵",
|
email="電郵",
|
||||||
|
send="發送驗證碼",
|
||||||
|
code="驗證碼",
|
||||||
|
verify="驗證郵箱",
|
||||||
password="密碼",
|
password="密碼",
|
||||||
password2="確認密碼",
|
password2="確認密碼",
|
||||||
register="註冊",
|
setPW="設置密碼",
|
||||||
registering="等待伺服器響應……",
|
|
||||||
},
|
},
|
||||||
account={
|
account={
|
||||||
title="賬戶",
|
title="賬戶",
|
||||||
|
|||||||
690
parts/net.lua
690
parts/net.lua
@@ -76,22 +76,6 @@ local function _parse(res)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--Parse notice
|
|
||||||
local function _parseNotice(str)
|
|
||||||
if str:find("///")then
|
|
||||||
str=str:split("///")
|
|
||||||
for i=1,#str do
|
|
||||||
local m=str[i]
|
|
||||||
if m:find("=")then
|
|
||||||
str[m:sub(1,m:find("=")-1)]=m:sub(m:find("=")+1)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return str[SETTING.locale]or SETTING.locale:find'zh'and str.zh or str.en
|
|
||||||
else
|
|
||||||
return str
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--WS close message
|
--WS close message
|
||||||
local function _closeMessage(message)
|
local function _closeMessage(message)
|
||||||
local mes=JSON.decode(message)
|
local mes=JSON.decode(message)
|
||||||
@@ -102,125 +86,283 @@ local function _closeMessage(message)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--Remove player when leave
|
|
||||||
local function _removePlayer(L,sid)
|
|
||||||
for i=1,#L do
|
|
||||||
if L[i].sid==sid then
|
|
||||||
rem(L,i)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--Push stream data to players
|
|
||||||
local function _pumpStream(d)
|
--------------------------<NEW API>
|
||||||
if d.uid~=USER.uid then
|
local function getMsg(request,timeout)
|
||||||
for _,P in next,PLAYERS do
|
HTTP(request)
|
||||||
if P.uid==d.uid then
|
local totalTime=0
|
||||||
local res,stream=pcall(loveDecode,'string','base64',d.stream)
|
while true do
|
||||||
if res then
|
local mes=HTTP.pollMsg(request.pool)
|
||||||
DATA.pumpRecording(stream,P.stream)
|
if mes then
|
||||||
else
|
if type(mes.body)=='string' then
|
||||||
MES.new('error',"Bad stream from "..P.username.."#"..P.uid,.2)
|
return JSON.decode(mes.body)
|
||||||
end
|
end
|
||||||
break
|
else
|
||||||
|
totalTime=totalTime+yield()
|
||||||
|
if totalTime>timeout then
|
||||||
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
function NET.getCode(email)
|
||||||
|
if not NET.lock('getCode') then return end
|
||||||
|
TASK.new(function()
|
||||||
|
local res=getMsg({
|
||||||
|
pool='getCode',
|
||||||
|
path='/techmino/api/v1/auth/verify/email',
|
||||||
|
body={email=email},
|
||||||
|
},12.6)
|
||||||
|
|
||||||
|
if res then
|
||||||
|
if res.code==200 then
|
||||||
|
USER.email=email
|
||||||
|
SCN.fileDropped(2)
|
||||||
|
MES.new('info',"Please check your email",5)
|
||||||
|
else
|
||||||
|
MES.new('error',res.message,5)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
MES.new('error',"Time out",5)
|
||||||
|
end
|
||||||
|
|
||||||
|
WAIT.interrupt()
|
||||||
|
end)
|
||||||
|
WAIT{
|
||||||
|
quit=function()
|
||||||
|
NET.unlock('getCode')
|
||||||
|
HTTP.deletePool('getCode')
|
||||||
|
end,
|
||||||
|
timeout=12.6,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
function NET.codeLogin(code)
|
||||||
|
if not NET.lock('codeLogin') then return end
|
||||||
|
TASK.new(function()
|
||||||
|
local res=getMsg({
|
||||||
|
pool='codeLogin',
|
||||||
|
path='/techmino/api/v1/auth/login/email',
|
||||||
|
body={
|
||||||
|
email=USER.email,
|
||||||
|
code=code,
|
||||||
|
},
|
||||||
|
},6.26)
|
||||||
|
|
||||||
|
if res then
|
||||||
|
if res.code==200 then
|
||||||
|
USER.rToken=res.refreshToken
|
||||||
|
USER.aToken=res.accessToken
|
||||||
|
-- TODO: connect WS
|
||||||
|
SCN.go('net_game')
|
||||||
|
elseif res.code==201 then
|
||||||
|
USER.rToken=res.refreshToken
|
||||||
|
USER.aToken=res.accessToken
|
||||||
|
SCN.fileDropped(3)-- Not designed for this, but it works and no side effects
|
||||||
|
MES.new('info',"Please set your password",5)
|
||||||
|
else
|
||||||
|
MES.new('error',res.message,5)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
MES.new('error',"Time out",5)
|
||||||
|
end
|
||||||
|
|
||||||
|
WAIT.interrupt()
|
||||||
|
end)
|
||||||
|
WAIT{
|
||||||
|
quit=function()
|
||||||
|
NET.unlock('codeLogin')
|
||||||
|
HTTP.deletePool('codeLogin')
|
||||||
|
end,
|
||||||
|
timeout=6.26,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
function NET.setPW(code,pw)
|
||||||
|
if not NET.lock('setPW') then return end
|
||||||
|
TASK.new(function()
|
||||||
|
pw=HASH.hmac()
|
||||||
|
|
||||||
|
local res=getMsg({
|
||||||
|
pool='setPW',
|
||||||
|
method='PUT',
|
||||||
|
path='/techmino/api/v1/auth/reset/email',
|
||||||
|
body={
|
||||||
|
email=USER.email,
|
||||||
|
code=code,
|
||||||
|
newPassword=pw,
|
||||||
|
},
|
||||||
|
},6.26)
|
||||||
|
|
||||||
|
if res then
|
||||||
|
if res.code==200 then
|
||||||
|
SCN.back()
|
||||||
|
MES.new('info',"Password set! Now you can login",5)
|
||||||
|
else
|
||||||
|
MES.new('error',res.message,5)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
MES.new('error',"Time out",5)
|
||||||
|
end
|
||||||
|
|
||||||
|
WAIT.interrupt()
|
||||||
|
end)
|
||||||
|
WAIT{
|
||||||
|
quit=function()
|
||||||
|
NET.unlock('setPW')
|
||||||
|
HTTP.deletePool('setPW')
|
||||||
|
end,
|
||||||
|
timeout=6.26,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
function NET.autoLogin()
|
||||||
|
if not USER.password then
|
||||||
|
SCN.go('login')
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not NET.lock('autoLogin') then return end
|
||||||
|
TASK.new(function()
|
||||||
|
if USER.aToken then
|
||||||
|
local res=getMsg({
|
||||||
|
pool='autoLogin',
|
||||||
|
path='/techmino/api/v1/auth/check',
|
||||||
|
headers={["x-access-token"]=USER.aToken},
|
||||||
|
},6.26)
|
||||||
|
|
||||||
|
if res then
|
||||||
|
if res.code==200 then
|
||||||
|
-- TODO: connect WS
|
||||||
|
SCN.go('net_game')
|
||||||
|
WAIT.interrupt()
|
||||||
|
return
|
||||||
|
else
|
||||||
|
MES.new('warning',res.message,5)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
WAIT.interrupt()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if USER.rToken then
|
||||||
|
local res=getMsg({
|
||||||
|
pool='autoLogin',
|
||||||
|
path='/techmino/api/v1/auth/refresh',
|
||||||
|
headers={["x-refresh-token"]=USER.rToken},
|
||||||
|
},6.26)
|
||||||
|
|
||||||
|
if res then
|
||||||
|
if res.code==200 then
|
||||||
|
USER.rToken=res.refreshToken
|
||||||
|
USER.aToken=res.accessToken
|
||||||
|
-- TODO: connect WS
|
||||||
|
MES.new('info',"Login successed",5)
|
||||||
|
SCN.go('net_game')
|
||||||
|
WAIT.interrupt()
|
||||||
|
return
|
||||||
|
else
|
||||||
|
MES.new('warning',res.message,5)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
WAIT.interrupt()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if USER.password then
|
||||||
|
local res=getMsg({
|
||||||
|
pool='pwLogin',
|
||||||
|
path='/techmino/api/v1/auth/login/email',
|
||||||
|
body={
|
||||||
|
email=USER.email,
|
||||||
|
password=USER.password,
|
||||||
|
},
|
||||||
|
},6.26)
|
||||||
|
if res then
|
||||||
|
if res.code==200 then
|
||||||
|
USER.rToken=res.refreshToken
|
||||||
|
USER.aToken=res.accessToken
|
||||||
|
-- TODO: connect WS
|
||||||
|
MES.new('info',"Login successed",5)
|
||||||
|
SCN.go('net_game')
|
||||||
|
WAIT.interrupt()
|
||||||
|
return
|
||||||
|
else
|
||||||
|
MES.new('warning',res.message,5)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
WAIT.interrupt()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
SCN.go('login')
|
||||||
|
WAIT.interrupt()
|
||||||
|
end)
|
||||||
|
WAIT{
|
||||||
|
quit=function()
|
||||||
|
NET.unlock('autoLogin')
|
||||||
|
HTTP.deletePool('autoLogin')
|
||||||
|
end,
|
||||||
|
timeout=12.6,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
function NET.pwLogin(email,pw)
|
||||||
|
if not NET.lock('pwLogin') then return end
|
||||||
|
TASK.new(function()
|
||||||
|
pw=STRING.digezt(pw)
|
||||||
|
|
||||||
|
local res=getMsg({
|
||||||
|
pool='pwLogin',
|
||||||
|
path='/techmino/api/v1/auth/login/email',
|
||||||
|
body={
|
||||||
|
email=email,
|
||||||
|
password=pw,
|
||||||
|
},
|
||||||
|
},6.26)
|
||||||
|
|
||||||
|
if res then
|
||||||
|
if res.code==200 then
|
||||||
|
USER.email=email
|
||||||
|
USER.password=pw
|
||||||
|
USER.rToken=res.refreshToken
|
||||||
|
USER.aToken=res.accessToken
|
||||||
|
-- TODO: connect WS
|
||||||
|
SCN.go('net_game')
|
||||||
|
else
|
||||||
|
MES.new('error',res.message,5)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
MES.new('error',"Time out",5)
|
||||||
|
end
|
||||||
|
|
||||||
|
WAIT.interrupt()
|
||||||
|
end)
|
||||||
|
WAIT{
|
||||||
|
quit=function()
|
||||||
|
NET.unlock('pwLogin')
|
||||||
|
HTTP.deletePool('pwLogin')
|
||||||
|
end,
|
||||||
|
timeout=12.6,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
--------------------------</NEW API>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--Connect
|
--Connect
|
||||||
function NET.wsconn_app()
|
function NET.wsconn()
|
||||||
if WS.status('app')=='dead'then
|
|
||||||
WS.connect('app','/app',nil,6)
|
|
||||||
TASK.new(NET.updateWS_app)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function NET.wsconn_user_pswd(email,password)
|
|
||||||
if WS.status('user')=='dead'then
|
|
||||||
WS.connect('user','/user',JSON.encode{
|
|
||||||
email=email,
|
|
||||||
password=password,
|
|
||||||
},6)
|
|
||||||
TASK.new(NET.updateWS_user)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function NET.wsconn_user_token(uid,authToken)
|
|
||||||
if WS.status('user')=='dead'then
|
|
||||||
WS.connect('user','/user',JSON.encode{
|
|
||||||
uid=uid,
|
|
||||||
authToken=authToken,
|
|
||||||
},6)
|
|
||||||
TASK.new(NET.updateWS_user)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function NET.wsconn_play()
|
|
||||||
if WS.status('play')=='dead'then
|
|
||||||
WS.connect('play','/play',JSON.encode{
|
|
||||||
uid=USER.uid,
|
|
||||||
accessToken=NET.accessToken,
|
|
||||||
},6)
|
|
||||||
TASK.new(NET.updateWS_play)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function NET.wsconn_stream(srid)
|
|
||||||
if WS.status('stream')=='dead'then
|
if WS.status('stream')=='dead'then
|
||||||
NET.roomState.start=true
|
NET.roomState.start=true
|
||||||
WS.connect('stream','/stream',JSON.encode{
|
WS.connect('stream','/stream',JSON.encode{
|
||||||
uid=USER.uid,
|
accessToken=USER.aToken,
|
||||||
accessToken=NET.accessToken,
|
|
||||||
srid=srid,
|
|
||||||
},6)
|
},6)
|
||||||
TASK.new(NET.updateWS_stream)
|
TASK.new(NET.updateWS_stream)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function NET.wsconn_manage()
|
|
||||||
if WS.status('manage')=='dead'then
|
|
||||||
WS.connect('manage','/manage',JSON.encode{
|
|
||||||
uid=USER.uid,
|
|
||||||
authToken=USER.authToken,
|
|
||||||
},6)
|
|
||||||
TASK.new(NET.updateWS_manage)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--Disconnect
|
--Disconnect
|
||||||
function NET.wsclose_app()WS.close('app')end
|
function NET.wsclose()
|
||||||
function NET.wsclose_user()WS.close('user')end
|
-- WS.close()
|
||||||
function NET.wsclose_play()WS.close('play')end
|
|
||||||
function NET.wsclose_stream()
|
|
||||||
NET.roomState.start=false
|
|
||||||
WS.close('stream')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--Account & User
|
--Account & User
|
||||||
function NET.register(username,email,password)
|
|
||||||
if NET.lock('register')then
|
|
||||||
WS.send('app',JSON.encode{
|
|
||||||
action=2,
|
|
||||||
data={
|
|
||||||
username=username,
|
|
||||||
email=email,
|
|
||||||
password=password,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
MES.new('info',text.registerRequestSent)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function NET.tryLogin(ifAuto)
|
|
||||||
if NET.allow_online then
|
|
||||||
if WS.status('user')=='running'then
|
|
||||||
if NET.lock('access_and_login',8)then
|
|
||||||
WS.send('user',JSON.encode{action=0})
|
|
||||||
end
|
|
||||||
elseif not ifAuto then
|
|
||||||
SCN.go('login')
|
|
||||||
end
|
|
||||||
else
|
|
||||||
TEXT.show(text.needUpdate,640,450,60,'flicker')
|
|
||||||
SFX.play('finesseError')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function NET.getUserInfo(uid)
|
function NET.getUserInfo(uid)
|
||||||
WS.send('user',JSON.encode{
|
WS.send('user',JSON.encode{
|
||||||
action=1,
|
action=1,
|
||||||
@@ -389,62 +531,6 @@ function NET.freshPlayerCount()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function NET.updateWS_app()
|
|
||||||
while WS.status('app')~='dead'do
|
|
||||||
yield()
|
|
||||||
local message,op=WS.read('app')
|
|
||||||
if message then
|
|
||||||
if op=='ping'then
|
|
||||||
elseif op=='pong'then
|
|
||||||
elseif op=='close'then
|
|
||||||
_closeMessage(message)
|
|
||||||
return
|
|
||||||
else
|
|
||||||
local res=_parse(message)
|
|
||||||
if res then
|
|
||||||
if res.type=='Connect'then
|
|
||||||
if VERSION.code>=res.lowest then
|
|
||||||
NET.allow_online=true
|
|
||||||
if USER.authToken then
|
|
||||||
NET.wsconn_user_token(USER.uid,USER.authToken)
|
|
||||||
elseif SCN.cur=='main'then
|
|
||||||
SCN.go('login')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if VERSION.code<res.newestCode then
|
|
||||||
MES.new('warn',text.oldVersion:gsub("$1",res.newestName),3)
|
|
||||||
end
|
|
||||||
MES.new('broadcast',_parseNotice(res.notice),5)
|
|
||||||
NET.tryLogin(true)
|
|
||||||
TASK.new(NET.freshPlayerCount)
|
|
||||||
elseif res.action==0 then--Broadcast
|
|
||||||
MES.new('broadcast',res.data.message,5)
|
|
||||||
elseif res.action==1 then--Get notice
|
|
||||||
--?
|
|
||||||
elseif res.action==2 then--Register
|
|
||||||
if res.type=='Self'or res.type=='Server'then
|
|
||||||
MES.new('info',res.data.message,5)
|
|
||||||
if SCN.cur=='register'then
|
|
||||||
SCN.back()
|
|
||||||
end
|
|
||||||
else
|
|
||||||
MES.new('warn',res.reason or"Registration failed",5)
|
|
||||||
end
|
|
||||||
NET.unlock('register')
|
|
||||||
elseif res.action==3 then--Get player counts
|
|
||||||
NET.UserCount=res.data.User
|
|
||||||
NET.PlayCount=res.data.Play
|
|
||||||
NET.StreamCount=res.data.Stream
|
|
||||||
--res.data.Chat
|
|
||||||
NET.unlock('freshPlayerCount')
|
|
||||||
end
|
|
||||||
else
|
|
||||||
WS.alert('app')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function NET.updateWS_user()
|
function NET.updateWS_user()
|
||||||
while WS.status('user')~='dead'do
|
while WS.status('user')~='dead'do
|
||||||
yield()
|
yield()
|
||||||
@@ -493,265 +579,5 @@ function NET.updateWS_user()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function NET.updateWS_play()
|
|
||||||
while WS.status('play')~='dead'do
|
|
||||||
yield()
|
|
||||||
local message,op=WS.read('play')
|
|
||||||
if message then
|
|
||||||
if op=='ping'then
|
|
||||||
elseif op=='pong'then
|
|
||||||
elseif op=='close'then
|
|
||||||
_closeMessage(message)
|
|
||||||
return
|
|
||||||
else
|
|
||||||
local res=_parse(message)
|
|
||||||
if res then
|
|
||||||
local d=res.data
|
|
||||||
if res.type=='Connect'then
|
|
||||||
SCN.go('net_menu')
|
|
||||||
NET.unlock('wsc_play')
|
|
||||||
NET.unlock('access_and_login')
|
|
||||||
SFX.play('connected')
|
|
||||||
elseif res.action==0 then--Fetch rooms
|
|
||||||
if SCN.cur=="net_rooms"then
|
|
||||||
WIDGET.active.roomList:setList(res.roomList)
|
|
||||||
end
|
|
||||||
NET.unlock('fetchRoom')
|
|
||||||
elseif res.action==1 then--Create room (not used)
|
|
||||||
--?
|
|
||||||
elseif res.action==2 then--Player join
|
|
||||||
if res.type=='Self'then
|
|
||||||
--Enter new room
|
|
||||||
NETPLY.clear()
|
|
||||||
if d.players then
|
|
||||||
for _,p in next,d.players do
|
|
||||||
NETPLY.add{
|
|
||||||
uid=p.uid,
|
|
||||||
username=p.username,
|
|
||||||
sid=p.sid,
|
|
||||||
mode=p.mode,
|
|
||||||
config=p.config,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
NET.roomState.roomInfo=d.roomInfo
|
|
||||||
NET.roomState.roomData=d.roomData
|
|
||||||
NET.roomState.count=d.count
|
|
||||||
NET.roomState.capacity=d.capacity
|
|
||||||
NET.roomState.private=d.private
|
|
||||||
NET.roomState.start=d.start
|
|
||||||
|
|
||||||
NET.roomReadyState=false
|
|
||||||
|
|
||||||
NET.spectate=false
|
|
||||||
|
|
||||||
if d.srid then
|
|
||||||
NET.spectate=true
|
|
||||||
NET.specSRID=d.srid
|
|
||||||
NET.roomReadyState='connecting'
|
|
||||||
end
|
|
||||||
loadGame('netBattle',true,true)
|
|
||||||
else
|
|
||||||
--Load other players
|
|
||||||
NETPLY.add{
|
|
||||||
uid=d.uid,
|
|
||||||
username=d.username,
|
|
||||||
sid=d.sid,
|
|
||||||
mode=d.mode,
|
|
||||||
config=d.config,
|
|
||||||
}
|
|
||||||
if SCN.cur=='net_game'then
|
|
||||||
SCN.socketRead('join',d)
|
|
||||||
end
|
|
||||||
if NET.roomReadyState=='allReady'then
|
|
||||||
NET.roomReadyState=false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
elseif res.action==3 then--Player leave
|
|
||||||
if not d.uid then
|
|
||||||
NET.wsclose_stream()
|
|
||||||
NET.unlock('quit')
|
|
||||||
if SCN.stack[#SCN.stack-1]=='net_newRoom'then
|
|
||||||
SCN.pop()
|
|
||||||
end
|
|
||||||
SCN.back()
|
|
||||||
else
|
|
||||||
NETPLY.remove(d.sid)
|
|
||||||
_removePlayer(PLAYERS,d.sid)
|
|
||||||
_removePlayer(PLY_ALIVE,d.sid)
|
|
||||||
if SCN.cur=='net_game'then
|
|
||||||
SCN.socketRead('leave',d)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
elseif res.action==4 then--Player talk
|
|
||||||
if SCN.cur=='net_game'then
|
|
||||||
SCN.socketRead('talk',d)
|
|
||||||
end
|
|
||||||
elseif res.action==5 then--Player change settings
|
|
||||||
NETPLY.setConf(d.uid,d.config)
|
|
||||||
elseif res.action==6 then--Player change join mode
|
|
||||||
NETPLY.setJoinMode(d.uid,d.mode)
|
|
||||||
elseif res.action==7 then--All Ready
|
|
||||||
SFX.play('reach',.6)
|
|
||||||
NET.roomReadyState='allReady'
|
|
||||||
elseif res.action==8 then--Set
|
|
||||||
NET.roomReadyState='connecting'
|
|
||||||
NET.wsconn_stream(d.srid)
|
|
||||||
elseif res.action==9 then--Game finished
|
|
||||||
if SCN.cur=='net_game'then
|
|
||||||
SCN.socketRead('finish',d)
|
|
||||||
end
|
|
||||||
|
|
||||||
--d.result: list of {place,survivalTime,uid,score}
|
|
||||||
for _,p in next,d.result do
|
|
||||||
for _,P in next,PLAYERS do
|
|
||||||
if P.uid==p.uid then
|
|
||||||
NETPLY.setStat(p.uid,P.stat)
|
|
||||||
NETPLY.setPlace(p.uid,p.place)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
NETPLY.resetState()
|
|
||||||
NETPLY.freshPos()
|
|
||||||
NET.roomState.start=false
|
|
||||||
if NET.spectate then
|
|
||||||
NET.signal_setMode(2)
|
|
||||||
end
|
|
||||||
NET.spectate=false
|
|
||||||
NET.wsclose_stream()
|
|
||||||
end
|
|
||||||
else
|
|
||||||
WS.alert('play')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function NET.updateWS_stream()
|
|
||||||
while WS.status('stream')~='dead'do
|
|
||||||
yield()
|
|
||||||
local message,op=WS.read('stream')
|
|
||||||
if message then
|
|
||||||
if op=='ping'then
|
|
||||||
elseif op=='pong'then
|
|
||||||
elseif op=='close'then
|
|
||||||
_closeMessage(message)
|
|
||||||
return
|
|
||||||
else
|
|
||||||
local res=_parse(message)
|
|
||||||
if res then
|
|
||||||
local d=res.data
|
|
||||||
if res.type=='Connect'then
|
|
||||||
NET.unlock('wsc_stream')
|
|
||||||
NET.roomReadyState=false
|
|
||||||
elseif res.action==0 then--Game start
|
|
||||||
NET.roomReadyState=false
|
|
||||||
SCN.socketRead('go')
|
|
||||||
elseif res.action==1 then--Game finished
|
|
||||||
--?
|
|
||||||
elseif res.action==2 then--Player join
|
|
||||||
if res.type=='Self'then
|
|
||||||
NET.seed=d.seed
|
|
||||||
NET.spectate=d.spectate
|
|
||||||
NETPLY.setConnect(d.uid)
|
|
||||||
for _,p in next,d.connected do
|
|
||||||
if not p.spectate then
|
|
||||||
NETPLY.setConnect(p.uid)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if d.spectate then
|
|
||||||
if d.start then
|
|
||||||
SCN.socketRead('go')
|
|
||||||
if d.history then
|
|
||||||
for _,v in next,d.history do
|
|
||||||
_pumpStream(v)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
NET.roomReadyState='waitConn'
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if d.spectate then
|
|
||||||
NETPLY.setJoinMode(d.uid,2)
|
|
||||||
else
|
|
||||||
NETPLY.setConnect(d.uid)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
elseif res.action==3 then--Player leave
|
|
||||||
--?
|
|
||||||
elseif res.action==4 then--Player died
|
|
||||||
for _,P in next,PLY_ALIVE do
|
|
||||||
if P.uid==d.uid then
|
|
||||||
P:lose(true)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
elseif res.action==5 then--Receive stream
|
|
||||||
_pumpStream(d)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
WS.alert('stream')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function NET.updateWS_chat()
|
|
||||||
while WS.status('chat')~='dead'do
|
|
||||||
yield()
|
|
||||||
local message,op=WS.read('chat')
|
|
||||||
if message then
|
|
||||||
if op=='ping'then
|
|
||||||
elseif op=='pong'then
|
|
||||||
elseif op=='close'then
|
|
||||||
_closeMessage(message)
|
|
||||||
return
|
|
||||||
else
|
|
||||||
local res=_parse(message)
|
|
||||||
if res then
|
|
||||||
--TODO
|
|
||||||
else
|
|
||||||
WS.alert('chat')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function NET.updateWS_manage()
|
|
||||||
while WS.status('manage')~='dead'do
|
|
||||||
yield()
|
|
||||||
local message,op=WS.read('manage')
|
|
||||||
if message then
|
|
||||||
if op=='ping'then
|
|
||||||
elseif op=='pong'then
|
|
||||||
elseif op=='close'then
|
|
||||||
_closeMessage(message)
|
|
||||||
return
|
|
||||||
else
|
|
||||||
local res=_parse(message)
|
|
||||||
if res then
|
|
||||||
if res.type=='Connect'then
|
|
||||||
MES.new('check',"Manage connected")
|
|
||||||
elseif res.action==0 then
|
|
||||||
MES.new('check',"success")
|
|
||||||
elseif res.action==9 then
|
|
||||||
MES.new('check',"success")
|
|
||||||
elseif res.action==10 then
|
|
||||||
MES.new('info',TABLE.dump(res.data))
|
|
||||||
elseif res.action==11 then
|
|
||||||
MES.new('info',TABLE.dump(res.data))
|
|
||||||
elseif res.action==12 then
|
|
||||||
MES.new('info',TABLE.dump(res.data))
|
|
||||||
end
|
|
||||||
else
|
|
||||||
WS.alert('manage')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return NET
|
return NET
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ function scene.draw()
|
|||||||
|
|
||||||
--Lib used
|
--Lib used
|
||||||
setFont(15)
|
setFont(15)
|
||||||
gc.print(text.used,495,462)--❤Flandre❤
|
gc.print(text.used,495,426)--❤Flandre❤
|
||||||
|
|
||||||
--Logo
|
--Logo
|
||||||
gc.draw(TEXTURE.title,280,610,.1,.4+.03*sin(TIME()*2.6),nil,580,118)
|
gc.draw(TEXTURE.title,280,610,.1,.4+.03*sin(TIME()*2.6),nil,580,118)
|
||||||
|
|||||||
@@ -9,10 +9,7 @@ function scene.sceneInit()
|
|||||||
sysAndScn=SYSTEM.."-"..VERSION.string.." scene:"..Z.getErr('#').scene
|
sysAndScn=SYSTEM.."-"..VERSION.string.." scene:"..Z.getErr('#').scene
|
||||||
errorText=LOADED and text.errorMsg or"An error has occurred while the game was loading.\nAn error log has been created so you can send it to the author."
|
errorText=LOADED and text.errorMsg or"An error has occurred while the game was loading.\nAn error log has been created so you can send it to the author."
|
||||||
errorShot,errorInfo=Z.getErr('#').shot,Z.getErr('#').mes
|
errorShot,errorInfo=Z.getErr('#').shot,Z.getErr('#').mes
|
||||||
NET.wsclose_app()
|
NET.wsclose()
|
||||||
NET.wsclose_user()
|
|
||||||
NET.wsclose_play()
|
|
||||||
NET.wsclose_stream()
|
|
||||||
if SETTING then
|
if SETTING then
|
||||||
SFX.fplay('error',SETTING.voc*.8 or 0)
|
SFX.fplay('error',SETTING.voc*.8 or 0)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -100,11 +100,6 @@ local loadingThread=coroutine.wrap(function()
|
|||||||
YIELD('loadOther')
|
YIELD('loadOther')
|
||||||
STAT.run=STAT.run+1
|
STAT.run=STAT.run+1
|
||||||
|
|
||||||
--Connect to server
|
|
||||||
if SETTING.autoLogin then
|
|
||||||
NET.wsconn_app()
|
|
||||||
end
|
|
||||||
|
|
||||||
SFX.play('enter',.8)
|
SFX.play('enter',.8)
|
||||||
SFX.play('welcome')
|
SFX.play('welcome')
|
||||||
VOC.play('welcome')
|
VOC.play('welcome')
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
local emailBox=WIDGET.newInputBox{name='email',x=380,y=200,w=500,h=60,limit=128}
|
local emailBox=WIDGET.newInputBox{name='email',x=380,y=200,w=500,h=60,limit=128}
|
||||||
local passwordBox=WIDGET.newInputBox{name='password',x=380,y=300,w=620,h=60,secret=true,regex="[ -~]",limit=64}
|
local passwordBox=WIDGET.newInputBox{name='password',x=380,y=300,w=620,h=60,secret=true,regex="[ -~]",limit=64}
|
||||||
|
|
||||||
local savePW=false
|
|
||||||
local showEmail=true
|
local showEmail=true
|
||||||
|
|
||||||
local function _login()
|
local function _login()
|
||||||
@@ -12,25 +11,16 @@ local function _login()
|
|||||||
MES.new('error',text.noPassword)return
|
MES.new('error',text.noPassword)return
|
||||||
end
|
end
|
||||||
-- password=STRING.digezt(password)
|
-- password=STRING.digezt(password)
|
||||||
NET.wsconn_user_pswd(email,password)
|
NET.pwLogin(email,password)
|
||||||
if savePW then
|
|
||||||
saveFile({email,password},'conf/account')
|
|
||||||
else
|
|
||||||
love.filesystem.remove('conf/account')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local scene={}
|
local scene={}
|
||||||
|
|
||||||
function scene.sceneInit()
|
function scene.sceneInit()
|
||||||
local data=loadFile('conf/account','-canSkip')
|
showEmail=false
|
||||||
if data then
|
emailBox.secret=true
|
||||||
savePW=true
|
emailBox:setText(USER.email)
|
||||||
showEmail=false
|
passwordBox:setText(USER.password)
|
||||||
emailBox.secret=true
|
|
||||||
emailBox:setText(data[1])
|
|
||||||
passwordBox:setText(data[2])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
scene.widgetList={
|
scene.widgetList={
|
||||||
@@ -39,7 +29,6 @@ scene.widgetList={
|
|||||||
emailBox,
|
emailBox,
|
||||||
passwordBox,
|
passwordBox,
|
||||||
WIDGET.newSwitch{name='showEmail',x=550, y=420,disp=function()return showEmail end,code=function()showEmail=not showEmail emailBox.secret=not showEmail end},
|
WIDGET.newSwitch{name='showEmail',x=550, y=420,disp=function()return showEmail end,code=function()showEmail=not showEmail emailBox.secret=not showEmail end},
|
||||||
WIDGET.newSwitch{name='keepPW', x=900, y=420,disp=function()return savePW end,code=function()savePW=not savePW end},
|
|
||||||
WIDGET.newKey{name='login', x=1140,y=540,w=170,h=80,font=40,code=_login},
|
WIDGET.newKey{name='login', x=1140,y=540,w=170,h=80,font=40,code=_login},
|
||||||
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=backScene},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,14 +47,10 @@ function scene.mouseDown(x,y)
|
|||||||
end
|
end
|
||||||
scene.touchDown=scene.mouseDown
|
scene.touchDown=scene.mouseDown
|
||||||
local function _testButton(n)
|
local function _testButton(n)
|
||||||
if NET.getlock('access_and_login')then
|
if WIDGET.isFocus(scene.widgetList[n])then
|
||||||
MES.new('warn',text.wsConnecting)
|
return true
|
||||||
else
|
else
|
||||||
if WIDGET.isFocus(scene.widgetList[n])then
|
WIDGET.focus(scene.widgetList[n])
|
||||||
return true
|
|
||||||
else
|
|
||||||
WIDGET.focus(scene.widgetList[n])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function scene.keyDown(key,isRep)
|
function scene.keyDown(key,isRep)
|
||||||
@@ -69,13 +65,7 @@ function scene.keyDown(key,isRep)
|
|||||||
end
|
end
|
||||||
elseif key=='a'then
|
elseif key=='a'then
|
||||||
if _testButton(3)then
|
if _testButton(3)then
|
||||||
if WS.status('app')=='running'then
|
NET.autoLogin()
|
||||||
NET.tryLogin(false)
|
|
||||||
elseif WS.status('app')=='dead'then
|
|
||||||
NET.wsconn_app()
|
|
||||||
SFX.play('connect')
|
|
||||||
MES.new('info',text.wsConnecting)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
elseif key=='z'then
|
elseif key=='z'then
|
||||||
if _testButton(4)then
|
if _testButton(4)then
|
||||||
@@ -173,14 +163,6 @@ function scene.draw()
|
|||||||
|
|
||||||
--Player count
|
--Player count
|
||||||
drawOnlinePlayerCount()
|
drawOnlinePlayerCount()
|
||||||
|
|
||||||
--Connecting mark
|
|
||||||
if NET.getlock('access_and_login')then
|
|
||||||
GC.setColor(COLOR.Z)
|
|
||||||
GC.setLineWidth(10)
|
|
||||||
local t=TIME()*6.26%6.2832
|
|
||||||
GC.arc('line','open',scene.widgetList[3].x+865,450,40,t,t+4.26)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
scene.widgetList={
|
scene.widgetList={
|
||||||
|
|||||||
@@ -1,34 +1,90 @@
|
|||||||
local scene={}
|
local scene={}
|
||||||
|
|
||||||
local function _register()
|
local state
|
||||||
local username= WIDGET.active.username:getText()
|
local code
|
||||||
local email= WIDGET.active.email:getText()
|
|
||||||
|
local function _getCode()
|
||||||
|
local email=WIDGET.active.email:getText()
|
||||||
|
if not STRING.simpEmailCheck(email)then
|
||||||
|
MES.new('error',text.wrongEmail)
|
||||||
|
else
|
||||||
|
NET.getCode(email)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function _codeLogin()
|
||||||
|
code=WIDGET.active.code:getText():upper()
|
||||||
|
if #code~=8 then
|
||||||
|
MES.new('error',"Wrong code length")
|
||||||
|
else
|
||||||
|
NET.codeLogin(code)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function _setPW()
|
||||||
local password= WIDGET.active.password:getText()
|
local password= WIDGET.active.password:getText()
|
||||||
local password2=WIDGET.active.password2:getText()
|
local password2=WIDGET.active.password2:getText()
|
||||||
if #username==0 then
|
if #password==0 or #password2==0 then
|
||||||
MES.new('error',text.noUsername)return
|
MES.new('error',text.noPassword)
|
||||||
elseif not STRING.simpEmailCheck(email)then
|
|
||||||
MES.new('error',text.wrongEmail)return
|
|
||||||
elseif #password==0 or #password2==0 then
|
|
||||||
MES.new('error',text.noPassword)return
|
|
||||||
elseif password~=password2 then
|
elseif password~=password2 then
|
||||||
MES.new('error',text.diffPassword)return
|
MES.new('error',text.diffPassword)
|
||||||
|
else
|
||||||
|
NET.setPW(code,password)
|
||||||
end
|
end
|
||||||
NET.register(username,email,password)
|
end
|
||||||
|
|
||||||
|
function scene.sceneInit()
|
||||||
|
state=1
|
||||||
|
scene.fileDropped(state)
|
||||||
|
end
|
||||||
|
|
||||||
|
function scene.keyDown(key,rep)
|
||||||
|
if key=='escape' and not rep then
|
||||||
|
if state==1 then
|
||||||
|
SCN.back()
|
||||||
|
else
|
||||||
|
scene.fileDropped(state-1)
|
||||||
|
end
|
||||||
|
elseif key=='return' then
|
||||||
|
if state==1 then
|
||||||
|
_getCode()
|
||||||
|
elseif state==2 then
|
||||||
|
_codeLogin()
|
||||||
|
elseif state==3 then
|
||||||
|
_setPW()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function scene.fileDropped(arg)-- Not designed for this, but it works and no side effects
|
||||||
|
if type(arg)~='number' then return end
|
||||||
|
state=arg
|
||||||
|
scene.widgetList.email. hide=arg~=1
|
||||||
|
scene.widgetList.send. hide=arg~=1
|
||||||
|
scene.widgetList.code. hide=arg~=2
|
||||||
|
scene.widgetList.verify. hide=arg~=2
|
||||||
|
scene.widgetList.password. hide=arg~=3
|
||||||
|
scene.widgetList.password2. hide=arg~=3
|
||||||
|
scene.widgetList.setPW. hide=arg~=3
|
||||||
end
|
end
|
||||||
|
|
||||||
scene.widgetList={
|
scene.widgetList={
|
||||||
WIDGET.newText{name='title', x=80, y=50,font=70,align='L'},
|
WIDGET.newText{name='title', x=80, y=50,font=70,align='L'},
|
||||||
WIDGET.newButton{name='login', x=1140,y=100,w=170,h=80,color='lY',code=function()SCN.swapTo('login','swipeL')end},
|
WIDGET.newButton{name='login', x=1140,y=100,w=170,h=80,color='lY',code=function()SCN.swapTo('login','swipeL')end},
|
||||||
WIDGET.newInputBox{name='username', x=380, y=200,w=500,h=60,regex="[0-9A-Za-z_]",limit=64},
|
|
||||||
WIDGET.newInputBox{name='email', x=380, y=300,w=626,h=60,limit=128},
|
WIDGET.newInputBox{name='email', x=380, y=300,w=626,h=60,limit=128},
|
||||||
WIDGET.newInputBox{name='password', x=380, y=400,w=626,h=60,secret=true,regex="[ -~]",limit=64},
|
WIDGET.newKey{name='send', x=640, y=430,w=250,h=80,font=40,code=_getCode},
|
||||||
WIDGET.newInputBox{name='password2',x=380, y=500,w=626,h=60,secret=true,regex="[ -~]",limit=64},
|
|
||||||
|
|
||||||
WIDGET.newKey{name='register', x=640, y=640,w=300,h=80,font=40,code=_register,hideF=function()return NET.getlock('register')end},
|
WIDGET.newInputBox{name='code', x=380, y=300,w=626,h=60,limit=8},
|
||||||
WIDGET.newText{name='registering', x=640, y=605,font=50,hideF=function()return not NET.getlock('register')end},
|
WIDGET.newKey{name='verify', x=640, y=430,w=300,h=80,font=40,code=_codeLogin},
|
||||||
|
|
||||||
WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene},
|
WIDGET.newInputBox{name='password', x=380, y=250,w=626,h=60,secret=true,regex="[ -~]",limit=64},
|
||||||
|
WIDGET.newInputBox{name='password2',x=380, y=350,w=626,h=60,secret=true,regex="[ -~]",limit=64},
|
||||||
|
WIDGET.newKey{name='setPW', x=640, y=480,w=350,h=80,font=40,code=_setPW},
|
||||||
|
|
||||||
|
WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=pressKey'escape'},
|
||||||
}
|
}
|
||||||
|
|
||||||
return scene
|
return scene
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ scene.widgetList={
|
|||||||
WIDGET.newSwitch{name='sysCursor',x=1060, y=400, lim=580, disp=SETval('sysCursor'),code=function()SETTING.sysCursor=not SETTING.sysCursor applySettings()end},
|
WIDGET.newSwitch{name='sysCursor',x=1060, y=400, lim=580, disp=SETval('sysCursor'),code=function()SETTING.sysCursor=not SETTING.sysCursor applySettings()end},
|
||||||
WIDGET.newSwitch{name='autoPause',x=1060, y=470, lim=580, disp=SETval('autoPause'),code=SETrev('autoPause')},
|
WIDGET.newSwitch{name='autoPause',x=1060, y=470, lim=580, disp=SETval('autoPause'),code=SETrev('autoPause')},
|
||||||
WIDGET.newSwitch{name='autoSave', x=1060, y=540, lim=580, disp=SETval('autoSave'), code=SETrev('autoSave')},
|
WIDGET.newSwitch{name='autoSave', x=1060, y=540, lim=580, disp=SETval('autoSave'), code=SETrev('autoSave')},
|
||||||
WIDGET.newSwitch{name='autoLogin',x=960, y=610, lim=480, disp=SETval('autoLogin'),code=SETrev('autoLogin')},
|
|
||||||
WIDGET.newSwitch{name='simpMode', x=960, y=670, lim=480, disp=SETval('simpMode'),
|
WIDGET.newSwitch{name='simpMode', x=960, y=670, lim=480, disp=SETval('simpMode'),
|
||||||
code=function()
|
code=function()
|
||||||
SETTING.simpMode=not SETTING.simpMode
|
SETTING.simpMode=not SETTING.simpMode
|
||||||
|
|||||||
Reference in New Issue
Block a user