电梯楼层灯可交互,软件锁回归

This commit is contained in:
MrZ626
2021-03-08 01:21:32 +08:00
parent ca6d3ba9e2
commit bcf1c9c7d4

View File

@@ -6,48 +6,61 @@ local scene={}
local blackTime,openTime local blackTime,openTime
local shadePhase1,shadePhase2 local shadePhase1,shadePhase2
local progress=0 local progress=-1
local studioLogo--Studio logo text object local studioLogo--Studio logo text object
local logoColor1,logoColor2 local logoColor1,logoColor2
local skip local skip
local locked
local light={}
for i=0,26 do
table.insert(light,1050+60*int(i/9))
table.insert(light,660-i%9*60)
table.insert(light,math.random()<.26)
end
light[2*3],light[6*3],light[26*3],light[27*3]=false,false,true,false
local function upFloor()
progress=progress+1
light[3*progress+3]=false
end
local loadingThread=coroutine.create(function() local loadingThread=coroutine.create(function()
for _=1,VOC.getCount()do for _=1,VOC.getCount()do
VOC.loadOne() VOC.loadOne()
if _%3==0 then YIELD()end if _%3==0 then YIELD()end
end end
progress=1 upFloor()
for i=1,BGM.getCount()do for i=1,BGM.getCount()do
BGM.loadOne() BGM.loadOne()
if i%2==0 then YIELD()end if i%2==0 then YIELD()end
end end
progress=2 upFloor()
for i=1,SFX.getCount()do for i=1,SFX.getCount()do
SFX.loadOne() SFX.loadOne()
if i%2==0 then YIELD()end if i%2==0 then YIELD()end
end end
progress=3 upFloor()
for i=1,IMG.getCount()do for i=1,IMG.getCount()do
IMG.loadOne() IMG.loadOne()
if i%2==0 then YIELD()end if i%2==0 then YIELD()end
end end
progress=4 upFloor()
for i=1,SKIN.getCount()do for i=1,SKIN.getCount()do
SKIN.loadOne() SKIN.loadOne()
if i%2==0 then YIELD()end if i%2==0 then YIELD()end
end end
progress=5 upFloor()
for i=1,17 do for i=1,17 do
getFont(15+5*i) getFont(15+5*i)
if i%3==0 then YIELD()end if i%3==0 then YIELD()end
end end
progress=6 upFloor()
for i=1,#MODES do for i=1,#MODES do
local m=MODES[i]--Mode template local m=MODES[i]--Mode template
local M=require("parts/modes/"..m.name)--Mode file local M=require("parts/modes/"..m.name)--Mode file
@@ -61,9 +74,9 @@ local loadingThread=coroutine.create(function()
if i%5==0 then YIELD()end if i%5==0 then YIELD()end
end end
progress=7 upFloor()
SKIN.change(SETTING.skinSet) SKIN.change(SETTING.skinSet)
if newVersionLaunch then--Delete old ranks & Unlock modes which should be unlocked if newVersionLaunch then--Delete old ranks & Unlock modes which should be locked
for name,rank in next,RANKS do for name,rank in next,RANKS do
local M=MODES[name] local M=MODES[name]
if type(rank)~="number"then if type(rank)~="number"then
@@ -109,8 +122,8 @@ local loadingThread=coroutine.create(function()
LOG.print(" ★☆☆★",COLOR.red) LOG.print(" ★☆☆★",COLOR.red)
end end
while true do while true do
if math.random()<.26 then if math.random()<.126 then
progress=progress+1 upFloor()
end end
if progress==25 then if progress==25 then
loadingThread=false loadingThread=false
@@ -129,6 +142,7 @@ function scene.sceneInit()
shadePhase1=6.26*math.random() shadePhase1=6.26*math.random()
shadePhase2=6.26*math.random() shadePhase2=6.26*math.random()
skip=0--Skip time skip=0--Skip time
locked=SETTING.appLock
end end
function scene.sceneBack() function scene.sceneBack()
love.event.quit() love.event.quit()
@@ -139,22 +153,39 @@ function scene.keyDown(k)
SCN.back() SCN.back()
elseif k=="s"then elseif k=="s"then
skip=999 skip=999
elseif locked and("12345679"):match(k)then
k=tonumber(k)
light[3*k]=not light[3*k]
if light[6]and light[18]then
locked=false
end
else else
skip=skip+1 skip=skip+1
end end
end end
function scene.mouseDown() function scene.mouseDown(x,y)
scene.keyDown() if locked then
end for i=1,27 do
function scene.touchDown() if(x-light[3*i-2])^2+(y-light[3*i-1])^2<=626 then
light[3*i]=not light[3*i]
if light[6]and light[18]then
locked=false
end
return
end
end
end
scene.keyDown() scene.keyDown()
end end
scene.touchDown=scene.mouseDown
function scene.update(dt) function scene.update(dt)
shadePhase1=shadePhase1+dt*2*(3.26-openTime) shadePhase1=shadePhase1+dt*2*(3.26-openTime)
shadePhase2=shadePhase2+dt*3*(3.26-openTime) shadePhase2=shadePhase2+dt*3*(3.26-openTime)
if blackTime>0 then if blackTime>0 then
blackTime=blackTime-dt blackTime=blackTime-dt
end end
if not locked then
if progress<25 then if progress<25 then
local p=progress local p=progress
::again:: ::again::
@@ -181,6 +212,7 @@ function scene.update(dt)
SCN.swapTo("intro") SCN.swapTo("intro")
end end
end end
end
end end
local function doorStencil() local function doorStencil()
@@ -241,27 +273,34 @@ function scene.draw()
--Floor info frame --Floor info frame
gc.setColor(.1,.1,.1) gc.setColor(.1,.1,.1)
gc.rectangle("fill",1110-80,25,160,100) gc.rectangle("fill",1020,25,180,100)
gc.setColor(.7,.7,.7) gc.setColor(.7,.7,.7)
gc.setLineWidth(4) gc.setLineWidth(4)
gc.rectangle("line",1110-80,25,160,100) gc.rectangle("line",1020,25,180,100)
--Floor info --Floor info
if progress>=0 then
local d1=(progress+1)%10 local d1=(progress+1)%10
local d2=int((progress+1)/10) local d2=int((progress+1)/10)
gc.setColor(.6,.6,.6) gc.setColor(.6,.6,.6)
gc.draw(TEXTURE.pixelNum[d2],1060,40-3,nil,8) gc.draw(TEXTURE.pixelNum[d2],1040,40-3,nil,8)
gc.draw(TEXTURE.pixelNum[d1],1120,40-3,nil,8) gc.draw(TEXTURE.pixelNum[d1],1100,40-3,nil,8)
gc.setColor(1,1,1) gc.setColor(1,1,1)
gc.draw(TEXTURE.pixelNum[d2],1060,40,nil,8) gc.draw(TEXTURE.pixelNum[d2],1040,40,nil,8)
gc.draw(TEXTURE.pixelNum[d1],1120,40,nil,8) gc.draw(TEXTURE.pixelNum[d1],1100,40,nil,8)
if not locked and progress~=25 then
setFont(40)
gc.setColor(1,.9,.8)
gc.print("",1150,26)
end
end
--Elevator buttons --Elevator buttons
gc.setLineWidth(3) gc.setLineWidth(3)
setFont(25) setFont(25)
for i=0,25 do for i=0,26 do
local x,y=1050+60*int(i/9),180+i%9*60 local x,y=light[3*i+1],light[3*i+2]
gc.setColor(COLOR[i==progress and"dOrange"or"dGrey"]) gc.setColor(COLOR[i==progress and"grey"or light[3*i+3]and"dOrange"or"dGrey"])
gc.circle("fill",x,y,23) gc.circle("fill",x,y,23)
gc.setColor(.16,.16,.16) gc.setColor(.16,.16,.16)
gc.circle("line",x,y,23) gc.circle("line",x,y,23)