Compare commits

...

15 Commits

Author SHA1 Message Date
MrZ626
b7ee5e771e 完善0.14.2更新日志 2021-04-11 13:55:36 +08:00
MrZ626
4967782464 减少一个ws库debug开启后可能输出的信息 2021-04-11 13:37:23 +08:00
MrZ626
29582469d2 成功登录后不再尝试清除登录界面的输入框 2021-04-11 13:36:57 +08:00
MrZ626
18c1c9c69a 重新启用注册菜单 2021-04-11 13:36:04 +08:00
MrZ626
ed3521cc53 添加0.14.2版本号和版本说明 2021-04-11 02:23:14 +08:00
MrZ626
4795d77e84 整理代码(远程玩家录像播放) 2021-04-11 02:19:02 +08:00
MrZ626
e0c594c402 攻击特效从全局改为玩家设置项一部分 2021-04-11 02:18:01 +08:00
MrZ626
5f02042124 微调联网游戏房间内ui 2021-04-11 01:57:03 +08:00
MrZ626
4b09023b21 修改词典的techmino词条,加上联网功能说明 2021-04-11 01:52:45 +08:00
MrZ626
320197198b 整理代码 2021-04-11 01:50:52 +08:00
MrZ626
d31423d91e 删除马拉松模式忘了删的测试代码 2021-04-10 23:00:23 +08:00
MrZ626
23bb6ac486 对战传输的玩家配置信息格式简化和修复一个问题(未使用所以从未触发) 2021-04-10 22:24:38 +08:00
MrZ626
7da178c5ec 减少联网玩家传输的设置项 2021-04-10 22:14:19 +08:00
MrZ626
1fe9d2598b 联网推进(修复尝试保存用户信息时错误) 2021-04-10 21:07:26 +08:00
MrZ626
9f56948f47 移除进入已经开始游戏的房间时弹出的提示 2021-04-10 18:33:42 +08:00
22 changed files with 128 additions and 110 deletions

View File

