移除加载时可能的强制重启(防止ios出问题)

几处love退出改为去quit场景(防止ios出问题)
整理代码
框架跟进
This commit is contained in:
MrZ_26
2022-11-06 17:28:54 +08:00
parent d932febe89
commit f70edaac83
66 changed files with 252 additions and 312 deletions

358
main.lua
View File

@@ -239,44 +239,24 @@ Z.setOnQuit(function()
destroyPlayers()
end)
-- Load settings and statistics
if
not (
pcall(TABLE.cover, loadFile('conf/user', '-json -canSkip') or loadFile('conf/user', '-luaon -canSkip') or{},USER) and
pcall(TABLE.cover, loadFile('conf/unlock', '-json -canSkip') or loadFile('conf/unlock', '-luaon -canSkip') or{},RANKS) and
pcall(TABLE.update,loadFile('conf/settings', '-json -canSkip') or loadFile('conf/settings', '-luaon -canSkip') or{},SETTING) and
pcall(TABLE.coverR,loadFile('conf/data', '-json -canSkip') or loadFile('conf/data', '-luaon -canSkip') or{},STAT) and
pcall(TABLE.cover, loadFile('conf/key', '-json -canSkip') or loadFile('conf/key', '-luaon -canSkip') or{},KEY_MAP) and
pcall(TABLE.cover, loadFile('conf/virtualkey','-json -canSkip') or loadFile('conf/virtualkey','-luaon -canSkip') or{},VK_ORG)
)
then
MES.new('error',"An error occured during loading, and some data was lost.")
end
-- Initialize fields, sequence, missions, gameEnv for cutsom game
local fieldData=loadFile('conf/customBoards','-string -canSkip')
if fieldData then
fieldData=STRING.split(fieldData,"!")
for i=1,#fieldData do
DATA.pasteBoard(fieldData[i],i)
-- Load mode files
for i=1,#MODES do
local m=MODES[i]-- Mode template
if FILE.isSafe('parts/modes/'..m.name) then
TABLE.complete(require('parts.modes.'..m.name),MODES[i])
MODES[m.name],MODES[i]=MODES[i]
end
else
FIELD[1]=DATA.newBoard()
end
local sequenceData=loadFile('conf/customSequence','-string -canSkip')
if sequenceData then
DATA.pasteSequence(sequenceData)
for _,v in next,fs.getDirectoryItems('parts/modes') do
if FILE.isSafe('parts/modes/'..v) and not MODES[v:sub(1,-5)] then
local M={name=v:sub(1,-5)}
local modeData=require('parts.modes.'..M.name)
if modeData.env then
TABLE.complete(modeData,M)
MODES[M.name]=M
end
end
end
local missionData=loadFile('conf/customMissions','-string -canSkip')
if missionData then
DATA.pasteMission(missionData)
end
local customData=loadFile('conf/customEnv','-canSkip')
if customData and customData['version']==VERSION.code then
TABLE.complete(customData,CUSTOMENV)
end
TABLE.complete(require"parts.customEnv0",CUSTOMENV)
-- Initialize image libs
IMG.init{
@@ -386,6 +366,134 @@ VOC.init{
'welcome',
}
-- Load settings and statistics
if
not (
pcall(TABLE.cover, loadFile('conf/user', '-json -canSkip') or loadFile('conf/user', '-luaon -canSkip') or{},USER) and
pcall(TABLE.cover, loadFile('conf/unlock', '-json -canSkip') or loadFile('conf/unlock', '-luaon -canSkip') or{},RANKS) and
pcall(TABLE.update,loadFile('conf/settings', '-json -canSkip') or loadFile('conf/settings', '-luaon -canSkip') or{},SETTING) and
pcall(TABLE.coverR,loadFile('conf/data', '-json -canSkip') or loadFile('conf/data', '-luaon -canSkip') or{},STAT) and
pcall(TABLE.cover, loadFile('conf/key', '-json -canSkip') or loadFile('conf/key', '-luaon -canSkip') or{},KEY_MAP) and
pcall(TABLE.cover, loadFile('conf/virtualkey','-json -canSkip') or loadFile('conf/virtualkey','-luaon -canSkip') or{},VK_ORG)
)
then
MES.new('error',"An error occured during loading, and some data was lost.")
end
-- Initialize fields, sequence, missions, gameEnv for cutsom game
local fieldData=loadFile('conf/customBoards','-string -canSkip')
if fieldData then
fieldData=STRING.split(fieldData,"!")
for i=1,#fieldData do
DATA.pasteBoard(fieldData[i],i)
end
else
FIELD[1]=DATA.newBoard()
end
local sequenceData=loadFile('conf/customSequence','-string -canSkip')
if sequenceData then
DATA.pasteSequence(sequenceData)
end
local missionData=loadFile('conf/customMissions','-string -canSkip')
if missionData then
DATA.pasteMission(missionData)
end
local customData=loadFile('conf/customEnv','-canSkip')
if customData and customData['version']==VERSION.code then
TABLE.complete(customData,CUSTOMENV)
end
TABLE.complete(require"parts.customEnv0",CUSTOMENV)
-- Update data
do
if type(STAT.version)~='number' then
STAT.version=0
end
if STAT.version<1700 and SETTING.dascut<5 then
SETTING.dascut=SETTING.dascut+1
end
if RANKS.stack_e then
RANKS.stack_e=nil; fs.remove('record/stack_e.rec')
RANKS.stack_h=nil; fs.remove('record/stack_h.rec')
RANKS.stack_u=nil; fs.remove('record/stack_u.rec')
end
if RANKS.stack_20l then
RANKS.stack_20l=nil; fs.remove('record/stack_20l.rec')
RANKS.stack_40l=nil; fs.remove('record/stack_40l.rec')
RANKS.stack_100l=nil; fs.remove('record/stack_100l.rec')
end
if RANKS.rhythm_e then
RANKS.rhythm_e=nil; fs.remove('record/rhythm_e.rec')
RANKS.rhythm_h=nil; fs.remove('record/rhythm_h.rec')
RANKS.rhythm_u=nil; fs.remove('record/rhythm_u.rec')
end
if RANKS.bigbang then fs.remove('record/bigbang.rec') end
if RANKS.clearRush then fs.remove('record/clearRush.rec') end
if STAT.version~=VERSION.code then
for k,v in next,MODE_UPDATE_MAP do
if RANKS[k] then
RANKS[v]=RANKS[k]
RANKS[k]=nil
end
k='record/'..k
if fs.getInfo(k..'.dat') then
fs.write('record/'..v..'.rec',fs.read(k..'.dat'))
fs.remove(k..'.dat')
end
if fs.getInfo(k..'.rec') then
fs.write('record/'..v..'.rec',fs.read(k..'.rec'))
fs.remove(k..'.rec')
end
end
STAT.version=VERSION.code
end
SETTING.appLock,SETTING.dataSaving,SETTING.swap,SETTING.autoLogin=nil
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
if not RSlist[SETTING.RS] then SETTING.RS='TRS' end
if SETTING.ghostType=='greyCell' then SETTING.ghostType='grayCell' end
if type(SETTING.skinSet)=='number' then SETTING.skinSet='crystal_scf' end
if not TABLE.find({8,10,13,17,22,29,37,47,62,80,100},SETTING.frameMul) then SETTING.frameMul=100 end
if SETTING.cv then SETTING.vocPack,SETTING.cv=SETTING.cv end
if type(SETTING.bg)~='string' then SETTING.bg='on' end
if SETTING.skin[18]==10 then SETTING.skin[18]=4 end
if SETTING.reTime>3 or SETTING.reTime<.5 then SETTING.reTime=2 end
if SETTING.locale=='zh_full' then SETTING.locale='zh' end
if SETTING.vocPack=='rin' then SETTING.vocPack='miku' end
if RANKS.infinite then RANKS.infinite=0 end
if RANKS.infinite_dig then RANKS.infinite_dig=0 end
if not RANKS.sprint_10l then RANKS.sprint_10l=0 end
if RANKS.master_l then RANKS.master_n,RANKS.master_l=RANKS.master_l end
if RANKS.master_u then RANKS.master_h,RANKS.master_u=RANKS.master_u end
for _,v in next,VK_ORG do v.color=nil end
for name,rank in next,RANKS do
if type(name)=='number' or type(rank)~='number' then
RANKS[name]=nil
else
local M=MODES[name]
if M and M.unlock and rank>0 then
for _,unlockName in next,M.unlock do
if not RANKS[unlockName] then
RANKS[unlockName]=0
end
end
end
if not (M and M.x) then
RANKS[name]=nil
end
end
end
if not MODES[STAT.lastPlay] then
STAT.lastPlay='sprint_10l'
end
saveStats()
saveProgress()
saveSettings()
end
-- Initialize language lib
LANG.init('zh',
{
@@ -421,8 +529,6 @@ LANG.init('zh',
end)()
)
table.insert(_LOADTIMELIST_,("Initialize Parts: %.3fs"):format(TIME()-_LOADTIME_))
-- Load background files from SOURCE ONLY
for _,v in next,fs.getDirectoryItems('parts/backgrounds') do
if FILE.isSafe('parts/backgrounds/'..v) and v:sub(-3)=='lua' then
@@ -431,6 +537,7 @@ for _,v in next,fs.getDirectoryItems('parts/backgrounds') do
end
end
BG.remList('none')BG.remList('gray')BG.remList('custom')
-- Load scene files from SOURCE ONLY
for _,v in next,fs.getDirectoryItems('parts/scenes') do
if FILE.isSafe('parts/scenes/'..v) then
@@ -439,179 +546,9 @@ for _,v in next,fs.getDirectoryItems('parts/scenes') do
LANG.addScene(sceneName)
end
end
-- Load mode files
for i=1,#MODES do
local m=MODES[i]-- Mode template
if FILE.isSafe('parts/modes/'..m.name) then
TABLE.complete(require('parts.modes.'..m.name),MODES[i])
MODES[m.name],MODES[i]=MODES[i]
end
end
for _,v in next,fs.getDirectoryItems('parts/modes') do
if FILE.isSafe('parts/modes/'..v) and not MODES[v:sub(1,-5)] then
local M={name=v:sub(1,-5)}
local modeData=require('parts.modes.'..M.name)
if modeData.env then
TABLE.complete(modeData,M)
MODES[M.name]=M
end
end
end
table.insert(_LOADTIMELIST_,("Load Files: %.3fs"):format(TIME()-_LOADTIME_))
-- Update data
do
local needSave
if not fs.getInfo('conf/data') then
needSave=true
end
if type(STAT.version)~='number' then
STAT.version=0
needSave=true
end
if STAT.version<1500 then
FILE.clear_s('')
end
if STAT.version<1505 then
fs.remove('record/bigbang.rec')
fs.remove('conf/replay')
end
if STAT.version==1506 then
local temp1,temp2
if fs.getInfo('record/master_l.rec') then
temp1=fs.read('record/master_l.rec')
end
if fs.getInfo('record/master_u.rec') then
temp2=fs.read('record/master_u.rec')
end
if temp1 then
fs.write('record/master_u.rec',temp1)
end
if temp2 then
fs.write('record/master_l.rec',temp2)
end
RANKS.master_l,RANKS.master_u=RANKS.master_u,RANKS.master_l
if RANKS.tsd_u then
RANKS.tsd_u=0
end
end
if STAT.version==1601 then
RANKS.round_e=nil
RANKS.round_n=nil
RANKS.round_h=nil
RANKS.round_l=nil
RANKS.round_u=nil
fs.remove('record/round_e.rec')
fs.remove('record/round_n.rec')
fs.remove('record/round_h.rec')
fs.remove('record/round_l.rec')
fs.remove('record/round_u.rec')
end
if STAT.version<1700 and SETTING.dascut<5 then
SETTING.dascut=SETTING.dascut+1
needSave=true
end
if RANKS.stack_e then
RANKS.stack_e=nil
RANKS.stack_h=nil
RANKS.stack_u=nil
fs.remove('record/stack_e.rec')
fs.remove('record/stack_h.rec')
fs.remove('record/stack_u.rec')
end
if RANKS.stack_20l then
RANKS.stack_20l=nil
RANKS.stack_40l=nil
RANKS.stack_100l=nil
fs.remove('record/stack_20l.rec')
fs.remove('record/stack_40l.rec')
fs.remove('record/stack_100l.rec')
end
if RANKS.rhythm_e then
RANKS.rhythm_e=nil
RANKS.rhythm_h=nil
RANKS.rhythm_u=nil
fs.remove('record/rhythm_e.rec')
fs.remove('record/rhythm_h.rec')
fs.remove('record/rhythm_u.rec')
end
if RANKS.bigbang or RANKS.clearRush then
fs.remove('record/clearRush.rec')
fs.remove('record/bigbang.rec')
end
if STAT.version~=VERSION.code then
for k,v in next,MODE_UPDATE_MAP do
if RANKS[k] then
RANKS[v]=RANKS[k]
RANKS[k]=nil
end
k='record/'..k
if fs.getInfo(k..'.dat') then
fs.write('record/'..v..'.rec',fs.read(k..'.dat'))
fs.remove(k..'.dat')
end
if fs.getInfo(k..'.rec') then
fs.write('record/'..v..'.rec',fs.read(k..'.rec'))
fs.remove(k..'.rec')
end
end
STAT.version=VERSION.code
needSave=true
end
SETTING.appLock,SETTING.dataSaving,SETTING.swap,SETTING.autoLogin=nil
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
if not RSlist[SETTING.RS] then SETTING.RS='TRS' end
if SETTING.ghostType=='greyCell' then SETTING.ghostType='grayCell' end
if type(SETTING.skinSet)=='number' then SETTING.skinSet='crystal_scf' end
if not TABLE.find({8,10,13,17,22,29,37,47,62,80,100},SETTING.frameMul) then SETTING.frameMul=100 end
if SETTING.cv then SETTING.vocPack,SETTING.cv=SETTING.cv end
if type(SETTING.bg)~='string' then SETTING.bg='on' end
if SETTING.skin[18]==10 then SETTING.skin[18]=4 end
if SETTING.reTime>3 or SETTING.reTime<.5 then SETTING.reTime=2 end
if SETTING.locale=='zh_full' then SETTING.locale='zh' end
if SETTING.vocPack=='rin' then SETTING.vocPack='miku' end
if RANKS.infinite then RANKS.infinite=0 end
if RANKS.infinite_dig then RANKS.infinite_dig=0 end
if not RANKS.sprint_10l then RANKS.sprint_10l=0 end
if RANKS.master_l then RANKS.master_n,RANKS.master_l=RANKS.master_l needSave=true end
if RANKS.master_u then RANKS.master_h,RANKS.master_u=RANKS.master_u needSave=true end
for _,v in next,VK_ORG do v.color=nil end
for name,rank in next,RANKS do
if type(name)=='number' or type(rank)~='number' then
RANKS[name]=nil
needSave=true
else
local M=MODES[name]
if M and M.unlock and rank>0 then
for _,unlockName in next,M.unlock do
if not RANKS[unlockName] then
RANKS[unlockName]=0
needSave=true
end
end
end
if not (M and M.x) then
RANKS[name]=nil
needSave=true
end
end
end
if not MODES[STAT.lastPlay] then
STAT.lastPlay='sprint_10l'
needSave=true
end
if needSave then
saveStats()
saveProgress()
saveSettings()
love.event.quit('restart')
end
end
-- First start
FIRSTLAUNCH=STAT.run==0
if FIRSTLAUNCH and MOBILE then
@@ -669,6 +606,10 @@ for _,fileName in next,fs.getDirectoryItems('replay') do
end
table.sort(REPLAY,function(a,b) return a.fileName>b.fileName end)
WS.switchHost('cafuuchino1.3322.org','10026','/techmino/ws/v1')
HTTP.setHost("cafuuchino1.3322.org:10026")
HTTP.setThreadCount(1)
table.insert(_LOADTIMELIST_,("Initialize Data: %.3fs"):format(TIME()-_LOADTIME_))
for i=1,#_LOADTIMELIST_ do LOG(_LOADTIMELIST_[i]) end
@@ -706,6 +647,3 @@ if TABLE.find(arg,'-- test') then
love.event.quit(1)
end)
end
WS.switchHost('cafuuchino1.3322.org','10026','/techmino/ws/v1')
HTTP.setHost("cafuuchino1.3322.org:10026")
HTTP.setThreadCount(1)

View File

@@ -4,7 +4,7 @@ local sin=math.sin
local scene={}
function scene.sceneInit()
function scene.enter()
BG.set()
end

View File

@@ -2,7 +2,7 @@
local scene={}
function scene.sceneInit()
function scene.enter()
end

View File

@@ -14,7 +14,7 @@ local slide,pathVis,revKB
local function ifGaming() return state==1 end
local colorSelector=WIDGET.newSelector{name='color',x=150,y=240,w=200,list={'color1','rainbow','color2','gray','black'},color='lY',disp=function() return color end,code=function(v) if state~=1 then color=v end end,hideF=ifGaming}
function scene.sceneInit()
function scene.enter()
BG.set('rainbow2')
BGM.play('push')
board={{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}}

View File

@@ -225,7 +225,7 @@ local function skip()
end
end
function scene.sceneInit()
function scene.enter()
BG.set('cubes')
BGM.play('truth')
board={}

View File

@@ -29,7 +29,7 @@ local startTime,time
local state,progress
local frameKeyCount,mistake
function scene.sceneInit()
function scene.enter()
BG.set('bg2')
BGM.play('way')
levelName="A_Z"

View File

@@ -94,7 +94,7 @@ end
local scene={}
function scene.sceneInit()
function scene.enter()
restart()
BGM.play('truth')
BG.set('rainbow')

View File

@@ -153,7 +153,7 @@ end
local scene={}
function scene.sceneInit()
function scene.enter()
reset()
BGM.play('truth')
end

View File

@@ -24,12 +24,12 @@ local function _autoReturn()
end
end
function scene.sceneInit()
function scene.enter()
BG.set('none')
BGM.stop()
reg,val,sym=false,"0",false
end
function scene.sceneBack()
function scene.leave()
BGM.play()
end

View File

@@ -6,7 +6,7 @@ local state,timer,score,combo
local x,y,vx,vy,ex,ey
local scene={}
function scene.sceneInit()
function scene.enter()
pow,ang=0,0
state=0
timer=0

View File

@@ -711,20 +711,22 @@ local commands={} do
local button=WIDGET.newButton{name='bye',x=640,y=615,w=426,h=100,code=function()
TASK.new(function()
scene.widgetList.bye.hide=true
for _=1,30 do coroutine.yield() end
TEST.yieldN(30)
log{C.R,"Deleting all data in 10..."}SFX.play('ready')SFX.play('clear_1')TEST.yieldN(60)
log{C.R,"Deleting all data in 9..."}SFX.play('ready')SFX.play('clear_1')TEST.yieldN(60)
log{C.R,"Deleting all data in 8..."}SFX.play('ready')SFX.play('clear_1')TEST.yieldN(60)
log{C.R,"Deleting all data in 7..."}SFX.play('ready')SFX.play('clear_2')TEST.yieldN(60)
log{C.R,"Deleting all data in 6..."}SFX.play('ready')SFX.play('clear_2')TEST.yieldN(60)
log{C.R,"Deleting all data in 5..."}SFX.play('ready')SFX.play('clear_3')TEST.yieldN(60)
log{C.R,"Deleting all data in 4..."}SFX.play('ready')SFX.play('clear_3')TEST.yieldN(60)
log{C.R,"Deleting all data in 3..."}SFX.play('ready')SFX.play('clear_4')TEST.yieldN(60)
log{C.R,"Deleting all data in 2..."}SFX.play('ready')SFX.play('clear_4')TEST.yieldN(60)
log{C.R,"Deleting all data in 1..."}SFX.play('ready')SFX.play('clear_5')TEST.yieldN(60)
log{C.R,"Deleting all data in 0..."}SFX.play('start')SFX.play('clear_6')TEST.yieldN(60)
outputBox.hide=true TEST.yieldN(26)
FILE.clear_s('')love.event.quit()
log{C.R,"Deleting all data in 9..."} SFX.play('ready')SFX.play('clear_1')TEST.yieldN(60)
log{C.R,"Deleting all data in 8..."} SFX.play('ready')SFX.play('clear_1')TEST.yieldN(60)
log{C.R,"Deleting all data in 7..."} SFX.play('ready')SFX.play('clear_2')TEST.yieldN(60)
log{C.R,"Deleting all data in 6..."} SFX.play('ready')SFX.play('clear_2')TEST.yieldN(60)
log{C.R,"Deleting all data in 5..."} SFX.play('ready')SFX.play('clear_3')TEST.yieldN(60)
log{C.R,"Deleting all data in 4..."} SFX.play('ready')SFX.play('clear_3')TEST.yieldN(60)
log{C.R,"Deleting all data in 3..."} SFX.play('ready')SFX.play('clear_4')TEST.yieldN(60)
log{C.R,"Deleting all data in 2..."} SFX.play('ready')SFX.play('clear_4')TEST.yieldN(60)
log{C.R,"Deleting all data in 1..."} SFX.play('ready')SFX.play('clear_5')TEST.yieldN(60)
log{C.R,"Deleting all data in 0..."} SFX.play('start')SFX.play('clear_6')TEST.yieldN(60)
outputBox.hide=true
TEST.yieldN(26)
FILE.clear_s('')
love.event.quit()
end)
end}
button:setObject("Techmino is fun. Bye.")
@@ -1014,7 +1016,7 @@ userG.the_key=first_key
function scene.sceneInit()
function scene.enter()
WIDGET.focus(inputBox)
BG.set('none')
end

View File

@@ -45,7 +45,7 @@ end
local scene={}
function scene.sceneInit()
function scene.enter()
cubesX={} for i=1,40 do cubesX[i]=rnd()*16-8 end
cubesY={} for i=1,40 do cubesY[i]=i/40*9 end
lastCube=1

View File

@@ -33,7 +33,7 @@ local function restart()
end
end
function scene.sceneInit()
function scene.enter()
restart()
state='menu'
BGM.play('hang out')

View File

@@ -197,7 +197,7 @@ end
local scene={}
function scene.sceneInit()
function scene.enter()
reset()
BG.set('fixColor',.26,.26,.26)
BGM.play(bgm)

View File

@@ -243,7 +243,7 @@ end
local scene={}
function scene.sceneInit()
function scene.enter()
invis=false
newGame()
BGM.play('truth')

View File

@@ -105,7 +105,7 @@ end
local scene={}
function scene.sceneInit()
function scene.enter()
BG.set('fixColor',.26,.62,.26)
_newGame()
selected=false

View File

@@ -29,7 +29,7 @@ local function _reset()
freshLevel()
end
function scene.sceneInit()
function scene.enter()
state=1
timeUsed=0
level=0

View File

@@ -13,7 +13,7 @@ local offset
local scene={}
function scene.sceneInit()
function scene.enter()
inst='lead'
offset=0
end

View File

@@ -27,7 +27,7 @@ end
local scene={}
function scene.sceneInit()
function scene.enter()
state=0
ang,pos=0,-tau/4
timer=50

View File

@@ -14,7 +14,7 @@ local ry=0-- Rotation Y
local p1,p2-- Player data
function scene.sceneInit()
function scene.enter()
BG.set('none')
BGM.play('way')
state=0

View File

@@ -15,7 +15,7 @@ local function reset()
s1,s2=0,0
end
function scene.sceneInit()
function scene.enter()
reset()
BG.set('none')
end

View File

@@ -11,7 +11,7 @@ local startTime,time
local state,progress
local tapFX,mistake
function scene.sceneInit()
function scene.enter()
BG.set('space')
BGM.play('way')
board={}

View File

@@ -23,7 +23,7 @@ end
local scene={}
function scene.sceneInit()
function scene.enter()
state=0
time1=STRING.time(0)
time2=STRING.time(0)

View File

@@ -8,7 +8,7 @@ local scene={}
local lastKey,keyTime
local speed,maxSpeed=0,260
function scene.sceneInit()
function scene.enter()
lastKey=nil
speed=0
keyTime={} for i=1,40 do keyTime[i]=-1e99 end

View File

@@ -54,7 +54,7 @@ local function reset()
fallingTimer=false
failPos=false
end
function scene.sceneInit()
function scene.enter()
BG.set('rainbow2')
BGM.play('truth')
preview={}

View File

@@ -264,7 +264,7 @@ end
local scene={}
function scene.sceneInit()
function scene.enter()
player:reset()
BGM.play('truth')
end

View File

@@ -24,12 +24,12 @@ local sList={
local scene={}
function scene.sceneInit()
function scene.enter()
destroyPlayers()
BG.set(CUSTOMENV.bg)
BGM.play(CUSTOMENV.bgm)
end
function scene.sceneBack()
function scene.leave()
saveFile(CUSTOMENV,'conf/customEnv')
BGM.play()
end

View File

@@ -117,14 +117,14 @@ local function _pDraw()
while #F>0 and isEmpty(F[#F]) do rem(F) end
end
function scene.sceneInit()
function scene.enter()
curPen=false
penMode=0
penX,penY=1,1
demo=false
page=1
end
function scene.sceneBack()
function scene.leave()
saveFile(DATA.copyBoards(),'conf/customBoards')
end

View File

@@ -9,11 +9,11 @@ local scene={}
local input-- Input buffer
local cur-- Cursor position
function scene.sceneInit()
function scene.enter()
input=""
cur=#MISSION
end
function scene.sceneBack()
function scene.leave()
saveFile(DATA.copyMission(),'conf/customMissions')
end

View File

@@ -9,10 +9,10 @@ local scene={}
local cur-- Cursor position
function scene.sceneInit()
function scene.enter()
cur=#BAG
end
function scene.sceneBack()
function scene.leave()
saveFile(DATA.copySequence(),'conf/customSequence')
end

View File

@@ -4,7 +4,7 @@ local scene={}
local timer
function scene.sceneInit()
function scene.enter()
timer=1
scene.widgetList.pause.x=
SETTING.menuPos=='right' and 1195 or

View File

@@ -75,7 +75,7 @@ local function _search()
lastSearch=input
end
function scene.sceneInit()
function scene.enter()
dict=require("parts.language.dict_"..(SETTING.locale:find'zh' and 'zh' or SETTING.locale:find'ja' and 'ja' or 'en'))
_scanDict(dict)

View File

@@ -4,7 +4,7 @@ local errorShot,errorInfo
local scene={}
function scene.sceneInit()
function scene.enter()
BGcolor=math.random()>.026 and {.3,.5,.9} or {.62,.3,.926}
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."
@@ -34,7 +34,7 @@ end
scene.widgetList={
WIDGET.newKey{name='console',x=940,y=640,w=170,h=80,font=65,fText=CHAR.icon.console,code=goScene'app_console'},
WIDGET.newKey{name='quit',x=1140,y=640,w=170,h=80,font=40,fText=CHAR.icon.cross_thick,code=love.event.quit},
WIDGET.newKey{name='quit',x=1140,y=640,w=170,h=80,font=40,fText=CHAR.icon.cross_thick,code=goScene('quit','none')},
}
return scene

View File

@@ -133,7 +133,7 @@ local function _checkGameKeyDown(key)
return true-- No key pressed
end
function scene.sceneInit()
function scene.enter()
if GAME.init then
resetGameData()
GAME.init=false

View File

@@ -1,6 +1,6 @@
local scene={}
function scene.sceneInit()
function scene.enter()
BG.set('cubes')
scene.widgetList.texts:setTexts(require"parts.updateLog":split("\n"))
end

View File

@@ -20,7 +20,7 @@ local curLang=1
local scene={}
function scene.sceneBack()
function scene.leave()
saveSettings()
end

View File

@@ -1,5 +1,5 @@
local scene={}
function scene.sceneInit()
function scene.enter()
BG.set('cubes')
local fileData=love.filesystem.read("legals.md")
if fileData then

View File

@@ -110,15 +110,15 @@ local loadingThread=coroutine.wrap(function()
return 'finish'
end)
function scene.sceneInit()
function scene.enter()
studioLogo=GC.newText(getFont(90),"26F Studio")
progress=0
maxProgress=10
t1,t2=0,0-- Timer
animeType={} for i=1,#SVG_TITLE_FILL do animeType[i]=math.random(#titleTransform) end-- Random animation type
end
function scene.sceneBack()
love.event.quit()
function scene.leave()
SCN.go('quit','none')
end
function scene.mouseDown()
@@ -134,7 +134,7 @@ end
scene.touchDown=scene.mouseDown
function scene.keyDown(key)
if key=='escape' then
love.event.quit()
SCN.go('quit','none')
else
scene.mouseDown()
end

View File

@@ -29,7 +29,7 @@ local function _paste()
MES.new('warn',text.wrongCode)
end
function scene.sceneInit()
function scene.enter()
scene.widgetList.email:setText(USER.email or "")
scene.widgetList.code:clear()
end

View File

@@ -15,7 +15,7 @@ end
local scene={}
function scene.sceneInit()
function scene.enter()
showEmail=false
emailBox.secret=true
emailBox:setText(USER.email)

View File

@@ -18,7 +18,7 @@ local enterConsole=coroutine.wrap(function()
Snd('bell',.6,'A4',.7,'A5',1,'A6')SFX.play('ren_mega')SCN.go('app_console')coroutine.yield()
end
end)
function scene.sceneInit()
function scene.enter()
if THEME.cur=='halloween' then
TASK.new(function()
TEST.yieldT(.26)

View File

@@ -2,7 +2,7 @@ local scene={}
local tip=GC.newText(getFont(30),"")
function scene.sceneInit()
function scene.enter()
tip:set(text.getTip())
BG.set()
end

View File

@@ -1,6 +1,6 @@
local scene={}
function scene.sceneInit()
function scene.enter()
BG.set('cubes')
local fileData=FILE.load('parts/language/manual_'..(SETTING.locale:find'zh' and 'zh' or SETTING.locale:find'ja' and 'ja' or 'en')..'.txt','-string')
if fileData then

View File

@@ -38,7 +38,7 @@ local function _toggleMod(M,back)
scene.widgetList.unranked.hide=scoreValid()
end
function scene.sceneInit()
function scene.enter()
selected=false
scene.widgetList.unranked.hide=scoreValid()
BG.set('tunnel')

View File

@@ -24,7 +24,7 @@ local touchDist
local scene={}
function scene.sceneInit()
function scene.enter()
BG.set()
mapCam.zoomK=SCN.prev=='main' and 5 or 1
visibleModes={}-- 1=unlocked, 2=locked but visible

View File

@@ -23,7 +23,7 @@ local selected-- Music selected
local bgmList=BGM.getList()
if #bgmList==0 then bgmList={"[NO BGM]"} end
function scene.sceneInit()
function scene.enter()
playing=BGM.getPlaying()[1]
selected=TABLE.find(bgmList,playing) or 1
end

View File

@@ -59,7 +59,7 @@ end
local scene={}
function scene.sceneInit()
function scene.enter()
noTouch=not SETTING.VKSwitch
playing=false
lastUpstreamTime=0
@@ -73,7 +73,7 @@ function scene.sceneInit()
GAME.prevBG=false
end
end
function scene.sceneBack()
function scene.leave()
TASK.unlock('netPlaying')
end

View File

@@ -2,7 +2,7 @@ local gc=love.graphics
local scene={}
function scene.sceneInit()
function scene.enter()
BG.set('league')
BGM.play('exploration')
end

View File

@@ -1,9 +1,9 @@
local scene={}
function scene.sceneInit()
function scene.enter()
BG.set()
end
function scene.sceneBack()
function scene.leave()
NET.ws_close()
TASK.removeTask_code(NET.ws_update)
end

View File

@@ -50,11 +50,11 @@ local function _createRoom()
end
end
function scene.sceneInit()
function scene.enter()
sure=0
destroyPlayers()
end
function scene.sceneBack()
function scene.leave()
BGM.play()
end

View File

@@ -71,7 +71,7 @@ local function _fetchRoom()
end
local scene={}
function scene.sceneInit()
function scene.enter()
BG.set()
_fetchRoom()
end

View File

@@ -17,7 +17,7 @@ local rank-- Current rank
local trophy-- Current trophy
local trophyColor-- Current trophy color
function scene.sceneInit()
function scene.enter()
page=0
if SCN.prev:find("setting") then
TEXT.show(text.needRestart,640,410,50,'fly',.6)
@@ -116,7 +116,7 @@ function scene.sceneInit()
GAME.prevBG=false
end
end
function scene.sceneBack()
function scene.leave()
trySave()
end

View File

@@ -1,19 +1,19 @@
local scene={}
function scene.sceneInit()
if SYSTEM~="iOS" then
function scene.enter()
if SYSTEM=="iOS" then
MES.update(1e99)
Z.setPowerInfo(false)
Z.setClickFX(false)
VERSION.string=""
MES.new('error',"Please swipe up or press Home button to quit Techmino on iOS",1e99)
else
if math.random()>.0000626 then
love.timer.sleep(.26)
love.event.quit()
else
error("So lucky! 0.00626% to get this!! You can quit the game now.")
end
else
MES.update(1e99)
Z.setPowerInfo(false)
Z.setClickFX(false)
VERSION.string=""
MES.new('error',"Please swipe up or press Home button to quit Techmino on iOS",1e99)
end
end

View File

@@ -68,7 +68,7 @@ local function _updateButtonVisibility()
scene.widgetList[i].hide=hide
end
end
function scene.sceneInit()
function scene.enter()
BG.set()
listBox:setList(REPLAY)
_updateButtonVisibility()

View File

@@ -5,7 +5,7 @@ local scene={}
local das,arr
local pos,dir,wait
function scene.sceneInit()
function scene.enter()
das,arr=SETTING.das,SETTING.arr
pos,dir,wait=0,1,30
BG.set('bg1')

View File

@@ -2,10 +2,10 @@ local gc=love.graphics
local scene={}
function scene.sceneInit()
function scene.enter()
BG.set()
end
function scene.sceneBack()
function scene.leave()
saveSettings()
end

View File

@@ -98,12 +98,12 @@ local function _freshKeyList()
end
end
function scene.sceneInit()
function scene.enter()
selected=false
_freshKeyList()
BG.set('none')
end
function scene.sceneBack()
function scene.leave()
saveFile(KEY_MAP,'conf/key')
end

View File

@@ -11,7 +11,7 @@ local playEgg=WIDGET.newButton{name='playEgg', x=1140,y=540,w=140,h=65,color='l
local scene={}
function scene.sceneInit()
function scene.enter()
selEggMode=false
scene.widgetList.playEgg.hide=true
BG.set()

View File

@@ -8,7 +8,7 @@ local last1,last2-- Last touch/sound time
local sfxPack=SETTING.sfxPack
local vocPack=SETTING.vocPack
function scene.sceneInit()
function scene.enter()
last1,last2=0,0
sfxPack=SETTING.sfxPack
vocPack=SETTING.vocPack
@@ -16,7 +16,7 @@ function scene.sceneInit()
scene.widgetList.vocPack:reset()
BG.set()
end
function scene.sceneBack()
function scene.leave()
saveSettings()
end

View File

@@ -31,12 +31,12 @@ local function _load2()
end
end
function scene.sceneInit()
function scene.enter()
BG.set('rainbow')
defaultSetSelect=1
selected=false
end
function scene.sceneBack()
function scene.leave()
saveFile(VK_ORG,'conf/virtualkey')
end

View File

@@ -1,6 +1,6 @@
local scene={}
function scene.sceneInit()
function scene.enter()
BG.set('matrix')
end

View File

@@ -2,7 +2,7 @@ local gc=love.graphics
local scene={}
function scene.sceneBack()
function scene.leave()
saveSettings()
end

View File

@@ -10,7 +10,7 @@ local patron=require"parts.patron"
local names
local counter
function scene.sceneInit()
function scene.enter()
time=0
v=22.6
BG.set()

View File

@@ -3,7 +3,7 @@ local scene={}
local form-- Form of clear & spins
local item-- Detail datas
function scene.sceneInit()
function scene.enter()
BG.set()
local S=STAT
local X1,X2,Y1,Y2={0,0,0,0},{0,0,0,0},{},{}

View File

@@ -9,7 +9,7 @@ local function _push(mes)
timer=1
end
function scene.sceneInit()
function scene.enter()
backCounter=5
list={}
timer=0