升级SKIN模块,不再需要在启动时就加载好方块贴图资源

This commit is contained in:
MrZ626
2021-07-21 04:37:35 +08:00
parent 4b2c55d90e
commit 60d1eb4e3c
24 changed files with 114 additions and 138 deletions

View File

@@ -149,7 +149,7 @@ function scene.draw()
gc.rectangle('line',-2,-2,304,604)
local F=FIELD[1]
local cross=TEXTURE.puzzleMark[-1]
local texture=SKIN.curText
local texture=SKIN.lib[SETTING.skinSet]
for y=1,20 do for x=1,10 do
local B=F[y][x]
if B>0 then

View File

@@ -273,7 +273,7 @@ function scene.draw()
gc.setLineWidth(2)
local cross=TEXTURE.puzzleMark[-1]
local F=FIELD[page]
local texture=SKIN.curText
local texture=SKIN.lib[SETTING.skinSet]
for y=1,20 do for x=1,10 do
local B=F[y][x]
if B>0 then

View File

@@ -21,11 +21,6 @@ local loadingThread=coroutine.wrap(function()
logoColor2={COLOR.rainbow_light(r)}
end
YIELD('loadSFX')SFX.loadAll()
YIELD('loadSkin')
for i=1,SKIN.getCount()do
SKIN.loadOne()
if i%math.floor(SKIN.getCount()/9)==0 then YIELD()end
end
YIELD('loadVoice')VOC.loadAll()
YIELD('loadFont')for i=1,17 do getFont(15+5*i)end
@@ -123,7 +118,6 @@ local loadingThread=coroutine.wrap(function()
end
YIELD('loadOther')
SKIN.change(SETTING.skinSet)
STAT.run=STAT.run+1
--Connect to server

View File

@@ -67,7 +67,7 @@ function scene.draw()
gc.line(400,-10,400,90)
--O mino animation
local O=SKIN.curText[SETTING.skin[6]]
local O=SKIN.lib[SETTING.skinSet][SETTING.skin[6]]
gc.draw(O,40*pos,0,nil,40/30)
gc.draw(O,40*pos,40,nil,40/30)
gc.draw(O,40*pos+40,0,nil,40/30)

View File

@@ -13,9 +13,9 @@ function scene.draw()
local t=TIME()
local b=math.floor(t*2)%16+1
gc.setColor(1,1,1)
gc.draw(SKIN.curText[b],410,540-WIDGET.scrollPos,t%6.2832,2,nil,15,15)
gc.draw(SKIN.lib[SETTING.skinSet][b],410,540-WIDGET.scrollPos,t%6.2832,2,nil,15,15)
gc.setColor(1,1,1,t*2%1)
gc.draw(SKIN.curText[b%16+1],410,540-WIDGET.scrollPos,t%6.2832,2,nil,15,15)
gc.draw(SKIN.lib[SETTING.skinSet][b%16+1],410,540-WIDGET.scrollPos,t%6.2832,2,nil,15,15)
end
scene.widgetScrollHeight=200

View File

@@ -21,7 +21,7 @@ end
function scene.draw()
local t=TIME()
gc.setColor(1,1,1)
local texture=SKIN.curText
local texture=SKIN.lib[SETTING.skinSet]
for n=1,7 do
gc.push('transform')
gc.translate(-10+140*n,340)
@@ -59,8 +59,7 @@ end
scene.widgetList={
WIDGET.newText{name="title", x=80,y=50,font=70,align='L'},
WIDGET.newButton{name="prev", x=700,y=100,w=140,h=100,fText="",font=50,code=function()SKIN.prevSet()end},
WIDGET.newButton{name="next", x=860,y=100,w=140,h=100,fText="",font=50,code=function()SKIN.nextSet()end},
WIDGET.newSelector{name="skinSet",x=780,y=100,w=260,list=SKIN.getList(),disp=SETval('skinSet'),code=SETsto('skinSet')},
WIDGET.newButton{name="prev1", x=130,y=230,w=90,h=65,fText="",code=function()prevSkin(1)end},
WIDGET.newButton{name="prev2", x=270,y=230,w=90,h=65,fText="",code=function()prevSkin(2)end},
WIDGET.newButton{name="prev3", x=410,y=230,w=90,h=65,fText="",code=function()prevSkin(3)end},

View File

@@ -16,7 +16,7 @@ function scene.draw()
gc.pop()
gc.push('transform')
gc.setColor(1,1,1)
local L=SKIN.curText
local L=SKIN.lib[SETTING.skinSet]
local T=L[1]
gc.translate(0,1410-WIDGET.scrollPos)
gc.setShader(SHADER.blockSatur)