整理代码
框架跟进
This commit is contained in:
Submodule Zframework updated: 79455c6fc7...d2ba89b7fc
5
main.lua
5
main.lua
@@ -22,7 +22,6 @@
|
||||
local fs=love.filesystem
|
||||
VERSION=require"version"
|
||||
TIME=love.timer.getTime
|
||||
YIELD=coroutine.yield
|
||||
SYSTEM=love.system.getOS()if SYSTEM=='OS X'then SYSTEM='macOS'end
|
||||
FNNS=SYSTEM:find'\79\83'--What does FNSF stand for? IDK so don't ask me lol
|
||||
MOBILE=SYSTEM=='Android'or SYSTEM=='iOS'
|
||||
@@ -662,7 +661,7 @@ for i=1,#_LOADTIMELIST_ do LOG(_LOADTIMELIST_[i])end
|
||||
--Launch testing task if launch param received
|
||||
if TABLE.find(arg,'--test')then
|
||||
TASK.new(function()
|
||||
while not LOADED do YIELD()end
|
||||
while not LOADED do coroutine.yield()end
|
||||
|
||||
LOG("\27[92m\27[1mAutomatic Test Started\27[0m")
|
||||
BGM.setVol(0)SFX.setVol(0)
|
||||
@@ -684,7 +683,7 @@ if TABLE.find(arg,'--test')then
|
||||
end)
|
||||
TASK.new(function()
|
||||
while true do
|
||||
YIELD()
|
||||
coroutine.yield()
|
||||
if Z.getErr(1)then break end
|
||||
end
|
||||
LOG("\27[91m\27[1mAutomatic Test Failed :(\27[0m\nThe error message is:\n"..table.concat(Z.getErr(1).mes,"\n").."\27[91m\nAborting\27[0m")
|
||||
|
||||
@@ -8,7 +8,7 @@ return{
|
||||
end,
|
||||
task=function(P)
|
||||
while true do
|
||||
YIELD()
|
||||
coroutine.yield()
|
||||
if P.control and P.atkBufferSum==0 then
|
||||
local D=P.modeData
|
||||
if D.wave==50 then
|
||||
|
||||
@@ -8,7 +8,7 @@ return{
|
||||
end,
|
||||
task=function(P)
|
||||
while true do
|
||||
YIELD()
|
||||
coroutine.yield()
|
||||
if P.control and P.atkBufferSum<4 then
|
||||
local D=P.modeData
|
||||
if D.wave==50 then
|
||||
|
||||
@@ -10,7 +10,7 @@ return{
|
||||
end,
|
||||
task=function(P)
|
||||
while true do
|
||||
YIELD()
|
||||
coroutine.yield()
|
||||
if P.control then
|
||||
local D=P.modeData
|
||||
D.counter=D.counter+1
|
||||
|
||||
@@ -10,7 +10,7 @@ return{
|
||||
end,
|
||||
task=function(P)
|
||||
while true do
|
||||
YIELD()
|
||||
coroutine.yield()
|
||||
if P.control then
|
||||
local D=P.modeData
|
||||
D.counter=D.counter+1
|
||||
|
||||
@@ -6,7 +6,7 @@ return{
|
||||
end,
|
||||
task=function(P)
|
||||
while true do
|
||||
YIELD()
|
||||
coroutine.yield()
|
||||
if P.control then
|
||||
local D=P.modeData
|
||||
D.timer=D.timer+1
|
||||
|
||||
@@ -6,7 +6,7 @@ return{
|
||||
end,
|
||||
task=function(P)
|
||||
while true do
|
||||
YIELD()
|
||||
coroutine.yield()
|
||||
if P.control then
|
||||
local D=P.modeData
|
||||
D.timer=D.timer+1
|
||||
|
||||
@@ -53,7 +53,7 @@ return{
|
||||
P.modeData.rankPoint=0
|
||||
P.modeData.rankName=sectionName[1]
|
||||
while true do
|
||||
YIELD()
|
||||
coroutine.yield()
|
||||
if P.stat.frame>=3600 then
|
||||
P.modeData.rankPoint=math.min(P.modeData.rankPoint+passPoint,140)
|
||||
P.modeData.rankName=sectionName[math.floor(P.modeData.rankPoint/10)+1]
|
||||
|
||||
@@ -289,7 +289,7 @@ return{
|
||||
local decayRate={125,80,80,50,45,45,45,40,40,40,40,40,30,30,30,20,20,20,20,20,15,15,15,15,15,15,15,15,15,15,10,10,10,9,9,9,8,8,8,7,7,7,6}
|
||||
local decayTimer=0
|
||||
while true do
|
||||
YIELD()
|
||||
coroutine.yield()
|
||||
P.modeData.grade=getGrade()
|
||||
P.modeData.gradePts=math.max(math.min(math.floor(int_grade_boosts[math.min(int_grade+1,#int_grade_boosts)]+rollGrades+cools+1-regrets),#gradeList),1)
|
||||
if P.stat.frame-prevSectTime > reg_time[math.ceil(P.modeData.pt/100+0.01)] and not (isInRoll or isInRollTrans) then
|
||||
@@ -336,7 +336,7 @@ return{
|
||||
rollGrades=rollGrades+(cools>8 and 1.6 or 0.5)
|
||||
P.modeData.grade=getGrade()
|
||||
P.modeData.gradePts=math.min(math.floor(int_grade_boosts[math.min(int_grade+1,#int_grade_boosts)]+rollGrades+cools+1-regrets),#gradeList)
|
||||
YIELD()
|
||||
coroutine.yield()
|
||||
P:win('finish')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -72,7 +72,7 @@ return{
|
||||
P.modeData.pt=0
|
||||
P.modeData.target=100
|
||||
while true do
|
||||
YIELD()
|
||||
coroutine.yield()
|
||||
if P.holdTime==0 and P.waiting<=0 and not held then
|
||||
hidetimer=0
|
||||
held=true
|
||||
|
||||
@@ -11,7 +11,7 @@ local function task_PC(P)
|
||||
P:pushNextList(L,symmetry)
|
||||
|
||||
P.control=false
|
||||
if P.frameRun>180 then for _=1,26 do YIELD()end end
|
||||
if P.frameRun>180 then for _=1,26 do coroutine.yield()end end
|
||||
P.control=true
|
||||
|
||||
local base=PCbase[difficulty]
|
||||
|
||||
@@ -14,7 +14,7 @@ local function task_PC(P)
|
||||
P:pushNextList(L,symmetry)
|
||||
|
||||
P.control=false
|
||||
if P.frameRun>180 then for _=1,26 do YIELD()end end
|
||||
if P.frameRun>180 then for _=1,26 do coroutine.yield()end end
|
||||
P.control=true
|
||||
|
||||
local base=PCbase[difficulty]
|
||||
|
||||
@@ -7,9 +7,9 @@ return{
|
||||
PLY.draw.drawTargetLine(P,r)
|
||||
end,
|
||||
task=function(P)
|
||||
YIELD()
|
||||
coroutine.yield()
|
||||
while true do
|
||||
for _=1,P.holeRND:random(40,200)do YIELD()end
|
||||
for _=1,P.holeRND:random(40,200)do coroutine.yield()end
|
||||
local r=P.holeRND:random(7)
|
||||
if r==1 then
|
||||
if P.cur and not P:ifoverlap(P.cur.bk,P.curX-1,P.curY)then
|
||||
|
||||
@@ -6,7 +6,7 @@ return{
|
||||
end,
|
||||
task=function(P)
|
||||
while true do
|
||||
YIELD()
|
||||
coroutine.yield()
|
||||
if P.control then
|
||||
local D=P.modeData
|
||||
D.timer=D.timer+1
|
||||
|
||||
@@ -6,7 +6,7 @@ return{
|
||||
end,
|
||||
task=function(P)
|
||||
while true do
|
||||
YIELD()
|
||||
coroutine.yield()
|
||||
if P.control then
|
||||
local D=P.modeData
|
||||
D.timer=D.timer+1
|
||||
|
||||
@@ -6,7 +6,7 @@ return{
|
||||
end,
|
||||
task=function(P)
|
||||
while true do
|
||||
YIELD()
|
||||
coroutine.yield()
|
||||
if P.control then
|
||||
local D=P.modeData
|
||||
D.timer=D.timer+1
|
||||
|
||||
@@ -6,7 +6,7 @@ return{
|
||||
end,
|
||||
task=function(P)
|
||||
while true do
|
||||
YIELD()
|
||||
coroutine.yield()
|
||||
if P.control then
|
||||
local D=P.modeData
|
||||
D.timer=D.timer+1
|
||||
|
||||
@@ -6,7 +6,7 @@ return{
|
||||
end,
|
||||
task=function(P)
|
||||
while true do
|
||||
YIELD()
|
||||
coroutine.yield()
|
||||
if P.control then
|
||||
local D=P.modeData
|
||||
D.timer=D.timer+1
|
||||
|
||||
@@ -21,7 +21,7 @@ return{
|
||||
BGM.seek(0)
|
||||
P.modeData.section=1
|
||||
while true do
|
||||
YIELD()
|
||||
coroutine.yield()
|
||||
while P.stat.frame>=warnTime[P.modeData.section]do
|
||||
if P.modeData.section<9 then
|
||||
P.modeData.section=P.modeData.section+1
|
||||
|
||||
@@ -695,7 +695,7 @@ do--function resetGameData(args)
|
||||
local function task_showMods()
|
||||
local time=0
|
||||
while true do
|
||||
YIELD()
|
||||
coroutine.yield()
|
||||
time=time+1
|
||||
if time%20==0 then
|
||||
local M=GAME.mod[time/20]
|
||||
|
||||
@@ -5,7 +5,7 @@ return{
|
||||
sequence=function(P)
|
||||
for _=1,3 do P:getNext(7)end
|
||||
while true do
|
||||
YIELD()
|
||||
coroutine.yield()
|
||||
if not P.nextQueue[1]then
|
||||
local height=TABLE.new(0,10)
|
||||
local max=#P.field
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
local yield=YIELD
|
||||
local yield=coroutine.yield
|
||||
local function marginTask(P)
|
||||
local S=P.stat
|
||||
while true do yield()if S.frame>90*60 then P.strength=1;P:setFrameColor(1)break end end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
local loveEncode,loveDecode=love.data.encode,love.data.decode
|
||||
|
||||
local WS=WS
|
||||
local yield=YIELD
|
||||
local PLAYERS=PLAYERS
|
||||
|
||||
local NET={
|
||||
@@ -73,7 +72,7 @@ local function getMsg(request,timeout)
|
||||
return JSON.decode(mes.body)
|
||||
end
|
||||
else
|
||||
totalTime=totalTime+yield()
|
||||
totalTime=totalTime+coroutine.yield()
|
||||
if totalTime>timeout then
|
||||
return
|
||||
end
|
||||
@@ -154,7 +153,7 @@ end
|
||||
function NET.setPW(code,pw)
|
||||
if not TASK.lock('setPW') then return end
|
||||
TASK.new(function()
|
||||
pw=HASH.hmac()
|
||||
pw=HASH.pbkdf2(HASH.sha3_256,pw,"salt",26000)
|
||||
|
||||
local res=getMsg({
|
||||
pool='setPW',
|
||||
@@ -499,7 +498,7 @@ end
|
||||
--WS task funcs
|
||||
function NET.freshPlayerCount()
|
||||
while WS.status('game')=='running'do
|
||||
for _=1,260 do yield()end
|
||||
TEST.yieldN(260)
|
||||
if TASK.lock('freshPlayerCount',10)then
|
||||
WS.send('game',JSON.encode{action=3})
|
||||
end
|
||||
@@ -507,7 +506,7 @@ function NET.freshPlayerCount()
|
||||
end
|
||||
function NET.updateWS_user()
|
||||
while WS.status('game')~='dead'do
|
||||
yield()
|
||||
coroutine.yield()
|
||||
local message,op=WS.read('user')
|
||||
if message then
|
||||
if op=='ping'then
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
local ins,rem=table.insert,table.remove
|
||||
local yield=YIELD
|
||||
local yield=coroutine.yield
|
||||
|
||||
local seqGenerators={
|
||||
none=function()while true do yield()end end,
|
||||
|
||||
@@ -26,15 +26,15 @@ local loadingThread=coroutine.wrap(function()
|
||||
logoColor1={COLOR.rainbow(r)}
|
||||
logoColor2={COLOR.rainbow_light(r)}
|
||||
end
|
||||
YIELD()
|
||||
YIELD('loadSFX')SFX.load('media/effect/'..SETTING.sfxPack..'/')
|
||||
YIELD('loadSample')SFX.loadSample{name='bass',path='media/sample/bass',base='A2'}--A2~A4
|
||||
YIELD('loadSample')SFX.loadSample{name='lead',path='media/sample/lead',base='A3'}--A3~A5
|
||||
YIELD('loadSample')SFX.loadSample{name='bell',path='media/sample/bell',base='A4'}--A4~A6
|
||||
YIELD('loadVoice')VOC.load('media/vocal/'..SETTING.vocPack..'/')
|
||||
YIELD('loadFont')for i=1,17 do getFont(15+5*i)getFont(15+5*i,'mono')end
|
||||
coroutine.yield()
|
||||
coroutine.yield('loadSFX')SFX.load('media/effect/'..SETTING.sfxPack..'/')
|
||||
coroutine.yield('loadSample')SFX.loadSample{name='bass',path='media/sample/bass',base='A2'}--A2~A4
|
||||
coroutine.yield('loadSample')SFX.loadSample{name='lead',path='media/sample/lead',base='A3'}--A3~A5
|
||||
coroutine.yield('loadSample')SFX.loadSample{name='bell',path='media/sample/bell',base='A4'}--A4~A6
|
||||
coroutine.yield('loadVoice')VOC.load('media/vocal/'..SETTING.vocPack..'/')
|
||||
coroutine.yield('loadFont')for i=1,17 do getFont(15+5*i)getFont(15+5*i,'mono')end
|
||||
|
||||
YIELD('loadModeIcon')
|
||||
coroutine.yield('loadModeIcon')
|
||||
local modeIcons={}
|
||||
modeIcons.marathon=GC.DO{64,64,
|
||||
{'move',3,1},
|
||||
@@ -91,13 +91,13 @@ local loadingThread=coroutine.wrap(function()
|
||||
{'fRect',20,10,23,43},
|
||||
}
|
||||
|
||||
YIELD('loadMode')
|
||||
coroutine.yield('loadMode')
|
||||
for _,M in next,MODES do
|
||||
M.records=loadFile("record/"..M.name..".rec",'-luaon -canSkip')or M.score and{}
|
||||
M.icon=M.icon and(modeIcons[M.icon]or GC.newImage("media/image/modeicon/"..M.icon..".png"))
|
||||
end
|
||||
|
||||
YIELD('loadOther')
|
||||
coroutine.yield('loadOther')
|
||||
STAT.run=STAT.run+1
|
||||
|
||||
SFX.play('enter',.8)
|
||||
|
||||
@@ -11,10 +11,10 @@ local widgetX0={
|
||||
}
|
||||
local enterConsole=coroutine.wrap(function()
|
||||
while true do
|
||||
Snd('bell',.6,'A4',.7,'E5',1,MATH.coin('A5','B5'))YIELD()
|
||||
Snd('bell',.6,'A4',.7,'F5',1,MATH.coin('C6','D6'))YIELD()
|
||||
Snd('bell',.6,'A4',.7,'G5',1,MATH.coin('E6','G6'))YIELD()
|
||||
Snd('bell',.6,'A4',.7,'A5',1,'A6')SFX.play('ren_mega')SCN.go('app_console')YIELD()
|
||||
Snd('bell',.6,'A4',.7,'E5',1,MATH.coin('A5','B5'))coroutine.yield()
|
||||
Snd('bell',.6,'A4',.7,'F5',1,MATH.coin('C6','D6'))coroutine.yield()
|
||||
Snd('bell',.6,'A4',.7,'G5',1,MATH.coin('E6','G6'))coroutine.yield()
|
||||
Snd('bell',.6,'A4',.7,'A5',1,'A6')SFX.play('ren_mega')SCN.go('app_console')coroutine.yield()
|
||||
end
|
||||
end)
|
||||
function scene.sceneInit()
|
||||
|
||||
Reference in New Issue
Block a user