皮肤/音效/BGM文件缺失时不崩溃,只弹出警告
This commit is contained in:
@@ -40,6 +40,8 @@ function BGM.loadOne(N)
|
|||||||
BGM.list[N]=love.audio.newSource(file,"stream")
|
BGM.list[N]=love.audio.newSource(file,"stream")
|
||||||
BGM.list[N]:setLooping(true)
|
BGM.list[N]:setLooping(true)
|
||||||
BGM.list[N]:setVolume(0)
|
BGM.list[N]:setVolume(0)
|
||||||
|
else
|
||||||
|
LOG.print("No BGM file: "..N,color.red)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function BGM.loadAll()
|
function BGM.loadAll()
|
||||||
@@ -52,10 +54,7 @@ function BGM.play(s)
|
|||||||
BGM.playing=BGM.list[s]
|
BGM.playing=BGM.list[s]
|
||||||
BGM.suspend,BGM.nowPlay=s
|
BGM.suspend,BGM.nowPlay=s
|
||||||
return
|
return
|
||||||
elseif not s then
|
elseif not(s and BGM.list[s])then
|
||||||
return
|
|
||||||
elseif not BGM.list[s]then
|
|
||||||
LOG.print("Cannot find BGM: "..s,"short",color.red)
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if BGM.nowPlay~=s then
|
if BGM.nowPlay~=s then
|
||||||
|
|||||||
@@ -26,7 +26,12 @@ SFX.list={
|
|||||||
}
|
}
|
||||||
function SFX.loadOne(_)
|
function SFX.loadOne(_)
|
||||||
_,SFX.list[_]=SFX.list[_]
|
_,SFX.list[_]=SFX.list[_]
|
||||||
SFX.list[_]={love.audio.newSource("/SFX/".._..".ogg","static")}
|
local N="/SFX/".._..".ogg"
|
||||||
|
if love.filesystem.getInfo(N)then
|
||||||
|
SFX.list[_]={love.audio.newSource(N,"static")}
|
||||||
|
else
|
||||||
|
LOG.print("No SFX file: "..N,color.red)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
function SFX.loadAll()
|
function SFX.loadAll()
|
||||||
for i=1,#SFX.list do
|
for i=1,#SFX.list do
|
||||||
|
|||||||
@@ -54,8 +54,15 @@ function SKIN.load()
|
|||||||
gc.setDefaultFilter("nearest","nearest")
|
gc.setDefaultFilter("nearest","nearest")
|
||||||
gc.setColor(1,1,1)
|
gc.setColor(1,1,1)
|
||||||
for i=1,#list do
|
for i=1,#list do
|
||||||
local I=gc.newImage("/image/skin/"..list[i]..".png")
|
|
||||||
SKIN.lib[i],SKIN.libMini[i]={},{}--30/6
|
SKIN.lib[i],SKIN.libMini[i]={},{}--30/6
|
||||||
|
local N="/image/skin/"..list[i]..".png"
|
||||||
|
local I
|
||||||
|
if love.filesystem.getInfo(N)then
|
||||||
|
I=gc.newImage(N)
|
||||||
|
else
|
||||||
|
I=gc.newImage("/image/skin/"..list[1]..".png")
|
||||||
|
LOG.print("No skin file: "..list[i],color.red)
|
||||||
|
end
|
||||||
for j=1,11 do
|
for j=1,11 do
|
||||||
SKIN.lib[i][j]=C(30,30)
|
SKIN.lib[i][j]=C(30,30)
|
||||||
gc.draw(I,30-30*j,0)
|
gc.draw(I,30-30*j,0)
|
||||||
|
|||||||
Reference in New Issue
Block a user