升级SKIN模块,不再需要在启动时就加载好方块贴图资源
This commit is contained in:
@@ -33,6 +33,7 @@
|
|||||||
irs true 提前旋转
|
irs true 提前旋转
|
||||||
ims true 提前移动
|
ims true 提前移动
|
||||||
|
|
||||||
|
skinSet [设置值] 方块贴图,只能填写内置皮肤的名字
|
||||||
skin [设置值] 方块颜色,包含25个整数(1~16)的table
|
skin [设置值] 方块颜色,包含25个整数(1~16)的table
|
||||||
face [设置值] 方块朝向,包含25个整数(0~3)的table
|
face [设置值] 方块朝向,包含25个整数(0~3)的table
|
||||||
|
|
||||||
|
|||||||
55
main.lua
55
main.lua
@@ -126,33 +126,33 @@ IMG.init{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
SKIN.init{
|
SKIN.init{
|
||||||
'crystal_scf',
|
{name="crystal_scf",path='media/image/skin/crystal_scf.png'},
|
||||||
'matte_mrz',
|
{name="matte_mrz",path='media/image/skin/matte_mrz.png'},
|
||||||
'contrast_mrz',
|
{name="contrast_mrz",path='media/image/skin/contrast_mrz.png'},
|
||||||
'polkadots_scf',
|
{name="polkadots_scf",path='media/image/skin/polkadots_scf.png'},
|
||||||
'toy_scf',
|
{name="toy_scf",path='media/image/skin/toy_scf.png'},
|
||||||
'smooth_mrz',
|
{name="smooth_mrz",path='media/image/skin/smooth_mrz.png'},
|
||||||
'simple_scf',
|
{name="simple_scf",path='media/image/skin/simple_scf.png'},
|
||||||
'glass_scf',
|
{name="glass_scf",path='media/image/skin/glass_scf.png'},
|
||||||
'penta_scf',
|
{name="penta_scf",path='media/image/skin/penta_scf.png'},
|
||||||
'bubble_scf',
|
{name="bubble_scf",path='media/image/skin/bubble_scf.png'},
|
||||||
'minoes_scf',
|
{name="minoes_scf",path='media/image/skin/minoes_scf.png'},
|
||||||
'pure_mrz',
|
{name="pure_mrz",path='media/image/skin/pure_mrz.png'},
|
||||||
'bright_scf',
|
{name="bright_scf",path='media/image/skin/bright_scf.png'},
|
||||||
'glow_mrz',
|
{name="glow_mrz",path='media/image/skin/glow_mrz.png'},
|
||||||
'plastic_mrz',
|
{name="plastic_mrz",path='media/image/skin/plastic_mrz.png'},
|
||||||
'paper_mrz',
|
{name="paper_mrz",path='media/image/skin/paper_mrz.png'},
|
||||||
'yinyang_scf',
|
{name="yinyang_scf",path='media/image/skin/yinyang_scf.png'},
|
||||||
'cartooncup_earety',
|
{name="cartooncup_earety",path='media/image/skin/cartooncup_earety.png'},
|
||||||
'jelly_miya',
|
{name="jelly_miya",path='media/image/skin/jelly_miya.png'},
|
||||||
'brick_notypey',
|
{name="brick_notypey",path='media/image/skin/brick_notypey.png'},
|
||||||
'gem_notypey',
|
{name="gem_notypey",path='media/image/skin/gem_notypey.png'},
|
||||||
'classic',
|
{name="classic",path='media/image/skin/classic.png'},
|
||||||
'ball_shaw',
|
{name="ball_shaw",path='media/image/skin/ball_shaw.png'},
|
||||||
'retro_notypey',
|
{name="retro_notypey",path='media/image/skin/retro_notypey.png'},
|
||||||
'textbone_mrz',
|
{name="textbone_mrz",path='media/image/skin/textbone_mrz.png'},
|
||||||
'coloredbone_mrz',
|
{name="coloredbone_mrz",path='media/image/skin/coloredbone_mrz.png'},
|
||||||
'wtf',
|
{name="wtf",path='media/image/skin/wtf.png'},
|
||||||
}
|
}
|
||||||
|
|
||||||
--Initialize sound libs
|
--Initialize sound libs
|
||||||
@@ -272,6 +272,7 @@ do
|
|||||||
needSave=true
|
needSave=true
|
||||||
end
|
end
|
||||||
if not SETTING.VKSkin then SETTING.VKSkin=1 end
|
if not SETTING.VKSkin then SETTING.VKSkin=1 end
|
||||||
|
if type(SETTING.skinSet)=='number'then SETTING.skinSet='crystal_scf'end
|
||||||
if not TABLE.find({8,10,13,17,22,29,37,47,62,80,100},SETTING.frameMul)then
|
if not TABLE.find({8,10,13,17,22,29,37,47,62,80,100},SETTING.frameMul)then
|
||||||
SETTING.frameMul=100
|
SETTING.frameMul=100
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ function back.update()
|
|||||||
rotate=6.2832*rnd(),
|
rotate=6.2832*rnd(),
|
||||||
va=.05-rnd()*.1,
|
va=.05-rnd()*.1,
|
||||||
size=SCR.rad*(2+rnd()*3)/100,
|
size=SCR.rad*(2+rnd()*3)/100,
|
||||||
texture=SKIN.curText[rnd(16)],
|
texture=SKIN.lib[SETTING.skinSet][rnd(16)],
|
||||||
}
|
}
|
||||||
ins(squares,S)
|
ins(squares,S)
|
||||||
t=rnd(6,12)
|
t=rnd(6,12)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ function back.update()
|
|||||||
k=k,
|
k=k,
|
||||||
vy=k*2,
|
vy=k*2,
|
||||||
block=B,
|
block=B,
|
||||||
texture=SKIN.curText[SETTING.skin[r]],
|
texture=SKIN.lib[SETTING.skinSet][SETTING.skin[r]],
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
for i=#mino,1,-1 do
|
for i=#mino,1,-1 do
|
||||||
|
|||||||
@@ -305,7 +305,7 @@ SETTING={--Settings
|
|||||||
fine=false,
|
fine=false,
|
||||||
simpMode=false,
|
simpMode=false,
|
||||||
lang=1,
|
lang=1,
|
||||||
skinSet=1,
|
skinSet='crystal_scf',
|
||||||
skin={
|
skin={
|
||||||
1,7,11,3,14,4,9,
|
1,7,11,3,14,4,9,
|
||||||
1,7,2,6,10,2,13,5,9,15,10,11,3,12,2,16,8,4,
|
1,7,2,6,10,2,13,5,9,15,10,11,3,12,2,16,8,4,
|
||||||
|
|||||||
@@ -417,6 +417,7 @@ return{
|
|||||||
restart="Retry",
|
restart="Retry",
|
||||||
},
|
},
|
||||||
setting_skin={
|
setting_skin={
|
||||||
|
skinSet="Block Skin",
|
||||||
title="Layout Settings",
|
title="Layout Settings",
|
||||||
spin1="R",spin2="R",spin3="R",spin4="R",spin5="R",spin6="R",spin7="R",
|
spin1="R",spin2="R",spin3="R",spin4="R",spin5="R",spin6="R",spin7="R",
|
||||||
skinR="Reset Color",
|
skinR="Reset Color",
|
||||||
|
|||||||
@@ -379,6 +379,7 @@ return{
|
|||||||
restart="Reiniciar",
|
restart="Reiniciar",
|
||||||
},
|
},
|
||||||
setting_skin={
|
setting_skin={
|
||||||
|
-- skinSet="Block Skin",
|
||||||
title="Ajustes de Texturas",
|
title="Ajustes de Texturas",
|
||||||
skinR="Color por def.",
|
skinR="Color por def.",
|
||||||
faceR="Direc. por def.",
|
faceR="Direc. por def.",
|
||||||
|
|||||||
@@ -378,6 +378,7 @@ return{
|
|||||||
restart="Réessayer",
|
restart="Réessayer",
|
||||||
},
|
},
|
||||||
setting_skin={
|
setting_skin={
|
||||||
|
-- skinSet="Block Skin",
|
||||||
title="Disposition",
|
title="Disposition",
|
||||||
spin1="R",spin2="R",spin3="R",spin4="R",spin5="R",spin6="R",spin7="R",
|
spin1="R",spin2="R",spin3="R",spin4="R",spin5="R",spin6="R",spin7="R",
|
||||||
skinR="Réinit. Couleur",
|
skinR="Réinit. Couleur",
|
||||||
|
|||||||
@@ -404,6 +404,7 @@ return{
|
|||||||
restart="Reiniciar",
|
restart="Reiniciar",
|
||||||
},
|
},
|
||||||
setting_skin={
|
setting_skin={
|
||||||
|
-- skinSet="Block Skin",
|
||||||
title="Config. Layout",
|
title="Config. Layout",
|
||||||
spin1="R",spin2="R",spin3="R",spin4="R",spin5="R",spin6="R",spin7="R",
|
spin1="R",spin2="R",spin3="R",spin4="R",spin5="R",spin6="R",spin7="R",
|
||||||
skinR="Reset Cor",
|
skinR="Reset Cor",
|
||||||
|
|||||||
@@ -232,6 +232,7 @@ return{
|
|||||||
restart="_→_",
|
restart="_→_",
|
||||||
},
|
},
|
||||||
setting_skin={
|
setting_skin={
|
||||||
|
skinSet="[x]?",
|
||||||
title="%{~~}",
|
title="%{~~}",
|
||||||
skinR="R @%&",
|
skinR="R @%&",
|
||||||
faceR="R ↑↓←→.",
|
faceR="R ↑↓←→.",
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ return{
|
|||||||
reset="重设",
|
reset="重设",
|
||||||
},
|
},
|
||||||
setting_skin={
|
setting_skin={
|
||||||
|
skinSet="皮肤",
|
||||||
title="改外观",
|
title="改外观",
|
||||||
},
|
},
|
||||||
setting_touchSwitch={
|
setting_touchSwitch={
|
||||||
|
|||||||
@@ -416,6 +416,7 @@ return{
|
|||||||
restart="重新开始",
|
restart="重新开始",
|
||||||
},
|
},
|
||||||
setting_skin={
|
setting_skin={
|
||||||
|
skinSet="方块皮肤",
|
||||||
title="外观设置",
|
title="外观设置",
|
||||||
spin1="R",spin2="R",spin3="R",spin4="R",spin5="R",spin6="R",spin7="R",
|
spin1="R",spin2="R",spin3="R",spin4="R",spin5="R",spin6="R",spin7="R",
|
||||||
skinR="重置配色",
|
skinR="重置配色",
|
||||||
|
|||||||
@@ -96,8 +96,7 @@ local function applyFieldOffset(P,notNorm)
|
|||||||
end
|
end
|
||||||
local function stencilBoard()gc_rectangle('fill',0,-10,300,610)end
|
local function stencilBoard()gc_rectangle('fill',0,-10,300,610)end
|
||||||
|
|
||||||
local function drawRow(h,V,L,showInvis)
|
local function drawRow(texture,h,V,L,showInvis)
|
||||||
local texture=SKIN.curText
|
|
||||||
local t=TIME()*4
|
local t=TIME()*4
|
||||||
for i=1,10 do
|
for i=1,10 do
|
||||||
if L[i]>0 then
|
if L[i]>0 then
|
||||||
@@ -116,20 +115,20 @@ local function drawField(P)
|
|||||||
local V,F=P.visTime,P.field
|
local V,F=P.visTime,P.field
|
||||||
local start=int((P.fieldBeneath+P.fieldUp)/30+1)
|
local start=int((P.fieldBeneath+P.fieldUp)/30+1)
|
||||||
local showInvis=GAME.replaying
|
local showInvis=GAME.replaying
|
||||||
|
local texture=P.skinLib
|
||||||
if P.falling==-1 then--Blocks only
|
if P.falling==-1 then--Blocks only
|
||||||
if ENV.upEdge then
|
if ENV.upEdge then
|
||||||
gc_setShader(shader_lighter)
|
gc_setShader(shader_lighter)
|
||||||
gc_translate(0,-4)
|
gc_translate(0,-4)
|
||||||
--<drawRow>
|
--<drawRow>
|
||||||
for j=start,min(start+21,#F)do drawRow(j,V[j],F[j])end
|
for j=start,min(start+21,#F)do drawRow(texture,j,V[j],F[j])end
|
||||||
--</drawRow>
|
--</drawRow>
|
||||||
gc_setShader(shader_fieldSatur)
|
gc_setShader(shader_fieldSatur)
|
||||||
gc_translate(0,4)
|
gc_translate(0,4)
|
||||||
end
|
end
|
||||||
|
|
||||||
--<drawRow>
|
--<drawRow>
|
||||||
for j=start,min(start+21,#F)do drawRow(j,V[j],F[j],showInvis)end
|
for j=start,min(start+21,#F)do drawRow(texture,j,V[j],F[j],showInvis)end
|
||||||
--</drawRow>
|
--</drawRow>
|
||||||
else--With falling animation
|
else--With falling animation
|
||||||
local stepY=ENV.smooth and(P.falling/(ENV.fall+1))^2.5*30 or 30
|
local stepY=ENV.smooth and(P.falling/(ENV.fall+1))^2.5*30 or 30
|
||||||
@@ -145,7 +144,7 @@ local function drawField(P)
|
|||||||
h=h+1
|
h=h+1
|
||||||
gc_translate(0,-stepY)
|
gc_translate(0,-stepY)
|
||||||
end
|
end
|
||||||
drawRow(j,V[j],F[j])
|
drawRow(texture,j,V[j],F[j])
|
||||||
end
|
end
|
||||||
--</drawRow>
|
--</drawRow>
|
||||||
gc_setShader(shader_fieldSatur)
|
gc_setShader(shader_fieldSatur)
|
||||||
@@ -162,7 +161,7 @@ local function drawField(P)
|
|||||||
gc_setColor(1,1,1,alpha)
|
gc_setColor(1,1,1,alpha)
|
||||||
gc_rectangle('fill',0,30-30*j,300,stepY)
|
gc_rectangle('fill',0,30-30*j,300,stepY)
|
||||||
end
|
end
|
||||||
drawRow(j,V[j],F[j],showInvis)
|
drawRow(texture,j,V[j],F[j],showInvis)
|
||||||
end
|
end
|
||||||
--</drawRow>
|
--</drawRow>
|
||||||
gc_pop()
|
gc_pop()
|
||||||
@@ -191,7 +190,7 @@ local function drawFXs(P)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--MoveFX
|
--MoveFX
|
||||||
local texture=SKIN.curText
|
local texture=P.skinLib
|
||||||
for i=1,#P.moveFX do
|
for i=1,#P.moveFX do
|
||||||
local S=P.moveFX[i]
|
local S=P.moveFX[i]
|
||||||
gc_setColor(1,1,1,.6-S[4]*.6)
|
gc_setColor(1,1,1,.6-S[4]*.6)
|
||||||
@@ -211,7 +210,7 @@ end
|
|||||||
local drawGhost={
|
local drawGhost={
|
||||||
color=function(P,clr,alpha)
|
color=function(P,clr,alpha)
|
||||||
gc_setColor(1,1,1,alpha)
|
gc_setColor(1,1,1,alpha)
|
||||||
local texture=SKIN.curText
|
local texture=P.skinLib
|
||||||
local CB=P.cur.bk
|
local CB=P.cur.bk
|
||||||
for i=1,#CB do for j=1,#CB[1]do
|
for i=1,#CB do for j=1,#CB[1]do
|
||||||
if CB[i][j]then
|
if CB[i][j]then
|
||||||
@@ -221,7 +220,7 @@ local drawGhost={
|
|||||||
end,
|
end,
|
||||||
gray=function(P,_,alpha)
|
gray=function(P,_,alpha)
|
||||||
gc_setColor(1,1,1,alpha)
|
gc_setColor(1,1,1,alpha)
|
||||||
local texture=SKIN.curText
|
local texture=P.skinLib
|
||||||
local CB=P.cur.bk
|
local CB=P.cur.bk
|
||||||
for i=1,#CB do for j=1,#CB[1]do
|
for i=1,#CB do for j=1,#CB[1]do
|
||||||
if CB[i][j]then
|
if CB[i][j]then
|
||||||
@@ -298,7 +297,7 @@ end
|
|||||||
local function drawBlock(P,clr)
|
local function drawBlock(P,clr)
|
||||||
gc_setColor(1,1,1)
|
gc_setColor(1,1,1)
|
||||||
gc_setShader(shader_blockSatur)
|
gc_setShader(shader_blockSatur)
|
||||||
local texture=SKIN.curText[clr]
|
local texture=P.skinLib[clr]
|
||||||
local CB=P.cur.bk
|
local CB=P.cur.bk
|
||||||
for i=1,#CB do for j=1,#CB[1]do
|
for i=1,#CB do for j=1,#CB[1]do
|
||||||
if CB[i][j]then
|
if CB[i][j]then
|
||||||
@@ -420,7 +419,7 @@ local function drawHold(P)
|
|||||||
for n=1,#holdQueue do
|
for n=1,#holdQueue do
|
||||||
if n==N then gc_setColor(.6,.4,.4)end
|
if n==N then gc_setColor(.6,.4,.4)end
|
||||||
local bk,clr=holdQueue[n].bk,holdQueue[n].color
|
local bk,clr=holdQueue[n].bk,holdQueue[n].color
|
||||||
local texture=SKIN.curText[clr]
|
local texture=P.skinLib[clr]
|
||||||
local k=#bk>2 and 2.2/#bk or 1
|
local k=#bk>2 and 2.2/#bk or 1
|
||||||
gc_scale(k)
|
gc_scale(k)
|
||||||
for i=1,#bk do for j=1,#bk[1]do
|
for i=1,#bk do for j=1,#bk[1]do
|
||||||
@@ -539,7 +538,7 @@ draw.applyFieldOffset=applyFieldOffset
|
|||||||
draw.drawGhost=drawGhost
|
draw.drawGhost=drawGhost
|
||||||
function draw.drawNext_norm(P)
|
function draw.drawNext_norm(P)
|
||||||
local ENV=P.gameEnv
|
local ENV=P.gameEnv
|
||||||
local texture=SKIN.curText
|
local texture=P.skinLib
|
||||||
gc_translate(316,20)
|
gc_translate(316,20)
|
||||||
local N=ENV.nextCount*72
|
local N=ENV.nextCount*72
|
||||||
gc_setColor(0,0,0,.4)gc_rectangle('fill',0,0,124,N+8)
|
gc_setColor(0,0,0,.4)gc_rectangle('fill',0,0,124,N+8)
|
||||||
@@ -574,7 +573,7 @@ function draw.drawNext_norm(P)
|
|||||||
end
|
end
|
||||||
function draw.drawNext_hidden(P)
|
function draw.drawNext_hidden(P)
|
||||||
local ENV=P.gameEnv
|
local ENV=P.gameEnv
|
||||||
local texture=SKIN.curText
|
local texture=P.skinLib
|
||||||
gc_translate(316,20)
|
gc_translate(316,20)
|
||||||
local N=ENV.nextCount*72
|
local N=ENV.nextCount*72
|
||||||
gc_setColor(.5,0,0,.4)gc_rectangle('fill',0,0,124,N+8)
|
gc_setColor(.5,0,0,.4)gc_rectangle('fill',0,0,124,N+8)
|
||||||
@@ -699,7 +698,7 @@ function draw.norm(P)
|
|||||||
gc_translate(0,-dy)
|
gc_translate(0,-dy)
|
||||||
--Draw block & rotation center
|
--Draw block & rotation center
|
||||||
if ENV.block then
|
if ENV.block then
|
||||||
drawBlockOutline(P,SKIN.curText[curColor],trans)
|
drawBlockOutline(P,P.skinLib[curColor],trans)
|
||||||
drawBlock(P,curColor)
|
drawBlock(P,curColor)
|
||||||
if ENV.center then
|
if ENV.center then
|
||||||
gc_setColor(1,1,1,ENV.center)
|
gc_setColor(1,1,1,ENV.center)
|
||||||
@@ -833,7 +832,7 @@ function draw.small(P)
|
|||||||
|
|
||||||
--Field
|
--Field
|
||||||
local F=P.field
|
local F=P.field
|
||||||
local texture=SKIN.curTextMini
|
local texture=SKIN.libMini[SETTING.skinSet]
|
||||||
for j=1,#F do
|
for j=1,#F do
|
||||||
for i=1,10 do if F[j][i]>0 then
|
for i=1,10 do if F[j][i]>0 then
|
||||||
gc_draw(texture[F[j][i]],6*i-6,120-6*j)
|
gc_draw(texture[F[j][i]],6*i-6,120-6*j)
|
||||||
@@ -902,7 +901,7 @@ function draw.demo(P)
|
|||||||
if ENV.block then
|
if ENV.block then
|
||||||
local dy=ENV.smooth and P.ghoY~=P.curY and(P.dropDelay/ENV.drop-1)*30 or 0
|
local dy=ENV.smooth and P.ghoY~=P.curY and(P.dropDelay/ENV.drop-1)*30 or 0
|
||||||
gc_translate(0,-dy)
|
gc_translate(0,-dy)
|
||||||
drawBlockOutline(P,SKIN.curText[curColor],P.lockDelay/ENV.lock)
|
drawBlockOutline(P,P.skinLib[curColor],P.lockDelay/ENV.lock)
|
||||||
drawBlock(P,curColor)
|
drawBlock(P,curColor)
|
||||||
gc_translate(0,dy)
|
gc_translate(0,dy)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ return{
|
|||||||
RS='TRS',
|
RS='TRS',
|
||||||
sequence='bag',
|
sequence='bag',
|
||||||
seqData={1,2,3,4,5,6,7},
|
seqData={1,2,3,4,5,6,7},
|
||||||
|
skinSet='crystal_scf',
|
||||||
face=false,skin=false,
|
face=false,skin=false,
|
||||||
mission=false,
|
mission=false,
|
||||||
|
|
||||||
|
|||||||
@@ -293,6 +293,8 @@ local function applyGameEnv(P)--Finish gameEnv processing
|
|||||||
P.keyAvailable[v]=false
|
P.keyAvailable[v]=false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
P.skinLib=SKIN.lib[ENV.skinSet]
|
||||||
|
|
||||||
P:setInvisible(
|
P:setInvisible(
|
||||||
ENV.visible=='show'and -1 or
|
ENV.visible=='show'and -1 or
|
||||||
ENV.visible=='easy'and 300 or
|
ENV.visible=='easy'and 300 or
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ function Player:createSplashFX(h)
|
|||||||
if c>0 then
|
if c>0 then
|
||||||
SYSFX.newCell(
|
SYSFX.newCell(
|
||||||
2.5-self.gameEnv.splashFX*.4,
|
2.5-self.gameEnv.splashFX*.4,
|
||||||
SKIN.curText[c],
|
self.skinLib[c],
|
||||||
size,
|
size,
|
||||||
self.fieldX+(30*x-15)*size,y-30*h*size,
|
self.fieldX+(30*x-15)*size,y-30*h*size,
|
||||||
rnd()*5-2.5,rnd()*-1,
|
rnd()*5-2.5,rnd()*-1,
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ function scene.draw()
|
|||||||
gc.rectangle('line',-2,-2,304,604)
|
gc.rectangle('line',-2,-2,304,604)
|
||||||
local F=FIELD[1]
|
local F=FIELD[1]
|
||||||
local cross=TEXTURE.puzzleMark[-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
|
for y=1,20 do for x=1,10 do
|
||||||
local B=F[y][x]
|
local B=F[y][x]
|
||||||
if B>0 then
|
if B>0 then
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ function scene.draw()
|
|||||||
gc.setLineWidth(2)
|
gc.setLineWidth(2)
|
||||||
local cross=TEXTURE.puzzleMark[-1]
|
local cross=TEXTURE.puzzleMark[-1]
|
||||||
local F=FIELD[page]
|
local F=FIELD[page]
|
||||||
local texture=SKIN.curText
|
local texture=SKIN.lib[SETTING.skinSet]
|
||||||
for y=1,20 do for x=1,10 do
|
for y=1,20 do for x=1,10 do
|
||||||
local B=F[y][x]
|
local B=F[y][x]
|
||||||
if B>0 then
|
if B>0 then
|
||||||
|
|||||||
@@ -21,11 +21,6 @@ local loadingThread=coroutine.wrap(function()
|
|||||||
logoColor2={COLOR.rainbow_light(r)}
|
logoColor2={COLOR.rainbow_light(r)}
|
||||||
end
|
end
|
||||||
YIELD('loadSFX')SFX.loadAll()
|
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('loadVoice')VOC.loadAll()
|
||||||
YIELD('loadFont')for i=1,17 do getFont(15+5*i)end
|
YIELD('loadFont')for i=1,17 do getFont(15+5*i)end
|
||||||
|
|
||||||
@@ -123,7 +118,6 @@ local loadingThread=coroutine.wrap(function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
YIELD('loadOther')
|
YIELD('loadOther')
|
||||||
SKIN.change(SETTING.skinSet)
|
|
||||||
STAT.run=STAT.run+1
|
STAT.run=STAT.run+1
|
||||||
|
|
||||||
--Connect to server
|
--Connect to server
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ function scene.draw()
|
|||||||
gc.line(400,-10,400,90)
|
gc.line(400,-10,400,90)
|
||||||
|
|
||||||
--O mino animation
|
--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,0,nil,40/30)
|
||||||
gc.draw(O,40*pos,40,nil,40/30)
|
gc.draw(O,40*pos,40,nil,40/30)
|
||||||
gc.draw(O,40*pos+40,0,nil,40/30)
|
gc.draw(O,40*pos+40,0,nil,40/30)
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ function scene.draw()
|
|||||||
local t=TIME()
|
local t=TIME()
|
||||||
local b=math.floor(t*2)%16+1
|
local b=math.floor(t*2)%16+1
|
||||||
gc.setColor(1,1,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.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
|
end
|
||||||
|
|
||||||
scene.widgetScrollHeight=200
|
scene.widgetScrollHeight=200
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ end
|
|||||||
function scene.draw()
|
function scene.draw()
|
||||||
local t=TIME()
|
local t=TIME()
|
||||||
gc.setColor(1,1,1)
|
gc.setColor(1,1,1)
|
||||||
local texture=SKIN.curText
|
local texture=SKIN.lib[SETTING.skinSet]
|
||||||
for n=1,7 do
|
for n=1,7 do
|
||||||
gc.push('transform')
|
gc.push('transform')
|
||||||
gc.translate(-10+140*n,340)
|
gc.translate(-10+140*n,340)
|
||||||
@@ -59,8 +59,7 @@ end
|
|||||||
scene.widgetList={
|
scene.widgetList={
|
||||||
WIDGET.newText{name="title", x=80,y=50,font=70,align='L'},
|
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.newSelector{name="skinSet",x=780,y=100,w=260,list=SKIN.getList(),disp=SETval('skinSet'),code=SETsto('skinSet')},
|
||||||
WIDGET.newButton{name="next", x=860,y=100,w=140,h=100,fText="→",font=50,code=function()SKIN.nextSet()end},
|
|
||||||
WIDGET.newButton{name="prev1", x=130,y=230,w=90,h=65,fText="↑",code=function()prevSkin(1)end},
|
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="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},
|
WIDGET.newButton{name="prev3", x=410,y=230,w=90,h=65,fText="↑",code=function()prevSkin(3)end},
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ function scene.draw()
|
|||||||
gc.pop()
|
gc.pop()
|
||||||
gc.push('transform')
|
gc.push('transform')
|
||||||
gc.setColor(1,1,1)
|
gc.setColor(1,1,1)
|
||||||
local L=SKIN.curText
|
local L=SKIN.lib[SETTING.skinSet]
|
||||||
local T=L[1]
|
local T=L[1]
|
||||||
gc.translate(0,1410-WIDGET.scrollPos)
|
gc.translate(0,1410-WIDGET.scrollPos)
|
||||||
gc.setShader(SHADER.blockSatur)
|
gc.setShader(SHADER.blockSatur)
|
||||||
|
|||||||
122
parts/skin.lua
122
parts/skin.lua
@@ -1,82 +1,54 @@
|
|||||||
local SKIN={
|
local SKIN={}
|
||||||
getCount=function()return 0 end,
|
|
||||||
loadOne=function()error("Cannot load before init!")end,
|
|
||||||
loadAll=function()error("Cannot load before init!")end,
|
|
||||||
prevSet=NULL,
|
|
||||||
nextSet=NULL,
|
|
||||||
prev=NULL,
|
|
||||||
next=NULL,
|
|
||||||
rotate=NULL,
|
|
||||||
change=NULL,
|
|
||||||
}
|
|
||||||
function SKIN.init(list)
|
function SKIN.init(list)
|
||||||
|
local Skins={}
|
||||||
|
|
||||||
|
local simpList={}
|
||||||
|
for _,v in next,list do
|
||||||
|
table.insert(simpList,v.name)
|
||||||
|
Skins[v.name]=v.path
|
||||||
|
end
|
||||||
|
function SKIN.getList()return simpList end
|
||||||
|
|
||||||
local gc=love.graphics
|
local gc=love.graphics
|
||||||
local int=math.floor
|
|
||||||
local function C(x,y)
|
local function C(x,y)
|
||||||
local _=gc.newCanvas(x,y)
|
local canvas=gc.newCanvas(x,y)
|
||||||
gc.setCanvas(_)
|
gc.setCanvas(canvas)
|
||||||
return _
|
return canvas
|
||||||
end
|
|
||||||
local count=#list function SKIN.getCount()return count end
|
|
||||||
SKIN.lib={}
|
|
||||||
SKIN.libMini={}
|
|
||||||
|
|
||||||
local function load(skip)
|
|
||||||
for i=1,count do
|
|
||||||
gc.push()
|
|
||||||
gc.origin()
|
|
||||||
gc.setDefaultFilter('nearest','nearest')
|
|
||||||
gc.setColor(1,1,1)
|
|
||||||
SKIN.lib[i],SKIN.libMini[i]={},{}
|
|
||||||
local N="media/image/skin/"..list[i]..".png"
|
|
||||||
local I
|
|
||||||
if love.filesystem.getInfo(N)then
|
|
||||||
I=gc.newImage(N)
|
|
||||||
else
|
|
||||||
I=gc.newImage("media/image/skin/"..list[1]..".png")
|
|
||||||
MES.new('warn',"No skin file: "..list[i])
|
|
||||||
end
|
|
||||||
gc.setDefaultFilter('linear','linear')
|
|
||||||
for y=0,2 do
|
|
||||||
for x=1,8 do
|
|
||||||
SKIN.lib[i][8*y+x]=C(30,30)
|
|
||||||
gc.draw(I,30-30*x,-30*y)
|
|
||||||
|
|
||||||
SKIN.libMini[i][8*y+x]=C(6,6)
|
|
||||||
gc.draw(I,6-6*x,-6*y,nil,.2)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
I:release()
|
|
||||||
gc.setCanvas()
|
|
||||||
gc.pop()
|
|
||||||
if not skip and i~=count then
|
|
||||||
coroutine.yield()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
SKIN.loadOne=nil
|
|
||||||
SKIN.loadAll=nil
|
|
||||||
|
|
||||||
function SKIN.prevSet()--Prev skin_set
|
|
||||||
local _=(SETTING.skinSet-2)%count+1
|
|
||||||
SETTING.skinSet=_
|
|
||||||
SKIN.change(_)
|
|
||||||
_=list[_]
|
|
||||||
TEXT.show(_,1100,100,int(300/#_)+5,'fly')
|
|
||||||
end
|
|
||||||
function SKIN.nextSet()--Next skin_set
|
|
||||||
local _=SETTING.skinSet%count+1
|
|
||||||
SETTING.skinSet=_
|
|
||||||
SKIN.change(_)
|
|
||||||
_=list[_]
|
|
||||||
TEXT.show(_,1100,100,int(300/#_)+5,'fly')
|
|
||||||
end
|
|
||||||
function SKIN.change(i)--Change to skin_set[i]
|
|
||||||
SKIN.curText=SKIN.lib[i]
|
|
||||||
SKIN.curTextMini=SKIN.libMini[i]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
SKIN.loadOne=coroutine.wrap(load)
|
SKIN.lib,SKIN.libMini={},{}
|
||||||
function SKIN.loadAll()load(true)end
|
local skinMeta={__index=function(self,name)
|
||||||
|
gc.push()
|
||||||
|
gc.origin()
|
||||||
|
local f1,f2=gc.getDefaultFilter()
|
||||||
|
gc.setDefaultFilter('nearest','nearest')
|
||||||
|
local I
|
||||||
|
local N=Skins[name]
|
||||||
|
if love.filesystem.getInfo(N)then
|
||||||
|
I=gc.newImage(N)
|
||||||
|
else
|
||||||
|
MES.new('warn',"No skin file: "..Skins[name])
|
||||||
|
end
|
||||||
|
gc.setDefaultFilter(f1,f2)
|
||||||
|
|
||||||
|
SKIN.lib[name],SKIN.libMini[name]={},{}
|
||||||
|
gc.setColor(1,1,1)
|
||||||
|
for y=0,2 do
|
||||||
|
for x=1,8 do
|
||||||
|
SKIN.lib[name][8*y+x]=C(30,30)
|
||||||
|
if I then gc.draw(I,30-30*x,-30*y)end
|
||||||
|
|
||||||
|
SKIN.libMini[name][8*y+x]=C(6,6)
|
||||||
|
if I then gc.draw(I,6-6*x,-6*y,nil,.2)end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
gc.setCanvas()
|
||||||
|
gc.pop()
|
||||||
|
return self[name]
|
||||||
|
end}
|
||||||
|
setmetatable(SKIN.lib,skinMeta)
|
||||||
|
setmetatable(SKIN.libMini,skinMeta)
|
||||||
|
|
||||||
|
function SKIN.loadAll()SKIN.loadAll=nil for _,v in next,list do local _=SKIN.lib[v.name]end end
|
||||||
end
|
end
|
||||||
return SKIN
|
return SKIN
|
||||||
Reference in New Issue
Block a user