整理代码
This commit is contained in:
@@ -34,7 +34,7 @@ function BG.setDefault(bg)
|
||||
end
|
||||
function BG.set(background)
|
||||
if not background then background=BG.default end
|
||||
if not BGs[background]then LOG.print("No BGM file: "..background,10,COLOR.orange)end
|
||||
if not BGs[background]then LOG.print("No BG file: "..background,10,COLOR.orange)end
|
||||
if background==BG.cur or not SETTING.bg then return end
|
||||
BG.discard()
|
||||
BG.cur=background
|
||||
|
||||
1
main.lua
1
main.lua
@@ -14,6 +14,7 @@ local fs=love.filesystem
|
||||
NONE={}function NULL()end
|
||||
DBP=print--Use this in permanent code
|
||||
TIME=love.timer.getTime
|
||||
YIELD=coroutine.yield
|
||||
SYSTEM=love.system.getOS()
|
||||
MOBILE=SYSTEM=="Android"or SYSTEM=="iOS"
|
||||
SAVEDIR=fs.getSaveDirectory()
|
||||
|
||||
@@ -681,7 +681,7 @@ do--function resetGameData(args)
|
||||
local function tick_showMods()
|
||||
local time=0
|
||||
while true do
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
time=time+1
|
||||
if time%20==0 then
|
||||
local M=GAME.mod[time/20]
|
||||
@@ -1220,7 +1220,7 @@ do
|
||||
|
||||
function TICK_WS_app()
|
||||
while true do
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
local status=WS.status("app")
|
||||
if status=="running"then
|
||||
local message,op=WS.read("app")
|
||||
@@ -1243,7 +1243,7 @@ do
|
||||
end
|
||||
function TICK_WS_chat()
|
||||
while true do
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
local status=WS.status("chat")
|
||||
if status=="running"then
|
||||
local message,op=WS.read("chat")
|
||||
|
||||
@@ -24,7 +24,7 @@ return{
|
||||
dropPiece=score,
|
||||
task=function(P)
|
||||
while true do
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
if P.stat.time>=53.5 then
|
||||
P.modeData.point=min(P.modeData.point+16,80)
|
||||
P.modeData.event=sectionName[int(P.modeData.point*.1)+1]
|
||||
|
||||
@@ -7,7 +7,7 @@ return{
|
||||
pushSpeed=2,
|
||||
task=function(P)
|
||||
while true do
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
if P.control and SCN.cur=="play"and P.atkBuffer.sum==0 then
|
||||
local p=#P.atkBuffer+1
|
||||
local B,D=P.atkBuffer,P.modeData
|
||||
|
||||
@@ -6,7 +6,7 @@ return{
|
||||
freshLimit=15,
|
||||
task=function(P)
|
||||
while true do
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
if P.control and SCN.cur=="play"and P.atkBuffer.sum<4 then
|
||||
local p=#P.atkBuffer+1
|
||||
local B,D=P.atkBuffer,P.modeData
|
||||
|
||||
@@ -9,7 +9,7 @@ return{
|
||||
pushSpeed=2,
|
||||
task=function(P)
|
||||
while true do
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
if P.control and SCN.cur=="play"then
|
||||
local D=P.modeData
|
||||
D.counter=D.counter+1
|
||||
|
||||
@@ -9,7 +9,7 @@ return{
|
||||
pushSpeed=1,
|
||||
task=function(P)
|
||||
while true do
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
if P.control and SCN.cur=="play"then
|
||||
local D=P.modeData
|
||||
D.counter=D.counter+1
|
||||
|
||||
@@ -6,7 +6,7 @@ return{
|
||||
freshLimit=15,
|
||||
task=function(P)
|
||||
while true do
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
if P.control and SCN.cur=="play"then
|
||||
local D=P.modeData
|
||||
D.counter=D.counter+1
|
||||
|
||||
@@ -5,7 +5,7 @@ return{
|
||||
freshLimit=15,
|
||||
task=function(P)
|
||||
while true do
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
if P.control and SCN.cur=="play"then
|
||||
local D=P.modeData
|
||||
D.counter=D.counter+1
|
||||
|
||||
@@ -8,7 +8,7 @@ local PClist=require"parts/modes/PClist"
|
||||
local function task_PC(P)
|
||||
local D=P.modeData
|
||||
while true do
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
D.counter=D.counter+1
|
||||
if D.counter==26 then
|
||||
local base=PCbase[D.type]
|
||||
|
||||
@@ -15,7 +15,7 @@ local function task_PC(P)
|
||||
local base=PCbase[D.type]
|
||||
P:pushLineList(base[P:RND(#base)],D.symmetry)
|
||||
end
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
end
|
||||
end
|
||||
local function check(P)
|
||||
|
||||
@@ -30,7 +30,7 @@ return{
|
||||
P.modeData.beatFrame=90
|
||||
P.modeData.counter=90
|
||||
while true do
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
P.modeData.counter=P.modeData.counter-1
|
||||
if P.modeData.counter==0 then
|
||||
P.modeData.counter=P.modeData.beatFrame
|
||||
|
||||
@@ -30,7 +30,7 @@ return{
|
||||
P.modeData.beatFrame=60
|
||||
P.modeData.counter=60
|
||||
while true do
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
P.modeData.counter=P.modeData.counter-1
|
||||
if P.modeData.counter==0 then
|
||||
P.modeData.counter=P.modeData.beatFrame
|
||||
|
||||
@@ -36,7 +36,7 @@ return{
|
||||
P.modeData.beatFrame=30
|
||||
P.modeData.counter=30
|
||||
while true do
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
P.modeData.counter=P.modeData.counter-1
|
||||
if P.modeData.counter==0 then
|
||||
P.modeData.counter=P.modeData.beatFrame
|
||||
|
||||
@@ -5,7 +5,7 @@ return{
|
||||
freshLimit=10,
|
||||
task=function(P)
|
||||
while true do
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
if P.control and SCN.cur=="play"then
|
||||
P.modeData.counter=P.modeData.counter+1
|
||||
if P.modeData.counter>=math.max(60,150-2*P.modeData.event)and P.atkBuffer.sum<4 then
|
||||
|
||||
@@ -5,7 +5,7 @@ return{
|
||||
freshLimit=10,
|
||||
task=function(P)
|
||||
while true do
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
if P.control and SCN.cur=="play"then
|
||||
P.modeData.counter=P.modeData.counter+1
|
||||
local B=P.atkBuffer
|
||||
|
||||
@@ -5,7 +5,7 @@ return{
|
||||
freshLimit=10,
|
||||
task=function(P)
|
||||
while true do
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
if P.control and SCN.cur=="play"then
|
||||
P.modeData.counter=P.modeData.counter+1
|
||||
if P.modeData.counter>=math.max(60,150-P.modeData.event)and P.atkBuffer.sum<20 then
|
||||
|
||||
@@ -5,7 +5,7 @@ return{
|
||||
freshLimit=10,
|
||||
task=function(P)
|
||||
while true do
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
if P.control and SCN.cur=="play"then
|
||||
P.modeData.counter=P.modeData.counter+1
|
||||
if P.modeData.counter>=math.max(90,180-2*P.modeData.event)and P.atkBuffer.sum<8 then
|
||||
|
||||
@@ -7,7 +7,7 @@ return{
|
||||
pushSpeed=2,
|
||||
task=function(P)
|
||||
while true do
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
if P.control and SCN.cur=="play"then
|
||||
P.modeData.counter=P.modeData.counter+1
|
||||
if P.modeData.counter>=math.max(300,600-10*P.modeData.event)and P.atkBuffer.sum<20 then
|
||||
|
||||
@@ -9,7 +9,7 @@ return{
|
||||
fall=20,
|
||||
task=function(P)
|
||||
while true do
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
local _=P.modeData.counter+1
|
||||
if P.stat.time>=warnTime[_]then
|
||||
if _<9 then
|
||||
|
||||
@@ -7,7 +7,7 @@ local Player={}--Player class
|
||||
local int,ceil,rnd=math.floor,math.ceil,math.random
|
||||
local max,min,modf=math.max,math.min,math.modf
|
||||
local ins,rem=table.insert,table.remove
|
||||
local ct=coroutine
|
||||
local YIELD=YIELD
|
||||
|
||||
local kickList=require"parts/kickList"
|
||||
|
||||
@@ -121,9 +121,9 @@ function Player.RND(P,a,b)
|
||||
return R:random(a,b)
|
||||
end
|
||||
function Player.newTask(P,code,...)
|
||||
local thread=ct.create(code)
|
||||
ct.resume(thread,P,...)
|
||||
if ct.status(thread)~="dead"then
|
||||
local thread=coroutine.create(code)
|
||||
coroutine.resume(thread,P,...)
|
||||
if coroutine.status(thread)~="dead"then
|
||||
P.tasks[#P.tasks+1]={
|
||||
thread=thread,
|
||||
code=code,
|
||||
@@ -147,7 +147,7 @@ end
|
||||
local function task_movePosition(P,x,y,size)
|
||||
local x1,y1,size1=P.x,P.y,P.size
|
||||
while true do
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
if (x1-x)^2+(y1-y)^2<1 then
|
||||
P:setPosition(x,y,size)
|
||||
return true
|
||||
@@ -1469,7 +1469,7 @@ end
|
||||
--------------------------<Ticks>--------------------------
|
||||
local function tick_throwBadge(ifAI,sender,time)
|
||||
while true do
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
time=time-1
|
||||
if time%4==0 then
|
||||
local S,R=sender,sender.lastRecv
|
||||
@@ -1497,7 +1497,7 @@ local function tick_throwBadge(ifAI,sender,time)
|
||||
end
|
||||
local function tick_finish(P)
|
||||
while true do
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
P.endCounter=P.endCounter+1
|
||||
if P.endCounter<40 then
|
||||
--Make field visible
|
||||
@@ -1511,7 +1511,7 @@ local function tick_finish(P)
|
||||
end
|
||||
local function tick_lose(P)
|
||||
while true do
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
P.endCounter=P.endCounter+1
|
||||
if P.endCounter<40 then
|
||||
--Make field visible
|
||||
@@ -1544,7 +1544,7 @@ end
|
||||
function tick_autoPause()
|
||||
local time=0
|
||||
while true do
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
time=time+1
|
||||
if SCN.cur~="play"or GAME.frame<180 then
|
||||
return
|
||||
|
||||
@@ -14,37 +14,37 @@ local skip
|
||||
local loadingThread=coroutine.create(function()
|
||||
for _=1,VOC.getCount()do
|
||||
VOC.loadOne()
|
||||
if _%3==0 then coroutine.yield()end
|
||||
if _%3==0 then YIELD()end
|
||||
end
|
||||
|
||||
progress=1
|
||||
for i=1,BGM.getCount()do
|
||||
BGM.loadOne()
|
||||
if i%2==0 then coroutine.yield()end
|
||||
if i%2==0 then YIELD()end
|
||||
end
|
||||
|
||||
progress=2
|
||||
for i=1,SFX.getCount()do
|
||||
SFX.loadOne()
|
||||
if i%2==0 then coroutine.yield()end
|
||||
if i%2==0 then YIELD()end
|
||||
end
|
||||
|
||||
progress=3
|
||||
for i=1,IMG.getCount()do
|
||||
IMG.loadOne()
|
||||
if i%2==0 then coroutine.yield()end
|
||||
if i%2==0 then YIELD()end
|
||||
end
|
||||
|
||||
progress=4
|
||||
for i=1,SKIN.getCount()do
|
||||
SKIN.loadOne()
|
||||
if i%2==0 then coroutine.yield()end
|
||||
if i%2==0 then YIELD()end
|
||||
end
|
||||
|
||||
progress=5
|
||||
for i=1,17 do
|
||||
getFont(15+5*i)
|
||||
if i%3==0 then coroutine.yield()end
|
||||
if i%3==0 then YIELD()end
|
||||
end
|
||||
|
||||
progress=6
|
||||
@@ -58,7 +58,7 @@ local loadingThread=coroutine.create(function()
|
||||
M.records=FILE.load("record/"..m.name..".rec")or M.score and{}
|
||||
-- M.icon=gc.newImage("media/image/modeIcon/"..m.icon..".png")
|
||||
-- M.icon=gc.newImage("media/image/modeIcon/custom.png")
|
||||
if i%5==0 then coroutine.yield()end
|
||||
if i%5==0 then YIELD()end
|
||||
end
|
||||
|
||||
progress=7
|
||||
@@ -118,7 +118,7 @@ local loadingThread=coroutine.create(function()
|
||||
VOC.play("welcome_voc")
|
||||
return
|
||||
end
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ local heartBeatTimer
|
||||
local escapeTimer=0
|
||||
|
||||
local function _init()
|
||||
coroutine.yield()
|
||||
YIELD()
|
||||
WIDGET.sel=WIDGET.active.input
|
||||
end
|
||||
local function sendMessage()
|
||||
|
||||
Reference in New Issue
Block a user