简易健康游戏时间提醒
This commit is contained in:
1
main.lua
1
main.lua
@@ -199,6 +199,7 @@ do
|
||||
|
||||
--Update data file
|
||||
S=STAT
|
||||
freshDate()
|
||||
if S.extraRate then
|
||||
S.finesseRate=5*(S.piece-S.extraRate)
|
||||
end
|
||||
|
||||
@@ -299,6 +299,32 @@ function pasteMission(str)
|
||||
return true
|
||||
end
|
||||
|
||||
function freshDate()
|
||||
local date=os.date("%Y/%m/%d")
|
||||
if STAT.date~=date then
|
||||
STAT.date=date
|
||||
STAT.todayTime=0
|
||||
LOG.print(text.newDay,"message")
|
||||
end
|
||||
end
|
||||
function legalGameTime()
|
||||
if
|
||||
(SETTING.lang==1 or SETTING.lang==2 or SETTING.lang==7)and
|
||||
RANKS.sprint_10<4 and
|
||||
(not RANKS.sprint_40 or RANKS.sprint_40<3)
|
||||
then
|
||||
if STAT.todayTime<14400 then
|
||||
return true
|
||||
elseif STAT.todayTime<21600 then
|
||||
LOG.print(text.playedLong,"warning")
|
||||
return true
|
||||
else
|
||||
LOG.print(text.playedTooMuch,"warning")
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
function mergeStat(stat,delta)
|
||||
for k,v in next,delta do
|
||||
if type(v)=="table"then
|
||||
@@ -424,18 +450,23 @@ function resumeGame()
|
||||
SCN.swapTo("play","none")
|
||||
end
|
||||
function loadGame(M,ifQuickPlay)
|
||||
if M.score then STAT.lastPlay=M end
|
||||
GAME.curMode=MODES[M]
|
||||
GAME.modeEnv=GAME.curMode.env
|
||||
drawableText.modeName:set(text.modes[M][1])
|
||||
drawableText.levelName:set(text.modes[M][2])
|
||||
GAME.init=true
|
||||
SCN.swapTo("play",ifQuickPlay and"swipeD"or"fade_togame")
|
||||
SFX.play("enter")
|
||||
freshDate()
|
||||
if legalGameTime()then
|
||||
if M.score then STAT.lastPlay=M end
|
||||
GAME.curMode=MODES[M]
|
||||
GAME.modeEnv=GAME.curMode.env
|
||||
drawableText.modeName:set(text.modes[M][1])
|
||||
drawableText.levelName:set(text.modes[M][2])
|
||||
GAME.init=true
|
||||
SCN.push()
|
||||
SCN.swapTo("play",ifQuickPlay and"swipeD"or"fade_togame")
|
||||
SFX.play("enter")
|
||||
end
|
||||
end
|
||||
function resetGameData(replaying)
|
||||
if PLAYERS[1]and not GAME.replaying then
|
||||
mergeStat(STAT,PLAYERS[1].stat)
|
||||
STAT.todayTime=STAT.todayTime+PLAYERS[1].stat.time
|
||||
end
|
||||
|
||||
GAME.result=false
|
||||
|
||||
@@ -294,6 +294,8 @@ STAT={
|
||||
clear={},spin={},
|
||||
pc=0,hpc=0,b2b=0,b3b=0,score=0,
|
||||
lastPlay="sprint_10",--Last played mode ID
|
||||
date=nil,
|
||||
todayTime=0,
|
||||
}
|
||||
for i=1,25 do
|
||||
STAT.clear[i]={0,0,0,0,0,0}
|
||||
|
||||
@@ -5,6 +5,9 @@ return{
|
||||
httpTimeout="Network connection timed out",
|
||||
marking="Game Author: MrZ_26\nIllegal recording if you can see this\nAny explanation is invalid",
|
||||
holdR="Keep holding to retry",
|
||||
-- newDay="新的一天,新的开始~",
|
||||
-- playedLong="已经玩很久了!注意休息!",
|
||||
-- playedTooMuch="今天玩太久啦!打块好玩但也要适可而止哦~",
|
||||
|
||||
atkModeName={"Random","Badges","K.O.s","Attackers"},
|
||||
royale_remain="$1 Players Remaining",
|
||||
|
||||
@@ -6,6 +6,9 @@ return{
|
||||
httpTimeout="La connexion au réseau ne s'est pas faite à temps.",
|
||||
marking="Créateur du jeu: MrZ_26\nSi vous pouvez voir ceci, cet enregistrement est illégal\nToute explication est fausse et invalide.",
|
||||
holdR="Hold to restart",
|
||||
-- newDay="新的一天,新的开始~",
|
||||
-- playedLong="已经玩很久了!注意休息!",
|
||||
-- playedTooMuch="今天玩太久啦!打块好玩但也要适可而止哦~",
|
||||
|
||||
atkModeName={"Aléatoire","Badges","K.O.s faciles","Attaquants"},
|
||||
royale_remain="$1 Joueurs restants",
|
||||
|
||||
@@ -6,6 +6,9 @@ return{
|
||||
httpTimeout="¡Tiempo de espera de conexión agotado!",
|
||||
marking="Autor:MrZ_26\nEsta grabación es ilegal si ves esto\nNo se aceptan excusas",
|
||||
holdR="Mantén presionado para reiniciar",
|
||||
-- newDay="新的一天,新的开始~",
|
||||
-- playedLong="已经玩很久了!注意休息!",
|
||||
-- playedTooMuch="今天玩太久啦!打块好玩但也要适可而止哦~",
|
||||
|
||||
atkModeName={"Al azar","Medallas","KOs","Atacantes"},
|
||||
royale_remain="$1 Jugadores Restantes",
|
||||
|
||||
@@ -3,6 +3,8 @@ return{
|
||||
newVersion="感谢更新,请看看更新了些啥",
|
||||
httpTimeout="没网或者网不好?",
|
||||
holdR="长按重开",
|
||||
playedLong="今天已经玩很久了,你小心点",
|
||||
playedTooMuch="你他妈再玩小心眼睛瞎掉,爬",
|
||||
|
||||
royale_remain="剩 $1 人",
|
||||
cmb={nil,"1连","2连","3连","4连","5连","6连","7连","8连","9连","10连!","11连!","12连!","13连!","14连!","15连!","16连!","17连!","18连!","19连!","MEGACMB"},
|
||||
|
||||
@@ -5,6 +5,9 @@ return{
|
||||
httpTimeout="网络连接超时!",
|
||||
marking="游戏作者:MrZ_26\n任何视频/直播不得出现此水印\n任何转述声明无效",
|
||||
holdR="长按以重新开始",
|
||||
newDay="新的一天,新的开始~",
|
||||
playedLong="已经玩很久了!注意休息!",
|
||||
playedTooMuch="今天玩太久啦!打块好玩但也要适可而止哦~",
|
||||
|
||||
atkModeName={"随机","徽章","击杀","反击"},
|
||||
royale_remain="剩余 $1 名玩家",
|
||||
|
||||
@@ -44,7 +44,6 @@ function scene.keyDown(key)
|
||||
return
|
||||
end
|
||||
end
|
||||
SCN.push()
|
||||
if key=="return2"or kb.isDown("lalt","lctrl","lshift")then
|
||||
if sceneTemp.initField then
|
||||
loadGame("custom_puzzle",true)
|
||||
|
||||
@@ -41,7 +41,7 @@ scene.widgetList={
|
||||
WIDGET.newButton{name="custom", x=590,y=220,w=200,h=140,color="lBlue", font=40,code=WIDGET.lnk_goScene("customGame")},
|
||||
WIDGET.newButton{name="setting",x=150,y=380,w=200,h=140,color="lOrange",font=40,code=WIDGET.lnk_goScene("setting_game")},
|
||||
WIDGET.newButton{name="stat", x=370,y=380,w=200,h=140,color="lGreen", font=40,code=WIDGET.lnk_goScene("stat")},
|
||||
WIDGET.newButton{name="qplay", x=590,y=380,w=200,h=140,color="white", font=40,code=function()SCN.push()loadGame(STAT.lastPlay,true)end},
|
||||
WIDGET.newButton{name="qplay", x=590,y=380,w=200,h=140,color="white", font=40,code=function()loadGame(STAT.lastPlay,true)end},
|
||||
WIDGET.newButton{name="lang", x=150,y=515,w=200,h=90,color="lYellow", font=40,code=WIDGET.lnk_goScene("lang")},
|
||||
WIDGET.newButton{name="help", x=370,y=515,w=200,h=90,color="dGreen", font=40,code=WIDGET.lnk_goScene("help")},
|
||||
WIDGET.newButton{name="quit", x=590,y=515,w=200,h=90,color="grey", font=40,code=function()VOC.play("bye")SCN.swapTo("quit","slowFade")end},
|
||||
|
||||
@@ -119,6 +119,7 @@ function scene.sceneBack()
|
||||
love.keyboard.setKeyRepeat(true)
|
||||
if not GAME.replaying then
|
||||
mergeStat(STAT,PLAYERS[1].stat)
|
||||
STAT.todayTime=STAT.todayTime+PLAYERS[1].stat.time
|
||||
end
|
||||
if not GAME.result then
|
||||
FILE.save(STAT,"data")
|
||||
|
||||
@@ -14,10 +14,10 @@ end
|
||||
function scene.mouseDown(x,y)
|
||||
if x>230 and x<1050 then
|
||||
if math.abs(y-800+sceneTemp.time*40)<70 then
|
||||
SCN.pop()SCN.push()
|
||||
SCN.pop()
|
||||
loadGame("sprintLock")
|
||||
elseif math.abs(y-2160+sceneTemp.time*40)<70 then
|
||||
SCN.pop()SCN.push()
|
||||
SCN.pop()
|
||||
loadGame("sprintFix")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user