整理代码,大规模整理(展开)使用次数不多的局部变量名

框架跟进
This commit is contained in:
MrZ_26
2022-09-10 03:02:00 +08:00
parent ad4365faab
commit f3d08bae1a
106 changed files with 507 additions and 614 deletions

View File

@@ -1,7 +1,4 @@
local gc=love.graphics
local max,min,sin,cos=math.max,math.min,math.sin,math.cos
local rnd=math.random
local scene={}
@@ -12,11 +9,11 @@ local studioLogo--Studio logo text object
local logoColor1,logoColor2
local titleTransform={
function(t)gc.translate(0,max(50-t,0)^2/25)end,
function(t)gc.translate(0,-max(50-t,0)^2/25)end,
function(t,i)local d=max(50-t,0)gc.translate(sin(TIME()*3+626*i)*d,cos(TIME()*3+626*i)*d)end,
function(t,i)local d=max(50-t,0)gc.translate(sin(TIME()*3+626*i)*d,-cos(TIME()*3+626*i)*d)end,
function(t)gc.setColor(1,1,1,min(t*.02,1)+rnd()*.2)end,
function(t)GC.translate(0,max(50-t,0)^2/25)end,
function(t)GC.translate(0,-max(50-t,0)^2/25)end,
function(t,i)local d=max(50-t,0)GC.translate(sin(TIME()*3+626*i)*d,cos(TIME()*3+626*i)*d)end,
function(t,i)local d=max(50-t,0)GC.translate(sin(TIME()*3+626*i)*d,-cos(TIME()*3+626*i)*d)end,
function(t)GC.setColor(1,1,1,min(t*.02,1)+math.random()*.2)end,
}
local loadingThread=coroutine.wrap(function()
@@ -97,7 +94,7 @@ local loadingThread=coroutine.wrap(function()
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"))
M.icon=M.icon and(modeIcons[M.icon]or GC.newImage("media/image/modeicon/"..M.icon..".png"))
end
YIELD('loadOther')
@@ -119,11 +116,11 @@ local loadingThread=coroutine.wrap(function()
end)
function scene.sceneInit()
studioLogo=gc.newText(getFont(90),"26F Studio")
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]=rnd(#titleTransform)end--Random animation type
animeType={}for i=1,#SVG_TITLE_FILL do animeType[i]=math.random(#titleTransform)end--Random animation type
end
function scene.sceneBack()
love.event.quit()
@@ -159,45 +156,45 @@ end
local titleColor={COLOR.P,COLOR.F,COLOR.V,COLOR.A,COLOR.M,COLOR.N,COLOR.W,COLOR.Y}
function scene.draw()
gc.clear(.08,.08,.084)
GC.clear(.08,.08,.084)
local T=(t1+110)%300
if T<30 then
gc.setLineWidth(4+(30-T)^1.626/62)
GC.setLineWidth(4+(30-T)^1.626/62)
else
gc.setLineWidth(4)
GC.setLineWidth(4)
end
gc.push('transform')
gc.translate(126,100)
GC.push('transform')
GC.translate(126,100)
for i=1,#SVG_TITLE_FILL do
local triangles=love.math.triangulate(SVG_TITLE_FILL[i])
local t=t1-i*15
if t>0 then
gc.push('transform')
GC.push('transform')
titleTransform[animeType[i]](t,i)
local dt=(t1+62-5*i)%300
if dt<20 then
gc.translate(0,math.abs(10-dt)-10)
GC.translate(0,math.abs(10-dt)-10)
end
gc.setColor(titleColor[i][1],titleColor[i][2],titleColor[i][3],min(t*.025,1)*.2)
GC.setColor(titleColor[i][1],titleColor[i][2],titleColor[i][3],min(t*.025,1)*.2)
for j=1,#triangles do
gc.polygon('fill',triangles[j])
GC.polygon('fill',triangles[j])
end
gc.setColor(1,1,1,min(t*.025,1))
gc.polygon('line',SVG_TITLE_LINE[i])
if i==8 then gc.polygon('line',SVG_TITLE_LINE[9])end
gc.pop()
GC.setColor(1,1,1,min(t*.025,1))
GC.polygon('line',SVG_TITLE_LINE[i])
if i==8 then GC.polygon('line',SVG_TITLE_LINE[9])end
GC.pop()
end
end
gc.pop()
GC.pop()
gc.setColor(logoColor1[1],logoColor1[2],logoColor1[3],progress/maxProgress)mDraw(studioLogo,640,400)
gc.setColor(logoColor2[1],logoColor2[2],logoColor2[3],progress/maxProgress)for dx=-2,2,2 do for dy=-2,2,2 do mDraw(studioLogo,640+dx,400+dy)end end
gc.setColor(.2,.2,.2,progress/maxProgress)mDraw(studioLogo,640,400)
GC.setColor(logoColor1[1],logoColor1[2],logoColor1[3],progress/maxProgress)mDraw(studioLogo,640,400)
GC.setColor(logoColor2[1],logoColor2[2],logoColor2[3],progress/maxProgress)for dx=-2,2,2 do for dy=-2,2,2 do mDraw(studioLogo,640+dx,400+dy)end end
GC.setColor(.2,.2,.2,progress/maxProgress)mDraw(studioLogo,640,400)
gc.setColor(COLOR.Z)
GC.setColor(COLOR.Z)
setFont(30)
mStr(text.loadText[loading]or"",640,530)
GC.mStr(text.loadText[loading]or"",640,530)
end
return scene