@@ -151,7 +151,6 @@ while true do--Running
--Receive data
local s,_,p=SOCK:receive(length)
if s then
]]..(debug==1 and""or"--")..[[print(("%s[%d]:%s"):format(threadName,length,s))
res=s
elseif p then--UNF head
]]..(debug==1 and""or"--")..[[print(("%s[%d/%d]:%s"):format(threadName,#p,length,p))

View File

@@ -1,7 +1,7 @@
VERSION={
code=1401,
string="Alpha V0.14.1",
name="黎明 Dawn",
code=1402,
string="Alpha V0.14.2",
name="破晓 Dawn",
}
function love.conf(t)
t.identity="Techmino"--Saving folder

View File

@@ -661,16 +661,21 @@ do--function dumpBasicConfig()
"skin","face",
--Graphic
"block","ghost","center","smooth","grid","bagLine",
"lockFX","dropFX","moveFX","clearFX","splashFX","shakeFX","atkFX",
"text","score","warn","highCam","nextPos",
"block","ghost","center","bagLine",
"dropFX","moveFX","shakeFX",
"text","highCam","nextPos",
--Unnecessary graphic
-- "grid","smooth",
-- "lockFX","clearFX","splashFX","atkFX",
-- "score",
}
function dumpBasicConfig()
local S={}
for _,key in next,gameSetting do
S[key]=SETTING[key]
end
return data.encode("string","base64",JSON.encode(S))
return JSON.encode(S)
end
end
do--function resetGameData(args)

View File

@@ -148,7 +148,7 @@ return{
{"Techmino",
"techmino",
"game",
"*Windows, MacOS, Android | Single player*\nA game with many modes and loads of customization. Low input delay, decent controls.",
"*Windows, MacOS, Android | Single player and multiplyer*\nA game with many modes and loads of customization. Low input delay, decent controls.",
},
{"Cultris II",
"c2 cultris2 cultrisii",

View File

@@ -153,7 +153,7 @@ return{
{"Techmino",
"techmino tieke",
"game",
"一个win/android/linux/macOS方块只有单机,但是模式和各种设置都很齐全,适合有一定基础的新人,输入延迟很小,手感很好",
"一个win/android/linux/macOS方块单机模式和各种设置都很齐全,联机正在逐渐开发中,输入延迟很小,手感很好",
},
{"Cultris II",
"c2 cultris2 cultrisii",
@@ -603,7 +603,7 @@ return{
{"输入延迟",
"输入延迟 input delay",
"term",
"用任何设备玩任何游戏时,所有的操作(按键盘,点鼠标等)都会晚一点点(很短,几毫秒到几十毫秒)才达游戏如果过长就会很影响游戏手感作用效果类似于你拿qq远程控制打fps游戏\ntop、te等游戏比较明显\n这个延迟一般由硬件性能,硬件状态影响,通常来说不可设置,开启性能模式(或者关闭节能模式)可能会好一点",
"用任何设备玩任何游戏时,所有的操作(按键盘,点鼠标等)都会晚一点点(很短,几毫秒到几十毫秒)才达游戏如果过长就会很影响游戏手感作用效果类似于你拿qq远程控制打fps游戏\ntop、te等游戏比较明显\n这个延迟一般由硬件性能,硬件状态影响,通常来说不可设置,开启性能模式(或者关闭节能模式)可能会好一点",
},
{"Cold Clear",
"cc coldclear",

View File

@@ -601,6 +601,7 @@ return{
email="Email Address",
password="Password",
password2="Re-enter Password",
register="Register",
},
account={
title="Account",

View File

@@ -512,6 +512,7 @@ return{
email="E-mail",
password="Mot de passe",
password2="Confirmer le mot de passe",
register="Enregistrement",
},
account={
title="Compte",

View File

@@ -595,11 +595,12 @@ return{
},
register={
title="Registrar",
login="Registrar",
login="Log in",
username="Nome De Usuário",
email="Endereço De Email",
password="Senha",
password2="Entre Senha Novamente",
register="Registrar",
},
account={
title="Conta",

View File

@@ -515,6 +515,7 @@ return{
email="Correo Elec.",
password="Contraseña",
password2="Repetir Contr.",
register="Registrarse",
},
account={
title="Cuenta",

View File

@@ -444,6 +444,7 @@ return{
email="@",
password="*",
password2="*",
register="Sign up",
},
account={
title="@_@",

View File

@@ -113,7 +113,7 @@ return{
qq="QQ对线",
},
register={
password2="觉得应该填啥",
password2="该填啥",
},
sound={
title="音效室",

View File

@@ -599,6 +599,7 @@ return{
email="邮箱",
password="密码",
password2="确认密码",
register="注册",
},
account={
title="账户",

View File

@@ -8,9 +8,6 @@ return{
drop=60,wait=8,fall=20,
task=function(P)P.modeData.target=10 end,
dropPiece=function(P)
if P.stat.row<180 then
P.stat.row=180
end
if P.stat.row>=P.modeData.target then
if P.modeData.target==200 then
P:win("finish")

View File

@@ -121,6 +121,18 @@ function NET.wsclose_stream()
end
--Account
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,
}
})
end
end
function NET.pong(wsName,message)
WS.send(wsName,message,"pong")
end
@@ -138,21 +150,20 @@ function NET.getUserInfo(id,ifDetail)
},
})
end
function NET.storeUserInfo(res)
local user=USERS[res.uid]
function NET.storeUserInfo(d)
local user=USERS[d.uid]
if not user then
user={}
USERS[res.uid]=user
USERS[d.uid]=user
end
user.uid=res.uid
user.email=res.email
user.username=res.username
user.motto=res.motto
user.avatar=res.avatar
user.uid=d.uid
user.username=d.username
user.motto=d.motto
user.avatar=d.avatar
--Get own name
if res.uid==USER.uid then
USER.username=res.username
if d.uid==USER.uid then
USER.username=d.username
FILE.save(USER,"conf/user","q")
end
@@ -246,12 +257,21 @@ function NET.updateWS_app()
else
local res=_parse(message)
if res then
NET.connected=true
NET.allow_online=VERSION.code>=res.lowest
if VERSION.code<res.newestCode then
LOG.print(text.oldVersion:gsub("$1",res.newestName),180,COLOR.sky)
if res.type=="Connect"then
NET.connected=true
NET.allow_online=VERSION.code>=res.lowest
if VERSION.code<res.newestCode then
LOG.print(text.oldVersion:gsub("$1",res.newestName),180,COLOR.sky)
end
LOG.print(res.notice,300,COLOR.sky)
elseif res.action==0 then--Get new version info
--?
elseif res.action==1 then--Get notice
--?
elseif res.action==2 then--Register
LOG.print(res.data.message,300,COLOR.sky)
NET.unlock("register")
end
LOG.print(res.notice,300,COLOR.sky)
else
WS.alert("app")
end
@@ -285,8 +305,6 @@ function NET.updateWS_user()
if res.uid then
USER.uid=res.uid
USER.authToken=res.authToken
WIDGET.active.email:clear()
WIDGET.active.password:clear()
FILE.save(USER,"conf/user","q")
SCN.back()
end
@@ -301,7 +319,7 @@ function NET.updateWS_user()
NET.wsconn_play()
NET.unlock("accessToken")
elseif res.action==1 then--Get userInfo
NET.storeUserInfo(res)
NET.storeUserInfo(res.data)
end
else
WS.alert("user")
@@ -347,7 +365,7 @@ function NET.updateWS_play()
username=p.username,
sid=p.sid,
ready=p.ready,
conf=p.config,
config=p.config,
})
end
end
@@ -360,9 +378,9 @@ function NET.updateWS_play()
username=d.username,
sid=d.sid,
ready=d.ready,
conf=d.config,
config=d.config,
})
SCN.socketRead("Join",res.data)
SCN.socketRead("Join",d)
end
elseif res.action==3 then--Player leave
if not d.uid then
@@ -388,15 +406,15 @@ function NET.updateWS_play()
break
end
end
SCN.socketRead("Leave",res.data)
SCN.socketRead("Leave",d)
end
elseif res.action==4 then--Player talk
SCN.socketRead("Talk",res.data)
SCN.socketRead("Talk",d)
elseif res.action==5 then--Player change settings
if tostring(USER.uid)~=d.uid then
for i=1,#PLY_NET do
if PLY_NET[i].uid==d.uid then
PLY_NET[i].conf=d.config
PLY_NET[i].config=d.config
PLY_NET[i].p:setConf(d.config)
return
end
@@ -424,7 +442,7 @@ function NET.updateWS_play()
NET.wsconn_stream()
TASK.new(NET.updateWS_stream)
elseif res.action==9 then--Game finished
SCN.socketRead("Finish",res.data)
SCN.socketRead("Finish",d)
NET.wsclose_stream()
end
else
@@ -451,10 +469,11 @@ function NET.updateWS_stream()
else
local res=_parse(message)
if res then
local d=res.data
if res.type=="Connect"then
NET.unlock("wsc_stream")
elseif res.action==0 then--Game start
SCN.socketRead("Go",res.data)
SCN.socketRead("Go",d)
elseif res.action==1 then--Game finished
--?
elseif res.action==2 then--Player join
@@ -464,7 +483,7 @@ function NET.updateWS_stream()
elseif res.action==4 then--Player died
--?
elseif res.action==5 then--Receive stream
SCN.socketRead("Stream",res.data)
SCN.socketRead("Stream",d)
end
else
WS.alert("stream")

View File

@@ -234,11 +234,9 @@ local function loadGameEnv(P)--Load gameEnv
end
end
local function loadRemoteEnv(P,confStr)--Load gameEnv
local _,conf=pcall(love.data.decode,"string","base64",confStr)
if _ then
conf=JSON.decode(conf)
else
conf={}
confStr=JSON.decode(confStr)
if not confStr then
confStr={}
LOG.print("Bad conf from "..P.username.."#"..P.uid)
end
@@ -249,8 +247,8 @@ local function loadRemoteEnv(P,confStr)--Load gameEnv
for k,v in next,gameEnv0 do
if GAME.modeEnv[k]~=nil then
v=GAME.modeEnv[k] --Mode setting
elseif conf[k]~=nil then
v=conf[k] --Game setting
elseif confStr[k]~=nil then
v=confStr[k] --Game setting
elseif SETTING[k]~=nil then
v=SETTING[k] --Global setting
end
@@ -332,6 +330,7 @@ local function applyGameEnv(P)--Finish gameEnv processing
if ENV.clearFX==0 then ENV.clearFX=false end
if ENV.splashFX==0 then ENV.splashFX=false end
if ENV.shakeFX==0 then ENV.shakeFX=false end
if ENV.atkFX==0 then ENV.atkFX=false end
end
if ENV.ghost==0 then ENV.ghost=false end
if ENV.center==0 then ENV.center=false end
@@ -385,7 +384,7 @@ function PLY.newRemotePlayer(id,mini,data)
P.uid=data.uid
P.username=data.username
P.sid=data.sid
loadRemoteEnv(P,data.conf)
loadRemoteEnv(P,data.config)
applyGameEnv(P)
end

View File

@@ -97,7 +97,7 @@ end
function Player:createClearingFX(y,spd)
ins(self.clearFX,{y,0,spd})
end
function Player:createBeam(R,send,color)
function Player:createBeam(R,send,power,color)
local x1,y1,x2,y2
if self.mini then x1,y1=self.centerX,self.centerY
else x1,y1=self.x+(30*(self.curX+self.cur.sc[2])-30+15+150)*self.size,self.y+(600-30*(self.curY+self.cur.sc[1])+15)*self.size
@@ -110,7 +110,7 @@ function Player:createBeam(R,send,color)
local r,g,b=c[1]*2,c[2]*2,c[3]*2
local a=GAME.modeEnv.royaleMode and not(self.type=="human"or R.type=="human")and .2 or 1
SYSFX.newAttack(1-SETTING.atkFX*.1,x1,y1,x2,y2,int(send^.7*(4+SETTING.atkFX)),r,g,b,a*(SETTING.atkFX+2)*.0626)
SYSFX.newAttack(1-power*.1,x1,y1,x2,y2,int(send^.7*(4+power)),r,g,b,a*(power+2)*.0626)
end
--------------------------</FX>--------------------------
@@ -214,9 +214,9 @@ function Player:setRS(RSname)
end
function Player:setConf(confStr)
local _,conf=pcall(love.data.decode,"string","base64",confStr)
if _ then
for k,v in next,conf do
confStr=JSON.decode(confStr)
if confStr then
for k,v in next,confStr do
if not GAME.modeEnv[k]then
self.gameEnv[k]=v
end
@@ -1322,8 +1322,8 @@ do--Player.drop(self)--Place piece
if M>0 then
for i=1,M do
self:attack(self.atker[i],send,sendTime,generateLine(self:RND(10)))
if SETTING.atkFX>0 then
self:createBeam(self.atker[i],send,C.color)
if ENV.atkFX then
self:createBeam(self.atker[i],send,ENV.atkFX,C.color)
end
end
else
@@ -1338,8 +1338,8 @@ do--Player.drop(self)--Place piece
end
if T then
self:attack(T,send,sendTime,generateLine(self:RND(10)))
if SETTING.atkFX>0 then
self:createBeam(T,send,C.color)
if ENV.atkFX then
self:createBeam(T,send,ENV.atkFX,C.color)
end
end
end

View File

@@ -373,13 +373,13 @@ function update.dead(P,dt)
end
function update.remote_alive(P,dt)
local frmStep=GAME.frame-P.stat.frame
frmStep=
for _=1,
frmStep<20 and 1 or
frmStep<45 and rnd(2)or
frmStep<90 and 2 or
frmStep<180 and rnd(2,3) or
3
repeat
do
local eventTime=P.stream[P.streamProgress]
if eventTime then--Normal state, event forward
if P.stat.frame==eventTime then--Event time, execute action, read next so don't update immediately
@@ -394,23 +394,21 @@ function update.remote_alive(P,dt)
local amount=int(event/0x100)%0x100
local time=int(event/0x10000)%0x10000
local line=int(event/0x100000000)%0x10000
local L=PLY_ALIVE
for i=1,#L do
if L[i].sid==sid then
P:attack(L[i],amount,time,line,true)
if SETTING.atkFX>0 then
P:createBeam(L[i],amount,P.cur.color)
for _,p in next,PLY_ALIVE do
if p.sid==sid then
P:attack(p,amount,time,line,true)
if P.gameEnv.atkFX then
P:createBeam(p,amount,P.gameEnv.atkFX,P.cur.color)
end
break
end
end
elseif event>0x1000000000000 then--Receiving lines
local L=PLY_ALIVE
local sid=event%0x100
for i=1,#L do
if L[i].sid==sid then
for _,p in next,PLY_ALIVE do
if p.sid==sid then
P:receive(
L[i],
p,
int(event/0x100)%0x100,--amount
int(event/0x10000)%0x10000,--time
int(event/0x100000000)%0x10000--line
@@ -422,11 +420,10 @@ function update.remote_alive(P,dt)
P.streamProgress=P.streamProgress+2
else--No event now, run one frame
update.alive(P,dt)
frmStep=frmStep-1
end
else--Pause state, no actions, quit loop
break
end
until frmStep<=0
end
end
return update

View File

@@ -13,7 +13,7 @@ local scene={}
scene.widgetList={
WIDGET.newText{name="title", x=80, y=50,font=70,align="L"},
-- WIDGET.newButton{name="register",x=1140, y=100,w=170,h=80,color="green",code=function()SCN.swapTo("register","swipeR")end},
WIDGET.newButton{name="register", x=1140, y=100,w=170,h=80,color="lY",code=function()SCN.swapTo("register","swipeR")end},
WIDGET.newInputBox{name="email", x=380, y=200,w=500,h=60,regex="[0-9A-Za-z@._-]"},
WIDGET.newInputBox{name="password", x=380, y=300,w=626,h=60,secret=true,regex="[ -~]"},
WIDGET.newKey{name="login", x=1140, y=540,w=170,h=80,font=40,code=login},

View File

@@ -248,8 +248,8 @@ function scene.draw()
--Rectangle
gc.setColor(COLOR[p.ready and"G"or"white"])
gc.setLineWidth(4)
gc.rectangle("line",40,67+50*i,1200,42)
gc.setLineWidth(3)
gc.rectangle("line",40,67+50*i,800,42)
--Username
gc.setColor(1,1,1)

View File

@@ -67,9 +67,6 @@ function scene.keyDown(k)
LOG.print("Can't enter private room now")
return
end
if NET.roomList[selected].start then
LOG.print("Can't enter room after start")
end
NET.enterRoom(NET.roomList[selected].rid)--,password
end
end

View File

@@ -1,41 +1,30 @@
local scene={}
function scene.keyDown(key)
if key=="return"then
local username= WIDGET.active.username.value
local email= WIDGET.active.email.value
local password= WIDGET.active.password.value
local password2=WIDGET.active.password2.value
if #username==0 then
LOG.print(text.noUsername)return
elseif not email:match("^[a-zA-Z0-9_]+@[a-zA-Z0-9_-]+%.[a-zA-Z0-9_]+$")then
LOG.print(text.wrongEmail)return
elseif #password==0 or #password2==0 then
LOG.print(text.noPassword)return
elseif password~=password2 then
LOG.print(text.diffPassword)return
end
--[[
JSON.encode{
username=username,
email=email,
password=password,
}
]]
elseif key=="escape"then
SCN.back()
else
WIDGET.keyPressed(key)
local function register()
local username= WIDGET.active.username.value
local email= WIDGET.active.email.value
local password= WIDGET.active.password.value
local password2=WIDGET.active.password2.value
if #username==0 then
LOG.print(text.noUsername)return
elseif not email:match("^[a-zA-Z0-9_]+@[a-zA-Z0-9_-]+%.[a-zA-Z0-9_]+$")then
LOG.print(text.wrongEmail)return
elseif #password==0 or #password2==0 then
LOG.print(text.noPassword)return
elseif password~=password2 then
LOG.print(text.diffPassword)return
end
NET.register(username,email,password)
end
scene.widgetList={
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="green",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_]"},
WIDGET.newInputBox{name="email", x=380, y=300,w=626,h=60,regex="[0-9A-Za-z@._-]"},
WIDGET.newInputBox{name="email", x=380, y=300,w=626,h=60,regex="[0-9A-Za-z@._-]"},
WIDGET.newInputBox{name="password", x=380, y=400,w=626,h=60,secret=true,regex="[ -~]"},
WIDGET.newInputBox{name="password2", x=380, y=500,w=626,h=60,secret=true,regex="[ -~]"},
WIDGET.newInputBox{name="password2",x=380, y=500,w=626,h=60,secret=true,regex="[ -~]"},
WIDGET.newKey{name="register", x=1140, y=540,w=170,h=80,font=40,code=register},
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,font=40,code=backScene},
}

View File

@@ -22,7 +22,17 @@ return SPLITSTR([=[
可选虚拟按键颜色; 工程编译到字节码; task-Z(新AI)
录像回放菜单; 跳帧开关; 教学关; 超60帧; 热更新
0.14.1: 黎明 Dawn
0.14.2: 破晓 Dawn
新增:
重新启用注册菜单
改动:
优化一些联网对战相关内容
攻击特效从全局改为玩家设置项一部分
修复:
一些联网对战问题
马拉松模式忘了删测试用代码
0.14.1: 拂晓 Daybreak
改动:
为了更好的游戏体验,手机只能开单挑房,电脑开多人房(不建议),特殊用户可以开更大的房
增加联网对战模式的垃圾行上涨速度